def read(self,string): """ Arguments: - string: String to parse Return: - data: Data object, with a molecule and a molecules attribute. """ from PyQuante.Element import sym2no from PyQuante.Molecule import Molecule geometries = [] igeo = 1 lines = string.splitlines() while 1: try: line = lines.pop(0) except IndexError: break if not line: break nat = int(line.split()[0]) title = lines.pop(0) atoms = [] for i in xrange(nat): line = lines.pop(0) words = line.split() atno = sym2no[words[0]] x,y,z = map(float,words[1:]) atoms.append((atno,(x,y,z))) atoms = Molecule("XYZ geometry #%d" % igeo,atoms) igeo += 1 geometries.append(atoms) data = Data() data.molecule = geometries[0] # First geometry data.molecules = geometries return data
def read(self, string): """ Arguments: - string: String to parse Return: - data: Data object, with a molecule and a molecules attribute. """ from PyQuante.Element import sym2no from PyQuante.Molecule import Molecule geometries = [] igeo = 1 lines = string.splitlines() while 1: try: line = lines.pop(0) except IndexError: break if not line: break nat = int(line.split()[0]) title = lines.pop(0) atoms = [] for i in xrange(nat): line = lines.pop(0) words = line.split() atno = sym2no[words[0]] x, y, z = map(float, words[1:]) atoms.append((atno, (x, y, z))) atoms = Molecule("XYZ geometry #%d" % igeo, atoms) igeo += 1 geometries.append(atoms) data = Data() data.molecule = geometries[0] # First geometry data.molecules = geometries return data
def dump(self, filename, format=None): from PyQuante.IO.Data import Data data = Data() data.molecule = self hand = FileHandler() hand.write(filename, data, format)
def as_string(self, format="xyz"): from PyQuante.IO.Data import Data data = Data() data.molecule = self hand = StringHandler() return hand.write(data, format)
def dump(self,filename, format=None): from PyQuante.IO.Data import Data data = Data() data.molecule = self hand = FileHandler() hand.write(filename,data,format)
def as_string(self,format="xyz"): from PyQuante.IO.Data import Data data = Data() data.molecule = self hand = StringHandler() return hand.write(data, format)