It is permissible to communicate with such people because there is a possibility that they might come back to the right path as a result of such ties. However, in some cases such communication encourages them to do wrong. Then, it becomes prohibited.
Religious rituals that Shias perform to mourn the tragedies of the Imams of the Ahlulbait (peace be upon them) and to present the oppressions that they suffered are recommended. However, it is obligatory to avoid what causes harm to the soul or the body. If it does not result in harm, it remains being recommended. One should avoid performing them in a place where the reputation of the Shias is damaged.