def s_bonds_mol_from_xyz(xyz): """ Create a single bonded molecule from xyz using RMG's connectTheDots() """ mol = Molecule() coordinates = list() if not isinstance(xyz, (str, unicode)): raise SpeciesError('xyz must be a string format, got: {0}'.format(type(xyz))) for line in xyz.split('\n'): if line: atom = Atom(element=str(line.split()[0])) coordinates.append([float(line.split()[1]), float(line.split()[2]), float(line.split()[3])]) atom.coords = np.array(coordinates[-1], np.float64) mol.addAtom(atom) mol.connectTheDots() # only adds single bonds, but we don't care return mol, coordinates