Benzimidazole or diamide from a reaction of diamines and carboxylic acids or acid chlorides: crystal structures and theoretical studies