def geo_from_output(fname): import re from PyQuante.Util import parseline, cleansym from PyQuante.Element import sym2no from PyQuante.Molecule import Molecule igeo = re.compile('Input geometry') sgeo = re.compile('Symmetrized geometry') # Double check the syntax of these last two ngeo = re.compile('new geometry') fgeo = re.compile('final geometry') geo = [] file = open(fname) while 1: line = file.readline() if not line: break if igeo.search(line) or sgeo.search(line) or ngeo.search(line) \ or fgeo.search(line): geo = [] line = file.readline() line = file.readline() while 1: line = file.readline() if len(line.split()) < 4: break sym, x, y, z = parseline(line, 'sfff') atno = sym2no[cleansym(sym)] geo.append((atno, (x, y, z))) return Molecule('jaguar molecule', geo)
def geo_from_output(fname): import re from PyQuante.Util import parseline,cleansym from PyQuante.Element import sym2no from PyQuante.Molecule import Molecule igeo = re.compile('Input geometry') sgeo = re.compile('Symmetrized geometry') # Double check the syntax of these last two ngeo = re.compile('new geometry') fgeo = re.compile('final geometry') geo = [] file = open(fname) while 1: line = file.readline() if not line: break if igeo.search(line) or sgeo.search(line) or ngeo.search(line) \ or fgeo.search(line): geo = [] line = file.readline() line = file.readline() while 1: line = file.readline() if len(line.split()) < 4: break sym,x,y,z = parseline(line,'sfff') atno = sym2no[cleansym(sym)] geo.append((atno,(x,y,z))) return Molecule('jaguar molecule',geo)
def parse_atoms(atom_lines,**opts): from PyQuante.Molecule import Molecule atomlist = [] for line in atom_lines[1:]: atno,x,y,z = parseline(line,'xxdfff') atomlist.append((atno,(x,y,z))) molopts = {} if re.search("Angs",atom_lines[0]): molopts['units'] = 'angs' atoms = Molecule('Molf',atomlist,**molopts) return atoms
def split_guess_lines(guess_lines): from PyQuante.Util import parseline from PyQuante.NumWrap import transpose, array import re orbpat = re.compile('Orbital Energy') orb = [] orbe = [] occs = [] orbs = [] for line in guess_lines: if orbpat.search(line): orbei, occi = parseline(line, 'xxxfxf') orbe.append(orbei) occs.append(occi) orb = [] orbs.append(orb) else: orb.extend(map(float, line.split())) orbs = transpose(array(orbs)) return occs, orbe, orbs
def split_guess_lines(guess_lines): from PyQuante.Util import parseline from PyQuante.NumWrap import transpose,array import re orbpat = re.compile('Orbital Energy') orb = [] orbe = [] occs = [] orbs = [] for line in guess_lines: if orbpat.search(line): orbei,occi = parseline(line,'xxxfxf') orbe.append(orbei) occs.append(occi) orb = [] orbs.append(orb) else: orb.extend(map(float,line.split())) orbs = transpose(array(orbs)) return occs,orbe,orbs