From: <bao...@us...> - 2006-03-07 09:52:30
|
Revision: 6 Author: baoilleach Date: 2006-03-07 01:52:22 -0800 (Tue, 07 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=6&view=rev Log Message: ----------- Separated G03 from Logfile. Modified Paths: -------------- trunk/src/cclib/parser/G03.py Added Paths: ----------- trunk/src/cclib/parser/Logfile.py trunk/src/cclib/parser/__init__.py Modified: trunk/src/cclib/parser/G03.py =================================================================== --- trunk/src/cclib/parser/G03.py 2006-03-07 09:49:10 UTC (rev 5) +++ trunk/src/cclib/parser/G03.py 2006-03-07 09:52:22 UTC (rev 6) @@ -19,45 +19,8 @@ """ import math,sys,logging,copy,re,os,time # How many of these are necessary? import Numeric +from Logfile import Logfile # import the superclass -def convertor(value,fromunits,tounits): - """Convert from one set of units to another. - - >>> convertor(8,"eV","cm-1") - 64000 - """ - _convertor = {"eV_to_cm-1": lambda x: x*8065.6, - "nm_to_cm-1": lambda x: 1e7/x, - "cm-1_to_nm": lambda x: 1e7/x} - - return _convertor["%s_to_%s" % (fromunits,tounits)] (value) - -class PeriodicTable(object): - """Allows conversion between element name and atomic no. - - >>> t = PeriodicTable() - >>> t.element[6] - 'C' - >>> t.number['C'] - 6 - """ - def __init__(self): - self.element = [None,"H","He","Li","Be","B","C","N","O","F","Ne"] - self.number = {} - for i in range(1,len(self.element)): - self.number[self.element[i]] = i - -class Logfile(object): - """Abstract class that contains the methods that act on data - parsed from various types of logfile.""" - def __init__(self,filename): - self.filename = filename - - def float(self,number): - """Convert a string to a float avoiding the problem with Ds.""" - number = number.replace("D","E") - return float(number) - class G03(Logfile): """A Gaussian 03 log file Copied: trunk/src/cclib/parser/Logfile.py (from rev 5, trunk/src/cclib/parser/G03.py) =================================================================== --- trunk/src/cclib/parser/Logfile.py (rev 0) +++ trunk/src/cclib/parser/Logfile.py 2006-03-07 09:52:22 UTC (rev 6) @@ -0,0 +1,63 @@ +""" +cclib is a parser for computational chemistry log files. + +See http://cclib.sf.net for more information. + +Copyright (C) 2006 Noel O'Boyle and Adam Tenderholt + + This program is free software; you can redistribute and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + +Contributions (monetary as well as code :-) are encouraged. +""" +import math,sys,logging,copy,re,os,time # How many of these are necessary? +import Numeric + +def convertor(value,fromunits,tounits): + """Convert from one set of units to another. + + >>> convertor(8,"eV","cm-1") + 64000 + """ + _convertor = {"eV_to_cm-1": lambda x: x*8065.6, + "nm_to_cm-1": lambda x: 1e7/x, + "cm-1_to_nm": lambda x: 1e7/x} + + return _convertor["%s_to_%s" % (fromunits,tounits)] (value) + +class PeriodicTable(object): + """Allows conversion between element name and atomic no. + + >>> t = PeriodicTable() + >>> t.element[6] + 'C' + >>> t.number['C'] + 6 + """ + def __init__(self): + self.element = [None,"H","He","Li","Be","B","C","N","O","F","Ne"] + self.number = {} + for i in range(1,len(self.element)): + self.number[self.element[i]] = i + +class Logfile(object): + """Abstract class that contains the methods that act on data + parsed from various types of logfile.""" + def __init__(self,filename): + self.filename = filename + + def float(self,number): + """Convert a string to a float avoiding the problem with Ds.""" + number = number.replace("D","E") + return float(number) + +if __name__=="__main__": + import doctest,parser + doctest.testmod(parser,verbose=False) Added: trunk/src/cclib/parser/__init__.py =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ate...@us...> - 2006-03-09 19:54:26
|
Revision: 14 Author: atenderholt Date: 2006-03-09 11:54:18 -0800 (Thu, 09 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=14&view=rev Log Message: ----------- Initial work on progress dialog support Modified Paths: -------------- trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/logfileparser.py Added Paths: ----------- trunk/src/cclib/parser/textprogress.py Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-03-09 09:54:04 UTC (rev 13) +++ trunk/src/cclib/parser/g03parser.py 2006-03-09 19:54:18 UTC (rev 14) @@ -24,10 +24,10 @@ class G03(Logfile): """A Gaussian 98/03 log file""" SCFRMS,SCFMAX,SCFENERGY = range(3) # Used to index self.scftargets[] - def __init__(self,filename): + def __init__(self,*args): # Call the __init__ method of the superclass - super(G03, self).__init__(filename) + super(G03, self).__init__(*args) # Set up the logger...will move this into superclass # through a function call with G03 as a parameter. @@ -50,8 +50,24 @@ def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename,"r") + + if self.progress: + + inputfile.seek(0,2) #go to end of file + nstep=inputfile.tell() + inputfile.seek(0) + self.progress.initialize(nstep) + self.oldstep=0 + for line in inputfile: + if self.progress: + + step=inputfile.tell() + if not (step==self.oldstep): + self.progress.update(step) + self.oldstep=step + if line[1:8]=="NAtoms=": # Find the number of atoms natom = int(line.split()[1]) Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-03-09 09:54:04 UTC (rev 13) +++ trunk/src/cclib/parser/logfileparser.py 2006-03-09 19:54:18 UTC (rev 14) @@ -71,6 +71,7 @@ natom -- number of atoms nbasis -- number of basis functions nindep -- number of linearly-independent basis functions + progress -- class (or None) for handling progress info scftargets -- targets for convergence of the SCF scfvalues -- current values for convergence of the SCF vibfreqs -- vibrational frequencies @@ -78,8 +79,9 @@ vibramans -- Raman intensity vibsyms -- symmetry of vibrations """ - def __init__(self,filename): + def __init__(self,filename,progress=None): self.filename = filename + self.progress = progress def float(self,number): """Convert a string to a float avoiding the problem with Ds.""" Added: trunk/src/cclib/parser/textprogress.py =================================================================== --- trunk/src/cclib/parser/textprogress.py (rev 0) +++ trunk/src/cclib/parser/textprogress.py 2006-03-09 19:54:18 UTC (rev 14) @@ -0,0 +1,35 @@ + +class TextProgress: + + def __init__(self): + + self.nstep=0 + self.text=None + self.oldprogress=0 + self.progress=0 + + def initialize(self,nstep,text=None): + + self.nstep=float(nstep) + self.text=text + + def update(self,step,newtext=None): + + self.progress=int(float(step)/self.nstep*100) + #print step,self.nstep + + if(self.progress/10==self.oldprogress/10+1): #just went through an interval of ten, ie. from 39 to 41, so update + + str="[" + for i in range(self.progress/10): + str+="=" + for i in range(self.progress/10,10): + str+="-" + + str+="]" + + print str + + self.oldprogress=self.progress + return + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-03-15 20:19:05
|
Revision: 19 Author: baoilleach Date: 2006-03-15 12:18:56 -0800 (Wed, 15 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=19&view=rev Log Message: ----------- Moved logging stuff from G03 into Logfile. Also, added variable types and units to attribute list in Logfile. Modified Paths: -------------- trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/logfileparser.py Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-03-11 17:41:38 UTC (rev 18) +++ trunk/src/cclib/parser/g03parser.py 2006-03-15 20:18:56 UTC (rev 19) @@ -28,18 +28,8 @@ def __init__(self,*args): # Call the __init__ method of the superclass - super(G03, self).__init__(*args) + super(G03, self).__init__(*args,logname="G03") - # Set up the logger...will move this into superclass - # through a function call with G03 as a parameter. - # Note: all loggers with the same name share the logger. - # Here, loggers with different filenames are different - self.logger = logging.getLogger('G03.%s' % self.filename) - self.logger.setLevel(logging.INFO) - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter(logging.Formatter("[%(name)s %(levelname)s] %(message)s")) - self.logger.addHandler(handler) - def __str__(self): """Return a string representation of the object.""" return "Gaussian 03 log file %s" % (self.filename) Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-03-11 17:41:38 UTC (rev 18) +++ trunk/src/cclib/parser/logfileparser.py 2006-03-15 20:18:56 UTC (rev 19) @@ -17,14 +17,14 @@ Contributions (monetary as well as code :-) are encouraged. """ -import math,sys,logging,copy,re,os,time # How many of these are necessary? +import logging, sys import Numeric def convertor(value,fromunits,tounits): """Convert from one set of units to another. - >>> convertor(8,"eV","cm-1") - 64000 + >>> print "%.1f" % convertor(8,"eV","cm-1") + 64524.8 """ _convertor = {"eV_to_cm-1": lambda x: x*8065.6, "nm_to_cm-1": lambda x: 1e7/x, @@ -51,43 +51,67 @@ """Abstract class for logfile objects. Subclasses: - G03 + G03 Attributes: - aonames -- list of "Ru_3p", etc. - aooverlaps -- the atomic orbital overlap matrix - atomnos -- atomic numbers - etenergies -- energy of electronic transitions (i.e. UV-Vis, CD) - etoscs -- oscillator strength of electronic transition - etrotats -- rotatory strength(?) of electronic transitions (for CD) - etsecs -- singly-excited configurations comprising each electronic transition - etsyms -- symmetry of electronic transition - geotargets -- targets for convergence of the geometry - geovalues -- current values for convergence of the geometry - homos -- location of HOMO(s) - mocoeffs -- molecular orbital coefficients - moenergies -- orbital energies - mosyms -- orbital symmetries - natom -- number of atoms - nbasis -- number of basis functions - nindep -- number of linearly-independent basis functions - progress -- class (or None) for handling progress info - scftargets -- targets for convergence of the SCF - scfvalues -- current values for convergence of the SCF - vibfreqs -- vibrational frequencies - vibirs -- IR intensity - vibramans -- Raman intensity - vibsyms -- symmetry of vibrations + aonames -- "Ru_3p" (list) + aooverlaps -- atomic orbital overlap matrix (array[2]) + atomnos -- atomic numbers (array) + etenergies -- energy of electronic transitions (array[1], 1/cm) + etoscs -- oscillator strength of electronic transition (array[1], ??) + etrotats -- rotatory strength of electronic transitions (array[1], ??) + etsecs -- singly-excited configurations comprising each electronic transition (??) + etsyms -- symmetry of electronic transition (list) + geotargets -- targets for convergence of the geometry (array[1]) + geovalues -- current values for convergence of the geometry (array[1], same units as geotargets) + homos -- molecular orbital index of HOMO(s) (array[1]) + mocoeffs -- molecular orbital coefficients (array[3]) + moenergies -- orbital energies (array[2], eV) + mosyms -- orbital symmetries (array[2]) + natom -- number of atoms (integer) + nbasis -- number of basis functions (integer) + nindep -- number of linearly-independent basis functions (integer) + scftargets -- targets for convergence of the SCF (array[1]) + scfvalues -- current values for convergence of the SCF (array[1], same units as scftargets) + vibfreqs -- vibrational frequencies (array, 1/cm) + vibirs -- IR intensity (array, ??) + vibramans -- Raman intensity (array, ??) + vibsyms -- symmetry of vibrations (list) + (1) The term 'array' currently refers to a Numeric array + (2) The number of dimensions of an array is given in square brackets + (3) Python indexes arrays/lists starting at zero. So if homos==[10], then + the 11th molecular orbital is the HOMO """ - def __init__(self,filename,progress=None): + def __init__(self,filename,progress=None, + loglevel=logging.INFO,logname="Log"): + """Initialise the logging object. + + Typically called by subclasses in their own __init__ methods. + """ self.filename = filename self.progress = progress + self.loglevel = loglevel + self.logname = logname + # Set up the logger + self.logger = logging.getLogger('%s.%s' % (self.logname,self.filename)) + self.logger.setLevel(logging.INFO) + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter(logging.Formatter("[%(name)s %(levelname)s] %(message)s")) + self.logger.addHandler(handler) + def float(self,number): - """Convert a string to a float avoiding the problem with Ds.""" + """Convert a string to a float avoiding the problem with Ds. + + >>> t = Logfile("dummyfile") + >>> t.float("123.2323E+02") + 12323.23 + >>> t.float("123.2323D+02") + 12323.23 + """ number = number.replace("D","E") return float(number) if __name__=="__main__": - import doctest,parser - doctest.testmod(parser,verbose=False) + import doctest,logfileparser + doctest.testmod(logfileparser,verbose=False) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-03-15 20:24:30
|
Revision: 20 Author: baoilleach Date: 2006-03-15 12:24:24 -0800 (Wed, 15 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=20&view=rev Log Message: ----------- Corrected mispelling in logfile, and tidied up imports in g03parser Modified Paths: -------------- trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/logfileparser.py Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-03-15 20:18:56 UTC (rev 19) +++ trunk/src/cclib/parser/g03parser.py 2006-03-15 20:24:24 UTC (rev 20) @@ -17,7 +17,7 @@ Contributions (monetary as well as code :-) are encouraged. """ -import math,sys,logging,copy,re,os,time # How many of these are necessary? +import re,time import Numeric import random # For sometimes running the progress updater from logfileparser import Logfile # import the superclass @@ -398,7 +398,7 @@ # *** Overlap *** # ****** Overlap ****** self.logger.info("Creating attribute aooverlaps[x,y]") - import time; oldtime = time.time() + # oldtime = time.time() self.aooverlaps = Numeric.zeros( (self.nbasis,self.nbasis), "float") # Overlap integrals for basis fn#1 are in aooverlaps[0] base = 0 @@ -413,10 +413,10 @@ self.aooverlaps[i+base,base+j] = k base += 5 colmNames = inputfile.next() - self.logger.info("Took %f seconds" % (time.time()-oldtime)) + # self.logger.info("Took %f seconds" % (time.time()-oldtime)) if line[5:35]=="Molecular Orbital Coefficients" or line[5:41]=="Alpha Molecular Orbital Coefficients" or line[5:40]=="Beta Molecular Orbital Coefficients": - import time; oldtime = time.time() + # oldtime = time.time() if line[5:40]=="Beta Molecular Orbital Coefficients": beta = True # Need to add an extra dimension to self.mocoeffs @@ -450,7 +450,7 @@ self.mocoeffs[1,base:base+len(part)/10,i] = temp else: self.mocoeffs[base:base+len(part)/10,i] = temp - self.logger.info("Took %f seconds" % (time.time()-oldtime)) + # self.logger.info("Took %f seconds" % (time.time()-oldtime)) inputfile.close() Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-03-15 20:18:56 UTC (rev 19) +++ trunk/src/cclib/parser/logfileparser.py 2006-03-15 20:24:24 UTC (rev 20) @@ -84,7 +84,7 @@ """ def __init__(self,filename,progress=None, loglevel=logging.INFO,logname="Log"): - """Initialise the logging object. + """Initialise the Logfile object. Typically called by subclasses in their own __init__ methods. """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-03-15 21:59:50
|
Revision: 22 Author: baoilleach Date: 2006-03-15 13:59:43 -0800 (Wed, 15 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=22&view=rev Log Message: ----------- Conversion from lists to Numeric arrays in G03 Modified Paths: -------------- trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/logfileparser.py Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-03-15 20:54:26 UTC (rev 21) +++ trunk/src/cclib/parser/g03parser.py 2006-03-15 21:59:43 UTC (rev 22) @@ -28,7 +28,7 @@ def __init__(self,*args): # Call the __init__ method of the superclass - super(G03, self).__init__(*args,logname="G03") + super(G03, self).__init__(logname="G03",*args) def __str__(self): """Return a string representation of the object.""" @@ -155,7 +155,7 @@ if not hasattr(self,"geotargets"): self.logger.info("Creating attributes geotargets[],geovalues[[]]") self.geovalues = [] - self.geotargets = [None]*4 + self.geotargets = Numeric.array( [0.0,0.0,0.0,0.0],"f") newlist = [0]*4 for i in range(4): line = inputfile.next() @@ -447,6 +447,12 @@ inputfile.close() + # Convert from lists to arrays (it's easier this way in most cases) + self.scfenergies = Numeric.array(self.scfenergies,"f") + self.scfvalues = Numeric.array(self.scftargets,"f") + scf.geovalues = Numeric.array(self.scfvalues,"f") + + # Note to self: Needs to be added to the main parser def extractTrajectory(self): """Extract trajectory information from a Gaussian logfile.""" Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-03-15 20:54:26 UTC (rev 21) +++ trunk/src/cclib/parser/logfileparser.py 2006-03-15 21:59:43 UTC (rev 22) @@ -71,6 +71,7 @@ natom -- number of atoms (integer) nbasis -- number of basis functions (integer) nindep -- number of linearly-independent basis functions (integer) + scfenergies -- the electronic energy of the molecule (array[1], a.u.) scftargets -- targets for convergence of the SCF (array[1]) scfvalues -- current values for convergence of the SCF (array[2], same units as scftargets) vibfreqs -- vibrational frequencies (array, 1/cm) @@ -94,7 +95,7 @@ self.logname = logname # Set up the logger - self.logger = logging.getLogger('%s.%s' % (self.logname,self.filename)) + self.logger = logging.getLogger('%s %s' % (self.logname,self.filename)) self.logger.setLevel(logging.INFO) handler = logging.StreamHandler(sys.stdout) handler.setFormatter(logging.Formatter("[%(name)s %(levelname)s] %(message)s")) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-03-18 21:43:55
|
Revision: 27 Author: baoilleach Date: 2006-03-18 13:43:47 -0800 (Sat, 18 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=27&view=rev Log Message: ----------- Adding the GAMESS parser. Currently passes simple unit tests. Modified Paths: -------------- trunk/src/cclib/parser/__init__.py Added Paths: ----------- trunk/src/cclib/parser/gamessparser.py Modified: trunk/src/cclib/parser/__init__.py =================================================================== --- trunk/src/cclib/parser/__init__.py 2006-03-18 21:42:45 UTC (rev 26) +++ trunk/src/cclib/parser/__init__.py 2006-03-18 21:43:47 UTC (rev 27) @@ -1 +1,2 @@ from g03parser import G03 +from gamessparser import GAMESS Added: trunk/src/cclib/parser/gamessparser.py =================================================================== --- trunk/src/cclib/parser/gamessparser.py (rev 0) +++ trunk/src/cclib/parser/gamessparser.py 2006-03-18 21:43:47 UTC (rev 27) @@ -0,0 +1,270 @@ +""" +cclib is a parser for computational chemistry log files. + +See http://cclib.sf.net for more information. + +Copyright (C) 2006 Noel O'Boyle and Adam Tenderholt + + This program is free software; you can redistribute and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + +Contributions (monetary as well as code :-) are encouraged. +""" +import re,time +import Numeric +import random # For sometimes running the progress updater +from logfileparser import Logfile,convertor + +class GAMESS(Logfile): + """A GAMESS log file.""" + SCFRMS,SCFMAX,SCFENERGY = range(3) # Used to index self.scftargets[] + def __init__(self,*args): + + # Call the __init__ method of the superclass + super(GAMESS, self).__init__(logname="GAMESS",*args) + + def __str__(self): + """Return a string representation of the object.""" + return "GAMESS log file %s" % (self.filename) + + def __repr__(self): + """Return a representation of the object.""" + return 'GAMESS("%s")' % (self.filename) + + def parse(self): + """Extract information from the logfile.""" + inputfile = open(self.filename,"r") + + if self.progress: + + inputfile.seek(0,2) #go to end of file + nstep=inputfile.tell() + inputfile.seek(0) + self.progress.initialize(nstep) + oldstep=0 + + + endofopt = False + + for line in inputfile: + + if self.progress and random.random()<0.05: + + step = inputfile.tell() + if step!=oldstep: + self.progress.update(step) + oldstep = step + + if line.find("OPTTOL")>=0: + # Two possibilities: + # OPTTOL = 1.000E-04 RMIN = 1.500E-03 + # INPUT CARD> $STATPT OPTTOL=0.0001 NSTEP=100 $END + if not hasattr(self,"geotargets"): + self.logger.info("Creating attribute geotargets[]") + temp = line.split() + for i,x in enumerate(temp): + if x.find("OPTTOL")>=0: + if x=="OPTTOL": + opttol = float(temp[i+2]) + else: + opttol = float(x.split('=')[1]) + self.geotargets = Numeric.array([opttol,3./opttol]) + + if line.find("EQUILIBRIUM GEOMETRY LOCATED")>=0: +# This is necessary if a frequency calculation follows a geometry optimisation + endofopt = True + + if not endofopt and line.find("FINAL")==1: + if not hasattr(self,"scfenergies"): + self.logger.info("Creating attribute scfenergies[]") + self.scfenergies = [] +# Here is an example from Neil Berry: +# FINAL R-B3LYP ENERGY IS -382.0507446475 AFTER 10 ITERATIONS +# but in some cases the energy can be in position [3] not [4] so let's +# take the number after the "IS" + temp = line.split() + self.scfenergies.append(temp[temp.index("IS")+1]) + + if not endofopt and line.find("MAXIMUM GRADIENT")>0: + if not hasattr(self,"geovalues"): + self.logger.info("Creating attribute geovalues[]") + self.geovalues = [] + temp = line.strip().split() + self.geovalues.append([float(temp[3]),float(temp[7])]) + + + + if line.find("DENSITY CONV=")==5: + self.scftargets[0] = float(line.strip().split()[-1]) + + if line.find("ITER EX DEM")==1: +# This is the section with the SCF information + if not hasattr(self,"scfvalues"): + self.logger.info("Creating attribute scfvalues") + self.scfvalues = [] + line = inputfile.next() + den = [] + while line!='\n': +# The SCF information is terminated by a blank line + try: + temp = int(line[0:4]) + except ValueError: +# Occurs for: +# * * * INITIATING DIIS PROCEDURE * * * +# CONVERGED TO SWOFF, SO DFT CALCULATION IS NOW SWITCHED ON +# DFT CODE IS SWITCHING BACK TO THE FINER GRID + pass + else: + den.append(float(line.split()[5])) + line = inputfile.next() + self.scfvalues.append(den) + + if line.find("NORMAL COORDINATE ANALYSIS IN THE HARMONIC APPROXIMATION")>=0: + # Start of the frequency section + self.logger.info("Creating attributes vibfreqs, vibirs") + self.vibfreqs = [] + self.vibirs = [] + + # Need to get past the list of atomic weights + hyphens = inputfile.next() + blank = inputfile.next() + line = inputfile.next() + blank = inputfile.next() + line = inputfile.next() + numAtom = 0 + while line!="\n": + numAtom += 1 + line = inputfile.next() + + # Print out the following lines which may contain some useful info: + # e.g. WARNING, MODE 7 HAS BEEN CHOSEN AS A VIBRATION + line = inputfile.next() + while line.find("FREQUENCIES IN CM**-1")==-1: + line = inputfile.next() + line = inputfile.next() + + blank = inputfile.next() + freqNo = inputfile.next() + while freqNo.find("SAYVETZ")==-1: + freq = inputfile.next().strip().split() + self.vibfreqs.extend(map(float,freq[1:])) + reducedMass = inputfile.next() + irIntensity = inputfile.next().strip().split() + self.vibirs.extend(map(float,irIntensity[2:])) + blank = inputfile.next() + # Skip XYZ data for each atom plus + # the Sayvetz stuff at the end + for j in range(numAtom*3+10): + line = inputfile.next() + blank = inputfile.next() + freqNo = inputfile.next() + self.vibfreqs = Numeric.array(self.vibfreqs,"f") + self.vibirs = Numeric.array(self.vibirs,"f") + + + if line.find("EIGENVECTORS")==10 or line.find("MOLECULAR OBRITALS")==10: + # The details returned come from the *final* report of evalues and + # the last list of symmetries in the log file + # This is fine for GeoOpt and SP, but may be weird for TD and Freq(?) + + # Take the last one of either in the file + if not hasattr(self,"moenergies"): + self.logger.info("Creating attributes moenergies, mosyms") + self.moenergies = [] + self.mosyms = [] + if not hasattr(self,"nindep"): + self.logger.info("Creating attribute nindep with default value") + self.nindep = self.nbasis + self.mocoeffs = Numeric.zeros((1,self.nindep,self.nbasis),"f") + line = inputfile.next() + blank = inputfile.next() # blank line + base = 0 + while line.find("END OF RHF")==-1: + line = inputfile.next() # Eigenvector no + line = inputfile.next() + self.moenergies.extend(map(float,line.split())) + line = inputfile.next() + self.mosyms.extend(line.split()) + line = inputfile.next() + i=0 + while line!=blank and line.find("END OF RHF")==-1: + if base==0: # Just do this the first time 'round + atomno=int(line.split()[2])-1 + # atomorb[atomno].append(int(line.split()[0])-1) + # What's the story with the previous line? + temp = line[15:] # Strip off the crud at the start + j = 0 + while j*11+4<len(temp): + self.mocoeffs[0,base+j,i] = float(temp[j*11:(j+1)*11]) + j+=1 + line = inputfile.next() + i+=1 + base+=5 + self.moenergies = Numeric.array(self.moenergies,"f") + + if line.find("NUMBER OF OCCUPIED ORBITALS")>=0: + if not hasattr(self,"homos"): + self.logger.info("Creating attribute homos") + temp = line.strip().split('=') + self.homos = Numeric.array(int(temp[-1])-1,"d") + + if line.find("TOTAL NUMBER OF ATOMS")==1: + self.logger.info("Creating attribute natom") + self.natom = int(line.split()[-1]) + + if line.find("NUMBER OF CARTESIAN GAUSSIAN BASIS")==1 or line.find("TOTAL NUMBER OF BASIS FUNCTIONS")==1: + # The first is from Julien's Example and the second is from Alexander's + # I think it happens if you use a polar basis function instead of a cartesian one + self.logger.info("Creating attribute nbasis") + self.nbasis = int(line.split()[-1]) + + elif line.find("TOTAL NUMBER OF MOS IN VARIATION SPACE")==1: + # Note that this line is not always present, so by default + # NBsUse is set equal to NBasis (see below). + self.logger.info("Creating attribute nindep") + self.indep = int(line.split()[-1]) + + elif line.find("OVERLAP MATRIX")==0 or line.find("OVERLAP MATRIX")==1: + # The first is for PC-GAMESS, the second for GAMESS + # Read 1-electron overlap matrix + self.logger.info("Creating attribute aooverlaps") + self.aooverlaps = Numeric.zeros((self.nbasis,self.nbasis), "f") + base = 0 + while base<self.nbasis: + blank = inputfile.next() + line = inputfile.next() # Basis fn number + blank = inputfile.next() + for i in range(self.nbasis-base): # Fewer lines each time + line = inputfile.next() + temp = line.split() + for j in range(4,len(temp)): + self.aooverlaps[base+j-4,i+base] = float(temp[j]) + self.aooverlaps[i+base,base+j-4] = float(temp[j]) + base+=5 + + inputfile.close() + + if not hasattr(self,"geotargets"): + self.logger.info("Creating attribute geotargets[] with default values") + opttol = 1e-4 + self.geotargets = Numeric.array([opttol,3./opttol]) + if not hasattr(self,"scftargets"): + self.logger.info("Creating attribute scftargets[] with default values") + self.scftargets = Numeric.array([1e-5]) + if hasattr(self,"geovalues"): self.geovalues = Numeric.array(self.geovalues,"f") + if not hasattr(self,"nindep"): + self.logger.info("Creating attribute nindep with default value") + self.nindep = self.nbasis + + + +if __name__=="__main__": + import doctest,parser + doctest.testmod(parser,verbose=False) Property changes on: trunk/src/cclib/parser/gamessparser.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ate...@us...> - 2006-03-22 00:06:43
|
Revision: 38 Author: atenderholt Date: 2006-03-21 16:06:38 -0800 (Tue, 21 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=38&view=rev Log Message: ----------- Work on the text progress Modified Paths: -------------- trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/logfileparser.py trunk/src/cclib/parser/textprogress.py Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-03-21 18:40:26 UTC (rev 37) +++ trunk/src/cclib/parser/g03parser.py 2006-03-22 00:06:38 UTC (rev 38) @@ -38,7 +38,7 @@ """Return a representation of the object.""" return 'G03("%s")' % (self.filename) - def parse(self): + def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") @@ -52,15 +52,21 @@ for line in inputfile: - if self.progress and random.random()<0.05: + if self.progress and random.random()<cupdate: step = inputfile.tell() if step!=oldstep: - self.progress.update(step) + self.progress.update(step,"Unsupported Information") oldstep = step if line[1:8]=="NAtoms=": # Find the number of atoms + if self.progress and random.random()<fupdate: + step = inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Attributes") + oldstep=step + natom = int(line.split()[1]) if hasattr(self,"natom"): assert self.natom==natom @@ -73,6 +79,12 @@ or line[25:45]=="Standard orientation" or line[26:43]=="Input orientation"): # Extract the atomic numbers of the atoms + if self.progress and random.random()<cupdate: + step = inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Attributes") + oldstep=step + self.logger.info("Creating attribute atomnos[]") self.atomnos = [] hyphens = inputfile.next() @@ -102,6 +114,12 @@ if line[1:10]=='Cycle 1': # Extract SCF convergence information (QM calcs) + if self.progress and random.random()<fupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"QM Convergence") + oldstep=step + if not hasattr(self,"scfvalues"): self.logger.info("Creating attribute scfvalues") self.scfvalues = [] @@ -132,6 +150,12 @@ if line[1:4]=='It=': # Extract SCF convergence information (AM1 calcs) + if self.progress: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"AM1 Convergence") + oldstep=step + self.logger.info("Creating attributes scftargets, scfvalues") self.scftargets = Numeric.array([1E-7],"f") # This is the target value for the rms self.scfvalues = [[]] @@ -171,6 +195,12 @@ if line[1:19]=='Orbital symmetries' and not hasattr(self,"mosyms"): # Extracting orbital symmetries + if self.progress and random.random()<fupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"MO Symmetries") + oldstep=step + self.logger.info("Creating attribute mosyms[[]]") self.mosyms = [[]] line = inputfile.next() @@ -205,6 +235,12 @@ if line[1:6]=="Alpha" and line.find("eigenvalues")>=0: # Extract the alpha electron eigenvalues + if self.progress and random.random()<fupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Eigenvalues") + oldstep=step + self.logger.info("Creating attribute moenergies[[]]") self.moenergies = [[]] HOMO = -2 @@ -251,6 +287,12 @@ if line[1:14]=="Harmonic freq": # Start of the IR/Raman frequency section + if self.progress and random.random()<fupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Frequency Information") + oldstep=step + self.vibsyms = [] self.vibirs = [] self.vibfreqs = [] @@ -403,6 +445,13 @@ base = 0 colmNames = inputfile.next() while base<self.nbasis: + + if self.progress and random.random()<fupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Overlap") + oldstep=step + for i in range(self.nbasis-base): # Fewer lines this time line = inputfile.next() parts = line.split() @@ -428,6 +477,13 @@ base = 0 for base in range(0,nindep,5): + + if self.progress: + step=inputfile.tell() + if step!=oldstep and random.random() < fupdate: + self.progress.update(step,"Coefficients") + oldstep=step + colmNames = inputfile.next() symmetries = inputfile.next() eigenvalues = inputfile.next() @@ -452,7 +508,9 @@ inputfile.close() - + if self.progress: + self.progress.update(nstep,"Done") + if hasattr(self,"geovalues"): self.geovalues = Numeric.array(self.geovalues,"f") if hasattr(self,"scfenergies"): self.scfenergies = Numeric.array(self.scfenergies,"f") if hasattr(self,"scfvalues"): self.scfvalues = Numeric.array(self.scftargets,"f") Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-03-21 18:40:26 UTC (rev 37) +++ trunk/src/cclib/parser/logfileparser.py 2006-03-22 00:06:38 UTC (rev 38) @@ -97,7 +97,7 @@ # Set up the logger self.logger = logging.getLogger('%s %s' % (self.logname,self.filename)) - self.logger.setLevel(logging.INFO) + self.logger.setLevel(self.loglevel) handler = logging.StreamHandler(sys.stdout) handler.setFormatter(logging.Formatter("[%(name)s %(levelname)s] %(message)s")) self.logger.addHandler(handler) Modified: trunk/src/cclib/parser/textprogress.py =================================================================== --- trunk/src/cclib/parser/textprogress.py 2006-03-21 18:40:26 UTC (rev 37) +++ trunk/src/cclib/parser/textprogress.py 2006-03-22 00:06:38 UTC (rev 38) @@ -1,3 +1,5 @@ +import sys +import thread class TextProgress: @@ -7,29 +9,38 @@ self.text=None self.oldprogress=0 self.progress=0 + self.calls=0 def initialize(self,nstep,text=None): self.nstep=float(nstep) self.text=text + + #sys.stdout.write("\n") - def update(self,step): + def update(self,step,text=None): + + self.progress = int(step*100/self.nstep) - self.progress = int(step/self.nstep*100) - #print step,self.nstep - - if self.progress/10==self.oldprogress/10+1: #just went through an interval of ten, ie. from 39 to 41, so update + if self.progress/2>=self.oldprogress/2+1 or self.text!=text: #just went through at least an interval of ten, ie. from 39 to 41, so update - str="[" - for i in range(self.progress/10): - str+="=" - for i in range(self.progress/10,10): - str+="-" - - str+="]" + str="\r[" + prog=self.progress/10 + str+=prog*"="+(10-prog)*"-" + str+="] %3i"%(self.progress)+"%" - print str + if text: + str+=" Parsing "+text + + sys.stdout.write("\r"+70*" ") + sys.stdout.flush() + sys.stdout.write(str) + sys.stdout.flush() + self.oldprogress=self.progress - self.oldprogress=self.progress + if(self.progress>=100 and text=="Done"): + print " " + + return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ate...@us...> - 2006-03-22 22:57:51
|
Revision: 40 Author: atenderholt Date: 2006-03-22 14:57:48 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=40&view=rev Log Message: ----------- Started work on ADF parser Modified Paths: -------------- trunk/src/cclib/parser/logfileparser.py Added Paths: ----------- trunk/src/cclib/parser/adfparser.py Added: trunk/src/cclib/parser/adfparser.py =================================================================== --- trunk/src/cclib/parser/adfparser.py (rev 0) +++ trunk/src/cclib/parser/adfparser.py 2006-03-22 22:57:48 UTC (rev 40) @@ -0,0 +1,543 @@ +""" +cclib is a parser for computational chemistry log files. + +See http://cclib.sf.net for more information. + +Copyright (C) 2006 Noel O'Boyle and Adam Tenderholt + + This program is free software; you can redistribute and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + +Contributions (monetary as well as code :-) are encouraged. +""" +import re,time +import Numeric +import random # For sometimes running the progress updater +from logfileparser import Logfile,convertor + +class ADF(Logfile): + """A Gaussian 98/03 log file""" + SCFRMS,SCFMAX,SCFENERGY = range(3) # Used to index self.scftargets[] + def __init__(self,*args): + + # Call the __init__ method of the superclass + super(ADF, self).__init__(logname="ADF",*args) + + def __str__(self): + """Return a string representation of the object.""" + return "ADF log file %s" % (self.filename) + + def __repr__(self): + """Return a representation of the object.""" + return 'ADF("%s")' % (self.filename) + + def parse(self,fupdate=0.05,cupdate=0.002): + """Extract information from the logfile.""" + inputfile = open(self.filename,"r") + + if self.progress: + + inputfile.seek(0,2) #go to end of file + nstep=inputfile.tell() + inputfile.seek(0) + self.progress.initialize(nstep) + oldstep=0 + + for line in inputfile: + + if self.progress and random.random()<cupdate: + + step = inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Unsupported Information") + oldstep = step + + if line.find("INPUT FILE")>=0: +#check to make sure we aren't parsing Create jobs + line2=inputfile.next() + while line: + if line.find("Create")<0: + break + + if self.progress and random.random()<cupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Unsupported Information") + oldstep=step + + + if line[1:6]=="ATOMS": +# Find the number of atoms and their atomic numbers + if self.progress and random.random()<cupdate: + step=inputfile.tell() + if step!=oldstep: + self.progress.update(step,"Attributes") + oldstep=step + + self.logger.info("Creating attribute atomnos[]") + self.atomnos=[] + + underline=inputfile.next() #clear pointless lines + label1=inputfile.next() # + label2=inputfile.next() # + line=inputfile.next() + while len(line)>1: #ensure that we are reading no blank lines + info=line.split() + self.atomnos.append(self.table.number[info[1]]) + line=inputfile.next() + + self.natom=len(self.atomnos) + self.logger.info("Creating attribute natom: %d" % self.natom) + +# if line[1:44]=='Requested convergence on RMS density matrix': +# # Find the targets for SCF convergence (QM calcs) +# if not hasattr(self,"scftargets"): +# self.logger.info("Creating attribute scftargets[]") +# self.scftargets = Numeric.array([0.0,0.0,0.0],'f') +# self.scftargets[G03.SCFRMS] = self.float(line.split('=')[1].split()[0]) +# if line[1:44]=='Requested convergence on MAX density matrix': +# self.scftargets[G03.SCFMAX] = self.float(line.strip().split('=')[1][:-1]) +# if line[1:44]=='Requested convergence on energy': +# self.scftargets[G03.SCFENERGY] = self.float(line.strip().split('=')[1][:-1]) +# +# if line[1:10]=='Cycle 1': +# # Extract SCF convergence information (QM calcs) +# if self.progress and random.random()<fupdate: +# step=inputfile.tell() +# if step!=oldstep: +# self.progress.update(step,"QM Convergence") +# oldstep=step +# +# if not hasattr(self,"scfvalues"): +# self.logger.info("Creating attribute scfvalues") +# self.scfvalues = [] +# newlist = [ [] for x in self.scftargets ] +# line = inputfile.next() +# while line.find("SCF Done")==-1: +# if line.find(' E=')==0: +# self.logger.debug(line) +# if line.find(" RMSDP")==0: +# parts = line.split() +# newlist[G03.SCFRMS].append(self.float(parts[0].split('=')[1])) +# newlist[G03.SCFMAX].append(self.float(parts[1].split('=')[1])) +# energy = 1.0 +# if len(parts)>4: +# energy = parts[2].split('=')[1] +# if energy=="": +# energy = self.float(parts[3]) +# else: +# energy = self.float(energy) +# # I moved the following line back a TAB to see the effect +# # (it was originally part of the above "if len(parts)") +# newlist[G03.SCFENERGY].append(energy) +# try: +# line = inputfile.next() +# except StopIteration: # May be interupted by EOF +# break +# self.scfvalues.append(newlist) +# +# if line[1:4]=='It=': +# # Extract SCF convergence information (AM1 calcs) +# if self.progress: +# step=inputfile.tell() +# if step!=oldstep: +# self.progress.update(step,"AM1 Convergence") +# oldstep=step +# +# self.logger.info("Creating attributes scftargets, scfvalues") +# self.scftargets = Numeric.array([1E-7],"f") # This is the target value for the rms +# self.scfvalues = [[]] +# line = inputfile.next() +# while line.find(" Energy")==-1: +# parts = line.strip().split() +# self.scfvalues[0].append(self.float(parts[-1][:-1])) +# line = inputfile.next() +# +# if line[1:9]=='SCF Done': +# # Note: this needs to follow the section where 'SCF Done' is used to terminate +# # a loop when extracting SCF convergence information +# if not hasattr(self,"scfenergies"): +# self.logger.info("Creating attribute scfenergies[]") +# self.scfenergies = [] +# self.scfenergies.append(self.float(line.split()[4])) +# +# if line[49:59]=='Converged?': +# # Extract Geometry convergence information +# if not hasattr(self,"geotargets"): +# self.logger.info("Creating attributes geotargets[],geovalues[[]]") +# self.geovalues = [] +# self.geotargets = Numeric.array( [0.0,0.0,0.0,0.0],"f") +# newlist = [0]*4 +# for i in range(4): +# line = inputfile.next() +# self.logger.debug(line) +# parts = line.split() +# try: +# value = self.float(parts[2]) +# except ValueError: +# self.logger.error("Problem parsing the value for geometry optimisation: %s is not a number." % parts[2]) +# else: +# newlist[i] = value +# self.geotargets[i] = self.float(parts[3]) +# self.geovalues.append(newlist) +# +# if line[1:19]=='Orbital symmetries' and not hasattr(self,"mosyms"): +# # Extracting orbital symmetries +# if self.progress and random.random()<fupdate: +# step=inputfile.tell() +# if step!=oldstep: +# self.progress.update(step,"MO Symmetries") +# oldstep=step +# +# self.logger.info("Creating attribute mosyms[[]]") +# self.mosyms = [[]] +# line = inputfile.next() +# unres = False +# if line.find("Alpha Orbitals")==1: +# unres = True +# line = inputfile.next() +# i = 0 +# while len(line)>18 and line[17]=='(': +# if line.find('Virtual')>=0: +# self.homos = Numeric.array([i-1],"i") # 'HOMO' indexes the HOMO in the arrays +# self.logger.info("Creating attribute homos[]") +# parts = line[17:].split() +# for x in parts: +# self.mosyms[0].append(x.strip('()')) +# i+= 1 +# line = inputfile.next() +# if unres: +# line = inputfile.next() +# # Repeat with beta orbital information +# i = 0 +# self.mosyms.append([]) +# while len(line)>18 and line[17]=='(': +# if line.find('Virtual')>=0: +# self.homos.resize([2]) # Extend the array to two elements +# self.homos[1] = i-1 # 'HOMO' indexes the HOMO in the arrays +# parts = line[17:].split() +# for x in parts: +# self.mosyms[1].append(x.strip('()')) +# i+= 1 +# line = inputfile.next() +# +# if line[1:6]=="Alpha" and line.find("eigenvalues")>=0: +# # Extract the alpha electron eigenvalues +# if self.progress and random.random()<fupdate: +# step=inputfile.tell() +# if step!=oldstep: +# self.progress.update(step,"Eigenvalues") +# oldstep=step +# +# self.logger.info("Creating attribute moenergies[[]]") +# self.moenergies = [[]] +# HOMO = -2 +# while line.find('Alpha')==1: +# if line.split()[1]=="virt." and HOMO==-2: +# # If there aren't any symmetries, +# # this is a good way to find the HOMO +# HOMO = len(self.moenergies[0])-1 +# if hasattr(self,"homos"): +# assert HOMO==self.homos[0] +# else: +# self.logger.info("Creating attribute homos[]") +# self.homos = Numeric.array([HOMO],"i") +# part = line[28:] +# i = 0 +# while i*10+4<len(part): +# x = part[i*10:(i+1)*10] +# self.moenergies[0].append(convertor(self.float(x),"hartree","eV")) +# i += 1 +# line = inputfile.next() +# if line.find('Beta')==2: +# self.moenergies.append([]) +# HOMO = -2 +# while line.find('Beta')==2: +# if line.split()[1]=="virt." and HOMO==-2: +# # If there aren't any symmetries, +# # this is a good way to find the HOMO +# HOMO = len(self.moenergies[1])-1 +# if len(self.homos)==2: +# # It already has a self.homos (with the Alpha value) +# # but does it already have a Beta value? +# assert HOMO==self.homos[1] +# else: +# self.homos.resize([2]) +# self.homos[1] = HOMO +# part = line[28:] +# i = 0 +# while i*10+4<len(part): +# x = part[i*10:(i+1)*10] +# self.moenergies[1].append(convertor(self.float(x),"hartree","eV")) +# i += 1 +# line = inputfile.next() +# self.moenergies = Numeric.array(self.moenergies,"f") +# +# if line[1:14]=="Harmonic freq": +# # Start of the IR/Raman frequency section +# if self.progress and random.random()<fupdate: +# step=inputfile.tell() +# if step!=oldstep: +# self.progress.update(step,"Frequency Information") +# oldstep=step +# +# self.vibsyms = [] +# self.vibirs = [] +# self.vibfreqs = [] +# self.logger.info("Creating attribute vibsyms[]") +# self.logger.info("Creating attribute vibfreqs[]") +# self.logger.info("Creating attribute vibirs[]") +# line = inputfile.next() +# while len(line[:15].split())>0: +# # Get past the three/four line title of the columns +# line = inputfile.next() +# line = inputfile.next() # The line with symmetries +# while len(line[:15].split())==0: +# self.logger.debug(line) +# self.vibsyms.extend(line.split()) # Adding new symmetry +# line = inputfile.next() +# self.vibfreqs.extend(map(self.float,line[15:].split())) # Adding new frequencies +# [inputfile.next() for i in [0,1]] # Skip two lines +# line = inputfile.next() +# self.vibirs.extend(map(self.float,line[15:].split())) # Adding IR intensities +# line = inputfile.next() +# if line.find("Raman")>=0: +# if not hasattr(self,"vibramans"): +# self.vibramans = [] +# self.logger.info("Creating attribute vibramans[]") +# line = inputfile.next() +# self.vibramans.extend(map(self.float,line[15:].split())) # Adding Raman intensities +# line = inputfile.next() +# while len(line[:15].split())>0: +# line = inputfile.next() +# line = inputfile.next() # Should be the line with symmetries +# self.vibfreqs = Numeric.array(self.vibfreqs,"f") +# self.vibirs = Numeric.array(self.vibirs,"f") +# if hasattr(self,"vibramans"): self.vibramans = Numeric.array(self.vibramans,"f") +# +# if line[1:14]=="Excited State": +# # Extract the electronic transitions +# if not hasattr(self,"etenergy"): +# self.etenergies = [] +# self.etoscs = [] +# self.etsyms = [] +# self.etsecs = [] +# self.logger.info("Creating attributes etenergies[], etoscs[], etsyms[], etsecs[]") +# # Need to deal with lines like: +# # (restricted calc) +# # Excited State 1: Singlet-BU 5.3351 eV 232.39 nm f=0.1695 +# # (unrestricted calc) (first excited state is 2!) +# # Excited State 2: ?Spin -A 0.1222 eV 10148.75 nm f=0.0000 +# parts = line[36:].split() +# self.etenergies.append(convertor(self.float(parts[0]),"eV","cm-1")) +# self.etoscs.append(self.float(parts[4].split("=")[1])) +# self.etsyms.append(line[21:36].split()) +# +# line = inputfile.next() +# +# p = re.compile("(\d+)") +# CIScontrib = [] +# while line.find(" ->")>=0: # This is a contribution to the transition +# parts = line.split("->") +# self.logger.debug(parts) +# # Has to deal with lines like: +# # 32 -> 38 0.04990 +# # 35A -> 45A 0.01921 +# frommoindex = 0 # For restricted or alpha unrestricted +# fromMO = parts[0].strip() +# if fromMO[-1]=="B": +# frommoindex = 1 # For beta unrestricted +# fromMO = int(p.match(fromMO).group()) # extract the number +# +# t = parts[1].split() +# tomoindex = 0 +# toMO = t[0] +# if toMO[-1]=="B": +# tomoindex = 1 +# toMO = int(p.match(toMO).group()) +# +# percent = self.float(t[1]) +# sqr = percent**2*2 # The fractional contribution of this CI +# if percent<0: +# sqr = -sqr +# CIScontrib.append([(fromMO,frommoindex),(toMO,tomoindex),sqr]) +# line = inputfile.next() +# self.etsecs.append(CIScontrib) +# self.etenergies = Numeric.array(self.etenergies,"f") +# self.etoscs = Numeric.array(self.etoscs,"f") +# +# if line[1:52]=="<0|r|b> * <b|rxdel|0> (Au), Rotatory Strengths (R)": +# # Extract circular dichroism data +# self.etrotats = [] +# self.logger.info("Creating attribute etrotats[]") +# inputfile.next() +# inputfile.next() +# line = inputfile.next() +# parts = line.strip().split() +# while len(parts)==5: +# try: +# R = self.float(parts[-1]) +# except ValueError: +# # nan or -nan if there is no first excited state +# # (for unrestricted calculations) +# pass +# else: +# self.etrotats.append(R) +# line = inputfile.next() +# temp = line.strip().split() +# parts = line.strip().split() +# self.etrotats = Numeric.array(self.etrotats,"f") +# +# if line[1:7]=="NBasis" or line[4:10]=="NBasis": +# # Extract the number of basis sets +# nbasis = int(line.split('=')[1].split()[0]) +# # Has to deal with lines like: +# # NBasis = 434 NAE= 97 NBE= 97 NFC= 34 NFV= 0 +# # NBasis = 148 MinDer = 0 MaxDer = 0 +# # Although the former is in every file, it doesn't occur before +# # the overlap matrix is printed +# if hasattr(self,"nbasis"): +# assert nbasis==self.nbasis +# else: +# self.nbasis= nbasis +# self.logger.info("Creating attribute nbasis: %d" % self.nbasis) +# +# if line[1:7]=="NBsUse": +# # Extract the number of linearly-independent basis sets +# nindep = int(line.split('=')[1].split()[0]) +# if hasattr(self,"nindep"): +# assert nindep==self.nindep +# else: +# self.nindep = nindep +# self.logger.info("Creating attribute nindep: %d" % self.nindep) +# +# if line[7:22]=="basis functions,": +# # For AM1 calculations, set nbasis by a second method +# # (nindep may not always be explicitly stated) +# nbasis = int(line.split()[0]) +# if hasattr(self,"nbasis"): +# assert nbasis==self.nbasis +# else: +# self.nbasis = nbasis +# self.logger.info("Creating attribute nbasis: %d" % self.nbasis) +# +# if line[1:4]=="***" and (line[5:12]=="Overlap" +# or line[8:15]=="Overlap"): +# # Extract the molecular orbital overlap matrix +# # Has to deal with lines such as: +# # *** Overlap *** +# # ****** Overlap ****** +# self.logger.info("Creating attribute aooverlaps[x,y]") +# self.aooverlaps = Numeric.zeros( (self.nbasis,self.nbasis), "float") +# # Overlap integrals for basis fn#1 are in aooverlaps[0] +# base = 0 +# colmNames = inputfile.next() +# while base<self.nbasis: +# +# if self.progress and random.random()<fupdate: +# step=inputfile.tell() +# if step!=oldstep: +# self.progress.update(step,"Overlap") +# oldstep=step +# +# for i in range(self.nbasis-base): # Fewer lines this time +# line = inputfile.next() +# parts = line.split() +# for j in range(len(parts)-1): # Some lines are longer than others +# k = float(parts[j].replace("D","E")) +# self.aooverlaps[base+j,i+base] = k +# self.aooverlaps[i+base,base+j] = k +# base += 5 +# colmNames = inputfile.next() +# self.aooverlaps = Numeric.array(self.aooverlaps,"f") +# +# +# if line[5:35]=="Molecular Orbital Coefficients" or line[5:41]=="Alpha Molecular Orbital Coefficients" or line[5:40]=="Beta Molecular Orbital Coefficients": +# if line[5:40]=="Beta Molecular Orbital Coefficients": +# beta = True +# # Need to add an extra dimension to self.mocoeffs +# self.mocoeffs = Numeric.resize(self.mocoeffs,(2,nindep,nbasis)) +# else: +# beta = False +# self.logger.info("Creating attributes aonames[], mocoeffs[][]") +# self.aonames = [] +# self.mocoeffs = Numeric.zeros((1,nindep,nbasis),"float") +# +# base = 0 +# for base in range(0,nindep,5): +# +# if self.progress: +# step=inputfile.tell() +# if step!=oldstep and random.random() < fupdate: +# self.progress.update(step,"Coefficients") +# oldstep=step +# +# colmNames = inputfile.next() +# symmetries = inputfile.next() +# eigenvalues = inputfile.next() +# for i in range(nbasis): +# line = inputfile.next() +# if base==0 and not beta: # Just do this the first time 'round +# # Changed below from :12 to :11 to deal with Elmar Neumann's example +# parts = line[:11].split() +# if len(parts)>1: # New atom +# atomname = "%s%s" % (parts[2],parts[1]) +# orbital = line[11:20].strip() +# self.aonames.append("%s_%s" % (atomname,orbital)) +# +# part = line[21:].replace("D","E").rstrip() +# temp = [] +# for j in range(0,len(part),10): +# temp.append(float(part[j:j+10])) +# if beta: +# self.mocoeffs[1,base:base+len(part)/10,i] = temp +# else: +# self.mocoeffs[0,base:base+len(part)/10,i] = temp + + inputfile.close() + + if self.progress: + self.progress.update(nstep,"Done") + + if hasattr(self,"geovalues"): self.geovalues = Numeric.array(self.geovalues,"f") + if hasattr(self,"scfenergies"): self.scfenergies = Numeric.array(self.scfenergies,"f") + if hasattr(self,"scfvalues"): self.scfvalues = Numeric.array(self.scftargets,"f") + + + +# Note to self: Needs to be added to the main parser + def extractTrajectory(self): + """Extract trajectory information from a Gaussian logfile.""" + inputfile = open(self.filename,"r") + self.traj = [] + self.trajSummary = [] + for line in inputfile: + if line.find(" Cartesian coordinates:")==0: + coords = [] + for i in range(self.natom): + line = inputfile.next() + parts = line.strip().split() + # Conversion from a.u. to Angstrom + coords.append([ self.float(x)*0.5292 for x in [parts[3],parts[5],parts[7]] ]) + self.traj.append(coords) + if line==" Trajectory summary\n": + # self.trajSummaryHeader = inputfile.next().strip().split() + header = inputfile.next() + line = inputfile.next() + while line.find("Max Error")==-1: + parts = line.strip().split(" ") + self.trajSummary.append(parts) + line = inputfile.next() + inputfile.close() + assert len(self.traj)==len(self.trajSummary) + +if __name__=="__main__": + import doctest,parser + doctest.testmod(parser,verbose=False) Property changes on: trunk/src/cclib/parser/adfparser.py ___________________________________________________________________ Name: svn:executable + * Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-03-22 01:42:16 UTC (rev 39) +++ trunk/src/cclib/parser/logfileparser.py 2006-03-22 22:57:48 UTC (rev 40) @@ -94,6 +94,7 @@ self.progress = progress self.loglevel = loglevel self.logname = logname + self.table = PeriodicTable() # Set up the logger self.logger = logging.getLogger('%s %s' % (self.logname,self.filename)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-04-02 21:33:50
|
Revision: 46 Author: baoilleach Date: 2006-04-02 14:33:41 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=46&view=rev Log Message: ----------- Corrected doctest references so that they now work if you run the parsers as scripts Modified Paths: -------------- trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/gamessparser.py Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-04-02 21:31:57 UTC (rev 45) +++ trunk/src/cclib/parser/g03parser.py 2006-04-02 21:33:41 UTC (rev 46) @@ -544,5 +544,5 @@ assert len(self.traj)==len(self.trajSummary) if __name__=="__main__": - import doctest,parser - doctest.testmod(parser,verbose=False) + import doctest,g03parser + doctest.testmod(g03parser,verbose=False) Modified: trunk/src/cclib/parser/gamessparser.py =================================================================== --- trunk/src/cclib/parser/gamessparser.py 2006-04-02 21:31:57 UTC (rev 45) +++ trunk/src/cclib/parser/gamessparser.py 2006-04-02 21:33:41 UTC (rev 46) @@ -334,5 +334,5 @@ if __name__=="__main__": - import doctest,parser - doctest.testmod(parser,verbose=False) + import doctest,gamessparser + doctest.testmod(gamessparser,verbose=False) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ate...@us...> - 2006-04-26 01:43:42
|
Revision: 95 Author: atenderholt Date: 2006-04-25 18:43:39 -0700 (Tue, 25 Apr 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=95&view=rev Log Message: ----------- Added some elements to logfileparser and some progress code to adfparser Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/logfileparser.py Modified: trunk/src/cclib/parser/adfparser.py =================================================================== --- trunk/src/cclib/parser/adfparser.py 2006-04-26 01:20:18 UTC (rev 94) +++ trunk/src/cclib/parser/adfparser.py 2006-04-26 01:43:39 UTC (rev 95) @@ -83,7 +83,6 @@ for line in inputfile: if self.progress and random.random()<cupdate: - step = inputfile.tell() if step!=oldstep: self.progress.update(step,"Unsupported Information") @@ -92,16 +91,17 @@ if line.find("INPUT FILE")>=0: #check to make sure we aren't parsing Create jobs while line: + + if self.progress and random.random()<fupdate: + step = inputfile.tell() + #if step!=oldstep: + self.progress.update(step,"Unsupported Information") + oldstep = step + if line.find("INPUT FILE")>=0: line2=inputfile.next() if line2.find("Create")<0: break - - if self.progress and random.random()<cupdate: - step=inputfile.tell() - if step!=oldstep: - self.progress.update(step,"Unsupported Information") - oldstep=step line=inputfile.next() @@ -377,6 +377,7 @@ nosymreps=[] while len(self.fonames)<self.nbasis: + sym=inputfile.next() line=inputfile.next() num=int(line.split(':')[1].split()[0]) @@ -458,14 +459,15 @@ # if line[1:32]=="S F O P O P U L A T I O N S ,": - +#Extract overlap matrix + self.logger.info("Creating attribute fooverlaps[x,y]") self.fooverlaps = Numeric.zeros((self.nbasis,self.nbasis),"float") symoffset=0 for nosymrep in nosymreps: - + line=inputfile.next() while line.find('===')<10: #look for the symmetry labels line=inputfile.next() @@ -475,10 +477,15 @@ base=0 while base<nosymrep: #have we read all the columns? - + for i in range(nosymrep-base): - #while symoffset+base+i<self.nbasis: #have we read all the rows? - #while True: + + if self.progress: + step=inputfile.tell() + if step!=oldstep and random.random() < fupdate: + self.progress.update(step,"Overlap") + oldstep=step + line=inputfile.next() parts=line.split()[1:] @@ -533,7 +540,7 @@ line=inputfile.next() while symoffset+base<self.nbasis: - + line=inputfile.next() if len(line)<3: symoffset+=base @@ -549,6 +556,13 @@ row=0 line=inputfile.next() while len(line)>2: + + if self.progress: + step=inputfile.tell() + if step!=oldstep and random.random() < fupdate: + self.progress.update(step,"Coefficients") + oldstep=step + cols=line.split() for i in range(len(cols[1:])): self.mocoeffs[spin,row+symoffset,i+symoffset+base]=float(cols[i+1]) Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-04-26 01:20:18 UTC (rev 94) +++ trunk/src/cclib/parser/logfileparser.py 2006-04-26 01:43:39 UTC (rev 95) @@ -43,7 +43,8 @@ 6 """ def __init__(self): - self.element = [None,"H","He","Li","Be","B","C","N","O","F","Ne"] + self.element = [None,"H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca","Sc","Ti","V","Cr","Mn","Fe" + "Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo"] self.number = {} for i in range(1,len(self.element)): self.number[self.element[i]] = i This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ate...@us...> - 2006-05-10 22:56:00
|
Revision: 109 Author: atenderholt Date: 2006-05-10 15:55:56 -0700 (Wed, 10 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=109&view=rev Log Message: ----------- Density checks to see if the logfile has been parsed (ie. parser.parsed == True). If not, it parses it. Modified Paths: -------------- trunk/src/cclib/method/density.py trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/g03parser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py Modified: trunk/src/cclib/method/density.py =================================================================== --- trunk/src/cclib/method/density.py 2006-05-10 22:20:20 UTC (rev 108) +++ trunk/src/cclib/method/density.py 2006-05-10 22:55:56 UTC (rev 109) @@ -40,8 +40,8 @@ def calculate(self,fupdate=0.05,cupdate=0.002): """Calculate the density matrix given the results of a parser""" - #if not self.parser.parsed: - # self.parser.parse() + if not self.parser.parsed: + self.parser.parse() #do we have the needed info in the parser? if not hasattr(self.parser,"mocoeffs") \ Modified: trunk/src/cclib/parser/adfparser.py =================================================================== --- trunk/src/cclib/parser/adfparser.py 2006-05-10 22:20:20 UTC (rev 108) +++ trunk/src/cclib/parser/adfparser.py 2006-05-10 22:55:56 UTC (rev 109) @@ -660,6 +660,7 @@ if hasattr(self,"geovalues"): self.geovalues = Numeric.array(self.geovalues,"f") if hasattr(self,"scfenergies"): self.scfenergies = Numeric.array(self.scfenergies,"f") if hasattr(self,"scfvalues"): self.scfvalues = [Numeric.array(x,"f") for x in self.scfvalues] + self.parsed = True Modified: trunk/src/cclib/parser/g03parser.py =================================================================== --- trunk/src/cclib/parser/g03parser.py 2006-05-10 22:20:20 UTC (rev 108) +++ trunk/src/cclib/parser/g03parser.py 2006-05-10 22:55:56 UTC (rev 109) @@ -534,6 +534,7 @@ if hasattr(self,"geovalues"): self.geovalues = Numeric.array(self.geovalues,"f") if hasattr(self,"scfenergies"): self.scfenergies = Numeric.array(self.scfenergies,"f") if hasattr(self,"scfvalues"): self.scfvalues = [Numeric.array(x,"f") for x in self.scfvalues] + self.parsed = True Modified: trunk/src/cclib/parser/gamessparser.py =================================================================== --- trunk/src/cclib/parser/gamessparser.py 2006-05-10 22:20:20 UTC (rev 108) +++ trunk/src/cclib/parser/gamessparser.py 2006-05-10 22:55:56 UTC (rev 109) @@ -355,7 +355,9 @@ self.logger.info("Creating attribute nindep with default value") self.nindep = self.nbasis + self.parsed = True + if __name__=="__main__": import doctest,gamessparser Modified: trunk/src/cclib/parser/jaguarparser.py =================================================================== --- trunk/src/cclib/parser/jaguarparser.py 2006-05-10 22:20:20 UTC (rev 108) +++ trunk/src/cclib/parser/jaguarparser.py 2006-05-10 22:55:56 UTC (rev 109) @@ -166,6 +166,7 @@ ## self.scfvalues = Numeric.array(self.scfvalues,"f") if hasattr(self,"scfenergies"): self.scfenergies = Numeric.array(self.scfenergies,"f") + self.parsed = True if __name__=="__main__": import doctest,g03parser Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-05-10 22:20:20 UTC (rev 108) +++ trunk/src/cclib/parser/logfileparser.py 2006-05-10 22:55:56 UTC (rev 109) @@ -93,6 +93,7 @@ """ self.filename = filename self.progress = progress + self.parsed = False self.loglevel = loglevel self.logname = logname self.table = PeriodicTable() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ate...@us...> - 2006-05-10 23:28:52
|
Revision: 111 Author: atenderholt Date: 2006-05-10 16:28:49 -0700 (Wed, 10 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=111&view=rev Log Message: ----------- Progress info in density method, and some fix to adfparser Modified Paths: -------------- trunk/src/cclib/method/density.py trunk/src/cclib/parser/adfparser.py Modified: trunk/src/cclib/method/density.py =================================================================== --- trunk/src/cclib/method/density.py 2006-05-10 23:02:55 UTC (rev 110) +++ trunk/src/cclib/method/density.py 2006-05-10 23:28:49 UTC (rev 111) @@ -37,7 +37,7 @@ """Return a representation of the object.""" return 'Density matrix("%s")' % (self.parser) - def calculate(self,fupdate=0.05,cupdate=0.002): + def calculate(self,fupdate=0.05): """Calculate the density matrix given the results of a parser""" if not self.parser.parsed: @@ -45,33 +45,49 @@ #do we have the needed info in the parser? if not hasattr(self.parser,"mocoeffs") \ - and not hasattr(self.parser,"aooverlaps") \ and not hasattr(self.parser,"nbasis") \ and not hasattr(self.parser,"homos"): - self.logger.error("Missing mocoeffs or aooverlaps") + self.logger.error("Missing mocoeffs, nbasis, or homos") return False #let the caller of function know we didn't finish self.logger.info("Creating attribute density: array[3]") size=self.parser.nbasis unrestricted=(len(self.parser.mocoeffs)==2) + #determine number of steps, and whether process involves beta orbitals + nstep=self.parser.homos[0]+1 if unrestricted: self.density=Numeric.zeros([2,size,size],"f") + nstep+=self.parser.homos[1]+1 else: self.density=Numeric.zeros([1,size,size],"f") + #intialize progress if available + if self.progress: + self.progress.initialize(nstep) + + step=0 for spin in range(len(self.parser.mocoeffs)): for i in range(self.parser.homos[spin]+1): + + if self.progress and random.random()<fupdate: + self.progress.update(step,"Density Matrix") + col=Numeric.reshape(self.parser.mocoeffs[spin][i],(size,1)) colt=Numeric.reshape(col,(1,size)) tempdensity=Numeric.matrixmultiply(col,colt) self.density[spin]=Numeric.add(self.density[spin],tempdensity) + step+=1 + if not unrestricted: #multiply by two to account for second electron self.density[0]=Numeric.add(self.density[0],self.density[0]) + if self.progress: + self.progress.update(nstep,"Done") + if __name__=="__main__": import doctest,g03parser doctest.testmod(g03parser,verbose=False) Modified: trunk/src/cclib/parser/adfparser.py =================================================================== --- trunk/src/cclib/parser/adfparser.py 2006-05-10 23:02:55 UTC (rev 110) +++ trunk/src/cclib/parser/adfparser.py 2006-05-10 23:28:49 UTC (rev 111) @@ -295,6 +295,7 @@ temp=Numeric.array(self.moenergies,"f") self.moenergies=temp + self.homos=Numeric.array(self.homos) if line[1:24]=="List of All Frequencies": # Start of the IR/Raman frequency section This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-05-17 17:13:53
|
Revision: 123 Author: baoilleach Date: 2006-05-17 09:56:45 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=123&view=rev Log Message: ----------- Completed parsing of atomcoords...still passes tests, although I haven't checked the output to see if it makes sense. Modified Paths: -------------- trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/logfileparser.py Modified: trunk/src/cclib/parser/gamessparser.py =================================================================== --- trunk/src/cclib/parser/gamessparser.py 2006-05-17 16:27:40 UTC (rev 122) +++ trunk/src/cclib/parser/gamessparser.py 2006-05-17 16:56:45 UTC (rev 123) @@ -73,7 +73,7 @@ oldstep=0 - endofopt = False + firststdorient = True # Used to decide whether to wipe the atomcoords clean for line in inputfile: @@ -136,7 +136,7 @@ line = inputfile.next() while line.strip(): temp = line.strip().split() - atomcoords.append(map(float,temp[2:4])) + atomcoords.append([convertor(float(x),"au","Ang") for x in temp[2:4]]) atomnos.append(self.pt.number[temp[0]]) # Use the element name line = inputfile.next() self.atomnos = Numeric.array(atomnos,"i") @@ -145,7 +145,22 @@ if line[1:37]=="COORDINATES OF ALL ATOMS ARE": # This is the standard orientation, which is the only coordinate # information available for all geometry optimisation cycles. - pass + # The input orientation will be overwritten if this is a geometry optimisation + # We assume that a previous Input Orientation has been found and + # used to extract the atomnos + if firststdorient: + firststdorient = False + # Wipes out the single input coordinate at the start of the file + self.atomcoords = [] + + line = inputfile.next() + hyphens = inputfile.next() + atomcoords = [] + while line.strip(): + temp = line.strip().split() + atomcoords.append(map(float,temp[2:4])) + line = inputfile.next() + self.atomcoords.append(atomcoords) if line.find("ITER EX DEM")==1: # This is the section with the SCF information Modified: trunk/src/cclib/parser/logfileparser.py =================================================================== --- trunk/src/cclib/parser/logfileparser.py 2006-05-17 16:27:40 UTC (rev 122) +++ trunk/src/cclib/parser/logfileparser.py 2006-05-17 16:56:45 UTC (rev 123) @@ -29,7 +29,8 @@ _convertor = {"eV_to_cm-1": lambda x: x*8065.6, "hartree_to_eV": lambda x: x*27.2114, "nm_to_cm-1": lambda x: 1e7/x, - "cm-1_to_nm": lambda x: 1e7/x} + "cm-1_to_nm": lambda x: 1e7/x, + "au_to_Ang": lambda x: x*0.529177} return _convertor["%s_to_%s" % (fromunits,tounits)] (value) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-06-18 14:55:18
|
Revision: 218 Author: baoilleach Date: 2006-06-18 07:55:07 -0700 (Sun, 18 Jun 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=218&view=rev Log Message: ----------- Setting the svn:keywords property of all of these Python files to 'Rev' Property Changed: ---------------- trunk/src/cclib/parser/__init__.py trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-06-19 13:23:17
|
Revision: 222 Author: baoilleach Date: 2006-06-19 06:22:59 -0700 (Mon, 19 Jun 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=222&view=rev Log Message: ----------- Ran reindent.py (part of the standard Python distribution) to remove tabs and standardise indentation to 4 spaces. This should improve the pylint score too. Modified Paths: -------------- trunk/src/cclib/bridge/cclib2biopython.py trunk/src/cclib/bridge/cclib2openbabel.py trunk/src/cclib/bridge/cclib2pyquante.py trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/progress/qtprogress.py trunk/src/cclib/progress/textprogress.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-07-20 16:04:57
|
Revision: 247 Author: baoilleach Date: 2006-07-20 09:04:50 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=247&view=rev Log Message: ----------- Renaming gamessuk.py to gamessukparser.py in keeping with the other file names. Added Paths: ----------- trunk/src/cclib/parser/gamessukparser.py Removed Paths: ------------- trunk/src/cclib/parser/gamessuk.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-07-20 16:09:10
|
Revision: 248 Author: baoilleach Date: 2006-07-20 09:08:50 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=248&view=rev Log Message: ----------- Tidying up things to start work on the GAMESS UK parser. Modified Paths: -------------- trunk/src/cclib/parser/__init__.py trunk/src/cclib/parser/gamessukparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-01-25 16:19:27
|
Revision: 474 http://svn.sourceforge.net/cclib/?rev=474&view=rev Author: langner Date: 2007-01-25 08:19:25 -0800 (Thu, 25 Jan 2007) Log Message: ----------- Reversed shape of mpenergies in GAMESS and Gaussian parsers. Modified Paths: -------------- trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gaussianparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-01-30 23:39:04
|
Revision: 481 http://svn.sourceforge.net/cclib/?rev=481&view=rev Author: langner Date: 2007-01-30 15:39:01 -0800 (Tue, 30 Jan 2007) Log Message: ----------- Introducing LogFile.parse(), and parse() of child classes renamed to extract(). Addition of fupdate and cupdate to GAMESS.extract(). Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gamessukparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-01-31 14:42:48
|
Revision: 482 http://svn.sourceforge.net/cclib/?rev=482&view=rev Author: langner Date: 2007-01-31 06:31:59 -0800 (Wed, 31 Jan 2007) Log Message: ----------- Moved generic conversion of attributes to arrays from .extract() to .parse() - conversion takes place only if attribute is not already an array. Also: fixed dimensions of geovalues in Jaguar parser so that it can be converted to an array (there is no first energy change, so it is set to zero); moenergies is not converted to an array, kept as a list of rank-1 arrays, as per wiki. No changes when running tests. Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gamessukparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-02-01 10:34:14
|
Revision: 483 http://svn.sourceforge.net/cclib/?rev=483&view=rev Author: langner Date: 2007-02-01 02:34:03 -0800 (Thu, 01 Feb 2007) Log Message: ----------- Moved conversion of moenergies and scfvalues to lists of arrays to LogFile.parse() from specific parsers. No changes in tests. Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gamessukparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-02-01 14:08:56
|
Revision: 487 http://svn.sourceforge.net/cclib/?rev=487&view=rev Author: langner Date: 2007-02-01 06:08:36 -0800 (Thu, 01 Feb 2007) Log Message: ----------- Moved to LogFile.parse(): creation of default coreelectrons; setting default value of nmo to nbasis; setting self.parsed to True after parsing. Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gamessukparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-02-02 16:11:28
|
Revision: 489 http://svn.sourceforge.net/cclib/?rev=489&view=rev Author: langner Date: 2007-02-02 08:11:25 -0800 (Fri, 02 Feb 2007) Log Message: ----------- Move to LogFile.parse from extract method of specific parsers: opening/closing file object, initializing and final update of self.progress. Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gamessukparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-02-02 17:23:50
|
Revision: 491 http://svn.sourceforge.net/cclib/?rev=491&view=rev Author: langner Date: 2007-02-02 09:23:33 -0800 (Fri, 02 Feb 2007) Log Message: ----------- Created LogFile.updateprogress() for updating LogFile.progress; replaced code with a call to the method in all parsers. Modified Paths: -------------- trunk/src/cclib/parser/adfparser.py trunk/src/cclib/parser/gamessparser.py trunk/src/cclib/parser/gamessukparser.py trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/jaguarparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <la...@us...> - 2007-02-03 10:57:35
|
Revision: 493 http://svn.sourceforge.net/cclib/?rev=493&view=rev Author: langner Date: 2007-02-03 02:57:17 -0800 (Sat, 03 Feb 2007) Log Message: ----------- Modifying LogFile.__setattr__ to update LogFile.logger for elements of LogFile.attrlist. Modified Paths: -------------- trunk/src/cclib/parser/gaussianparser.py trunk/src/cclib/parser/logfileparser.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |