def _get_OPT_XYZ(self): coordinateLines = re.compile("Standard orientation.*?X.*?Z(.*?)Rotational constants", re.DOTALL).findall(self.fileText) allCoordinates = [] for entry in coordinateLines: allCoordinates.append([]) xyzArray = entry.splitlines()[2:-2] for line in xyzArray: [number, atomicNumber, x, y, z] = map(eval, line.strip().split()) from Molecules import getAtomFromInfo atomName = getAtomFromInfo("ATOMIC NUMBER", atomicNumber) allCoordinates[-1].append([atomName, x, y, z]) return allCoordinates
def _get_INITIAL_XYZ(self): coordinateLines = re.compile("Standard orientation.*?X.*?Z(.*?)Rotational constants", re.DOTALL).search(self.fileText).groups()[0].strip().splitlines()[1:-1] geom = [] atoms = [] for line in coordinateLines: values = map(eval, line.strip().split()) atomicNumber = values[1] xyz = values[-3:] from Molecules import getAtomFromInfo atomName = getAtomFromInfo("ATOMIC NUMBER", atomicNumber) geom.append(xyz) atoms.append(atomName) return atoms, geom