def cmpatoms(mol1, mol2): if len(mol1) != len(mol2): print 'Atom numbers is not equal: %i vs %i' % (len(mol1), len(mol2)) return False result = True for idx in range(len(mol1)): atom1 = mol1.atoms[idx] atom2 = mol2.atoms[idx] if atom1.no != atom2.no: print 'the %i atom is different: %s vs %s' % (idx+1, atom.atomchr(atom1.no), atom.atomchr(atom2.no)) result = False elif atom1.type != atom2.type: print 'the %i atom\'s type is different: %i vs %i' % (idx+1, atom1.type, atom2.type) result = False return result