implemented the constructor for the molecule class