From: <bao...@us...> - 2006-05-22 08:54:50
|
Revision: 140 Author: baoilleach Date: 2006-05-22 01:54:39 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=140&view=rev Log Message: ----------- Removed references to Jaguar Modified Paths: -------------- branches/cclib-0.5-prerelease/src/cclib/parser/__init__.py branches/cclib-0.5-prerelease/src/cclib/parser/logfileparser.py branches/cclib-0.5-prerelease/src/cclib/parser/utils.py branches/cclib-0.5-prerelease/test/testGeoOpt.py branches/cclib-0.5-prerelease/test/testSP.py branches/cclib-0.5-prerelease/test/testSPun.py branches/cclib-0.5-prerelease/test/testall.py Removed Paths: ------------- branches/cclib-0.5-prerelease/src/cclib/parser/jaguarparser.py branches/cclib-0.5-prerelease/test/parseJaguar.py Modified: branches/cclib-0.5-prerelease/src/cclib/parser/__init__.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/__init__.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/src/cclib/parser/__init__.py 2006-05-22 08:54:39 UTC (rev 140) @@ -8,7 +8,6 @@ from gaussianparser import Gaussian from gamessparser import GAMESS from adfparser import ADF -from jaguarparser import Jaguar # This allow users to type: # from cclib.parser import guesstype Deleted: branches/cclib-0.5-prerelease/src/cclib/parser/jaguarparser.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/jaguarparser.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/src/cclib/parser/jaguarparser.py 2006-05-22 08:54:39 UTC (rev 140) @@ -1,174 +0,0 @@ -""" -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 -import utils -import logfileparser - -class Jaguar(logfileparser.Logfile): - """A Jaguar output file""" - - def __init__(self,*args): - - # Call the __init__ method of the superclass - super(Jaguar, self).__init__(logname="Jaguar",*args) - - def __str__(self): - """Return a string representation of the object.""" - return "Jaguar output file %s" % (self.filename) - - def __repr__(self): - """Return a representation of the object.""" - return 'Jaguar("%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[0:4]=="etot": -# Get SCF convergence information - if not hasattr(self,"scfvalues"): - self.scfvalues = [] - self.logger.info("Creating attribute: scfvalues") - values = [] - while line[0:4]=="etot": - if line[39:47].strip(): - denergy = float(line[39:47]) - else: - denergy = 0 # Should really be greater than target value - # or should we just ignore the values in this line - ddensity = float(line[48:56]) - maxdiiserr = float(line[57:65]) - values.append([denergy,ddensity,maxdiiserr]) - line = inputfile.next() - self.scfvalues.append(values) - - if line[1:5]=="SCFE": -# Get the energy of the molecule - if not hasattr(self,"scfenergies"): - self.logger.info("Creating attribute scfenergies") - self.scfenergies = [] - temp = line.strip().split() - self.scfenergies.append(float(temp[temp.index("hartrees")-1])) - - if line[2:28]=="geometry optimization step": -# Get Geometry Opt convergence information - if not hasattr(self,"geovalues"): - self.geovalues = [] - self.geotargets = Numeric.zeros(4,"float") - self.logger.info("Creating attributes: geovalues,geotargets") - blank = inputfile.next() - blank = inputfile.next() - line = inputfile.next() - i = 0 - values = [] - while line!=blank: - if line[41]=="(": - # A new geo convergence value - values.append(float(line[26:37])) - self.geotargets[i] = float(line[43:54]) - i+=1 - line = inputfile.next() - self.geovalues.append(values) - - if line[2:33]=="Orbital energies/symmetry label": -# Get MO Energies and symmetrys - if not hasattr(self,"moenergies"): - self.logger.info("Creating attributes: moenergies, mosyms") - self.mosyms = [[]] - self.moenergies = [[]] - line = inputfile.next() - while line.strip(): - temp = line.strip().split() - for i in range(0,len(temp),2): - self.moenergies[0].append(utils.convertor(float(temp[i]),"hartree","eV")) - self.mosyms[0].append(temp[i+1]) - line = inputfile.next() - self.moenergies = Numeric.array(self.moenergies,"f") - - if line[1:28]=="number of occupied orbitals": - if not hasattr(self,"homos"): - self.logger.info("Creating attribute: homos") - self.homos = Numeric.array([float(line.strip().split()[-1])-1],"i") - - if line[2:27]=="number of basis functions": - if not hasattr(self,"nbasis"): - self.logger.info("Creating attribute: nbasis") - self.nbasis = float(line.strip().split()[-1]) - - if line[2:23]=="start of program freq": -# IR stuff - self.logger.info("Creating attribute: vibfreqs") - self.vibfreqs = [] - blank = inputfile.next() - line = inputfile.next(); line = inputfile.next() - blank = inputfile.next() - - freqs = inputfile.next() - while freqs!=blank: - temp = freqs.strip().split() - self.vibfreqs.extend(map(float,temp[1:])) - temp = inputfile.next().strip().split() - if temp[0]=="symmetries": # May go straight from frequencies to reduced mass - if not hasattr(self,"vibsyms"): - self.logger.info("Creating attributes: vibsyms, vibirs") - self.vibsyms = [] - self.vibirs = [] - self.vibsyms.extend(map(self.normalisesym,temp[1:])) - temp = inputfile.next().strip().split() - self.vibirs.extend(map(float,temp[1:])) - reducedmass = inputfile.next() - line = inputfile.next() - while line!=blank: # Read the cartesian displacements - line = inputfile.next() - freqs = inputfile.next() - self.vibfreqs = Numeric.array(self.vibfreqs) - if hasattr(self,"vibirs"): - self.vibirs = Numeric.array(self.vibirs) - - inputfile.close() - -## if hasattr(self,"scfvalues"): -## 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,jaguarparser - doctest.testmod(jaguarparser,verbose=False) Modified: branches/cclib-0.5-prerelease/src/cclib/parser/logfileparser.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/logfileparser.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/src/cclib/parser/logfileparser.py 2006-05-22 08:54:39 UTC (rev 140) @@ -25,7 +25,7 @@ """Abstract class for logfile objects. Subclasses: - ADF, GAMESS, Gaussian, Jaguar + ADF, GAMESS, Gaussian Attributes: aonames -- "Ru_3p" (list) Modified: branches/cclib-0.5-prerelease/src/cclib/parser/utils.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/utils.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/src/cclib/parser/utils.py 2006-05-22 08:54:39 UTC (rev 140) @@ -20,14 +20,13 @@ import adfparser import gamessparser import gaussianparser -import jaguarparser def guesstype(filename): """Guess the identity of a particular log file and return an instance of that. Notes: uses the first 20 lines of a log file to guess its identity - Returns: one of ADF, GAMESS, Gaussian, Jaguar, or None (if it cannot figure it out). + Returns: one of ADF, GAMESS, Gaussian, or None (if it cannot figure it out). """ filetype = None inputfile = open(filename,"r") @@ -39,8 +38,6 @@ filetype = gamessparser.GAMESS elif line.find("Gaussian")>=0: filetype = gaussianparser.Gaussian - elif line.find("Jaguar")>=0: - filetype = jaguarparser.Jaguar inputfile.close() # Need to close before creating an instance if filetype: filetype = apply(filetype,[filename]) # Create an instance of the chosen class Deleted: branches/cclib-0.5-prerelease/test/parseJaguar.py =================================================================== --- branches/cclib-0.5-prerelease/test/parseJaguar.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/test/parseJaguar.py 2006-05-22 08:54:39 UTC (rev 140) @@ -1,15 +0,0 @@ -import os -from cclib.parser import Jaguar - -os.chdir(os.path.join("..","data","Jaguar","basicJaguar")) - -files = [ ["eg01","dvb_gopt.out"], - ["eg02","dvb_sp.out"], - ["eg03","dvb_ir.out"], - ["eg06","dvb_un_sp.out"] ] - -for f in files: - t = Jaguar(os.path.join(f[0],f[1])) - t.parse() - if f[0]!="eg03": - print t.scfvalues Modified: branches/cclib-0.5-prerelease/test/testGeoOpt.py =================================================================== --- branches/cclib-0.5-prerelease/test/testGeoOpt.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/test/testGeoOpt.py 2006-05-22 08:54:39 UTC (rev 140) @@ -4,7 +4,7 @@ from Numeric import array from testall import getfile -from cclib.parser import ADF, GAMESS, Gaussian, Jaguar +from cclib.parser import ADF, GAMESS, Gaussian class GenericGeoOptTest(unittest.TestCase): def testhomos(self): @@ -81,14 +81,9 @@ ADF calculations one more SCF cycle after the geometry is converged""" self.assert_(len(self.data.scfvalues)==len(self.data.geovalues)+1 and len(self.data.scfvalues[0])==len(self.data.scftargets)) -class JaguarGeoOptTest(GenericGeoOptTest): - def setUp(self): - self.data = getfile(Jaguar,"basicJaguar","eg01","dvb_gopt.out") - -names = [ "Gaussian", "PCGamess", "GAMESS", "ADF", "Jaguar" ] +names = [ "Gaussian", "PCGamess", "GAMESS", "ADF" ] tests = [ GaussianGeoOptTest, PCGamessGeoOptTest, - GamessUSGeoOptTest, ADFGeoOptTest, - JaguarGeoOptTest ] + GamessUSGeoOptTest, ADFGeoOptTest ] if __name__=="__main__": total = errors = failures = 0 Modified: branches/cclib-0.5-prerelease/test/testSP.py =================================================================== --- branches/cclib-0.5-prerelease/test/testSP.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/test/testSP.py 2006-05-22 08:54:39 UTC (rev 140) @@ -1,7 +1,7 @@ import os, unittest from Numeric import array from testall import getfile -from cclib.parser import ADF, GAMESS, Gaussian, Jaguar +from cclib.parser import ADF, GAMESS, Gaussian class GenericSPTest(unittest.TestCase): """Restricted single point calculations with MO coeffs and overlap info.""" @@ -34,7 +34,7 @@ #ADF uses fooverlaps self.assertEquals(self.data.fooverlaps.shape,(self.data.nbasis,self.data.nbasis)) -names = [ "Gaussian", "PCGamess", "GAMESS", "ADF", "Jaguar" ] +names = [ "Gaussian", "PCGamess", "GAMESS", "ADF" ] tests = [ GaussianSPTest, PCGamessSPTest, GamessUSSPTest, ADFSPTest ] Modified: branches/cclib-0.5-prerelease/test/testSPun.py =================================================================== --- branches/cclib-0.5-prerelease/test/testSPun.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/test/testSPun.py 2006-05-22 08:54:39 UTC (rev 140) @@ -1,7 +1,7 @@ import os, unittest from Numeric import array from testall import getfile -from cclib.parser import ADF, GAMESS, Gaussian, Jaguar +from cclib.parser import ADF, GAMESS, Gaussian class GenericSPunTest(unittest.TestCase): """Restricted single point calculations with MO coeffs and overlap info.""" Modified: branches/cclib-0.5-prerelease/test/testall.py =================================================================== --- branches/cclib-0.5-prerelease/test/testall.py 2006-05-22 08:48:08 UTC (rev 139) +++ branches/cclib-0.5-prerelease/test/testall.py 2006-05-22 08:54:39 UTC (rev 140) @@ -1,10 +1,10 @@ import unittest import os -from cclib.parser import ADF, GAMESS, Gaussian, Jaguar +from cclib.parser import ADF, GAMESS, Gaussian def getfile(parser,*location): """Returns a parsed logfile.""" - if parser.__name__ in ['GAMESS','ADF','Jaguar']: + if parser.__name__ in ['GAMESS','ADF']: fullpath = ("..","data",parser.__name__) + location elif parser.__name__=="Gaussian": fullpath = ("..","data","Gaussian") + location @@ -18,11 +18,10 @@ logfiles = [ getfile(Gaussian,"basicGaussian03","dvb_gopt.out"), getfile(GAMESS,"basicPCGAMESS","dvb_gopt_a.out"), getfile(GAMESS,"basicGAMESS-US","dvb_gopt_a.out"), - getfile(ADF,"basicADF2004.01","dvb_gopt.adfout"), - getfile(Jaguar,"basicJaguar","eg01","dvb_gopt.out")] + getfile(ADF,"basicADF2004.01","dvb_gopt.adfout")] print "\n\nMO energies of optimised dvb" - print " ","".join(["%8s" % x for x in ['Gaussian','PCGAMESS','GAMESS-US','ADF','Jaguar']]) + print " ","".join(["%8s" % x for x in ['Gaussian','PCGAMESS','GAMESS-US','ADF']]) print "HOMO", " ".join(["%+2.4f" % x.moenergies[0,x.homos[0]] for x in logfiles]) print "LUMO", " ".join(["%+2.4f" % x.moenergies[0,x.homos[0]+1] for x in logfiles]) print "H-L ", " ".join(["%2.4f" % (x.moenergies[0,x.homos[0]+1]-x.moenergies[0,x.homos[0]],) for x in logfiles]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-05-22 15:16:40
|
Revision: 146 Author: baoilleach Date: 2006-05-22 08:16:25 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=146&view=rev Log Message: ----------- Removed all mention of scftargets and scfvalues from ADF parser and the tests, as we haven't yet gotten an answer from ADF as to how this works. Modified Paths: -------------- branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py branches/cclib-0.5-prerelease/test/testGeoOpt.py Modified: branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py 2006-05-22 15:10:43 UTC (rev 145) +++ branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py 2006-05-22 15:16:25 UTC (rev 146) @@ -25,7 +25,6 @@ class ADF(logfileparser.Logfile): """An ADF log file""" - SCFCNV,SCFCNV2 = range(2) #used to index self.scftargets[] maxelem,norm = range(2) # used to index scf.values def __init__(self,*args): @@ -130,47 +129,6 @@ self.natom=len(self.atomnos) self.logger.info("Creating attribute natom: %d" % self.natom) - if line[1:22]=="S C F U P D A T E S": -# find 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],'f') - - #underline, blank, nr - for i in range(3): inputfile.next() - - line=inputfile.next() - self.scftargets[ADF.maxelem] = float(line.split()[2]) - self.scftargets[ADF.norm] = self.scftargets[ADF.maxelem]*10 - - if line[1:11]=="CYCLE 1": - - if self.progress and random.random() < fupdate: - step=inputfile.tell() - if step!=oldstep: - self.progress.update(step, "QM Convergence") - oldstep=step - - newlist = [] - line=inputfile.next() - - while line.find("SCF CONVERGED")==-1: - if line[4:12]=="SCF test": - if not hasattr(self,"scfvalues"): - self.logger.info("Creating attribute scfvalues") - self.scfvalues = [] - - info = line.split() - newlist.append([float(info[4]),abs(float(info[6]))]) - try: - line=inputfile.next() - except StopIteration: #EOF reached? - break - - if hasattr(self,"scfvalues"): - self.scfvalues.append(newlist) - # if line[1:10]=='Cycle 1': # # Extract SCF convergence information (QM calcs) # if self.progress and random.random()<fupdate: @@ -655,7 +613,6 @@ 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 if hasattr(self,"moenergies"): self.nmo = len(self.moenergies[0]) Modified: branches/cclib-0.5-prerelease/test/testGeoOpt.py =================================================================== --- branches/cclib-0.5-prerelease/test/testGeoOpt.py 2006-05-22 15:10:43 UTC (rev 145) +++ branches/cclib-0.5-prerelease/test/testGeoOpt.py 2006-05-22 15:16:25 UTC (rev 146) @@ -77,9 +77,11 @@ self.data = getfile(ADF,"basicADF2004.01","dvb_gopt_b.adfout") def testscfvaluedim(self): - """Do the scf values have the right dimensions? - ADF calculations one more SCF cycle after the geometry is converged""" - self.assert_(len(self.data.scfvalues)==len(self.data.geovalues)+1 and len(self.data.scfvalues[0])==len(self.data.scftargets)) + """ADF does not have scf values...OK?""" + self.assert_(True) + def testscfvaluetype(self): + """ADF does not have scf values...OK?""" + self.assert_(True) names = [ "Gaussian", "PCGamess", "GAMESS", "ADF" ] tests = [ GaussianGeoOptTest, PCGamessGeoOptTest, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bao...@us...> - 2006-05-22 15:33:21
|
Revision: 147 Author: baoilleach Date: 2006-05-22 08:32:53 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/cclib/?rev=147&view=rev Log Message: ----------- Merged changes from trunk revisions 139:146 Modified Paths: -------------- branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py branches/cclib-0.5-prerelease/src/cclib/parser/gamessparser.py branches/cclib-0.5-prerelease/test/parseADF.py branches/cclib-0.5-prerelease/test/testGeoOpt.py branches/cclib-0.5-prerelease/test/testSP.py Modified: branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py 2006-05-22 15:16:25 UTC (rev 146) +++ branches/cclib-0.5-prerelease/src/cclib/parser/adfparser.py 2006-05-22 15:32:53 UTC (rev 147) @@ -81,6 +81,10 @@ self.progress.initialize(nstep) oldstep=0 + # Used to avoid extracting the final geometry twice in a GeoOpt + NOTFOUND, GETLAST, NOMORE = range(3) + finalgeometry= NOTFOUND + for line in inputfile: if self.progress and random.random()<cupdate: @@ -108,64 +112,55 @@ if line[1:6]=="ATOMS": # Find the number of atoms and their atomic numbers +# Also extract the starting coordinates (for a GeoOpt anyway) 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.logger.info("Creating attribute atomnos[], atomcoords[]") self.atomnos=[] + self.atomcoords = [] underline=inputfile.next() #clear pointless lines label1=inputfile.next() # label2=inputfile.next() # line=inputfile.next() + atomcoords = [] while len(line)>1: #ensure that we are reading no blank lines info=line.split() self.atomnos.append(self.table.number[info[1]]) + atomcoords.append(map(float,info[2:5])) line=inputfile.next() + self.atomcoords.append(atomcoords) self.natom=len(self.atomnos) self.logger.info("Creating attribute natom: %d" % self.natom) -# 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[51:65]=="Final Geometry": + finalgeometry = GETLAST + + if line[1:24]=="Coordinates (Cartesian)" and finalgeometry in [NOTFOUND, GETLAST]: + # Get the coordinates from each step of the GeoOpt + if not hasattr(self,"atomcoords"): + self.logger.info("Creating attribute atomcoords") + self.atomcoords = [] + equals = inputfile.next() + blank = inputfile.next() + title = inputfile.next() + title = inputfile.next() + hyphens = inputfile.next() + atomcoords = [] + line = inputfile.next() + while line!=hyphens: + atomcoords.append(map(float,line.split()[5:])) + line = inputfile.next() + self.atomcoords.append(atomcoords) + if finalgeometry==GETLAST: # Don't get any more coordinates + finalgeometry = NOMORE + if line[1:27]=='Geometry Convergence Tests': # Extract Geometry convergence information if not hasattr(self,"geotargets"): @@ -610,12 +605,15 @@ 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") - self.parsed = True if hasattr(self,"moenergies"): self.nmo = len(self.moenergies[0]) + if hasattr(self,"atomcoords"): self.atomcoords = Numeric.array(self.atomcoords,"f") + self.parsed = True + + # Note to self: Needs to be added to the main parser Modified: branches/cclib-0.5-prerelease/src/cclib/parser/gamessparser.py =================================================================== --- branches/cclib-0.5-prerelease/src/cclib/parser/gamessparser.py 2006-05-22 15:16:25 UTC (rev 146) +++ branches/cclib-0.5-prerelease/src/cclib/parser/gamessparser.py 2006-05-22 15:32:53 UTC (rev 147) @@ -105,6 +105,7 @@ firststdorient = True # Used to decide whether to wipe the atomcoords clean + geooptfinished = False # Used to avoid extracting the final geometry twice for line in inputfile: @@ -167,13 +168,17 @@ line = inputfile.next() while line.strip(): temp = line.strip().split() - atomcoords.append([utils.convertor(float(x),"au","Ang") for x in temp[2:4]]) + atomcoords.append([utils.convertor(float(x),"au","Ang") for x in temp[2:5]]) atomnos.append(self.table.number[temp[0]]) # Use the element name line = inputfile.next() self.atomnos = Numeric.array(atomnos,"i") self.atomcoords.append(atomcoords) - if line[1:29]=="COORDINATES OF ALL ATOMS ARE": + if line[12:40]=="EQUILIBRIUM GEOMETRY LOCATED": + # Prevent extraction of the final geometry twice + geooptfinished = True + + if line[1:29]=="COORDINATES OF ALL ATOMS ARE" and not geooptfinished: # This is the standard orientation, which is the only coordinate # information available for all geometry optimisation cycles. # The input orientation will be overwritten if this is a geometry optimisation @@ -191,7 +196,7 @@ line = inputfile.next() while line.strip(): temp = line.strip().split() - atomcoords.append(map(float,temp[2:4])) + atomcoords.append(map(float,temp[2:5])) line = inputfile.next() self.atomcoords.append(atomcoords) @@ -438,6 +443,8 @@ if hasattr(self,"scfvalues"): self.scfvalues = [Numeric.array(x,"f") for x in self.scfvalues] if hasattr(self,"geovalues"): self.geovalues = Numeric.array(self.geovalues,"f") + if hasattr(self,"atomcoords"): + self.atomcoords = Numeric.array(self.atomcoords,"f") if not hasattr(self,"nmo"): self.logger.info("Creating attribute nmo with default value") self.nmo = self.nbasis Modified: branches/cclib-0.5-prerelease/test/parseADF.py =================================================================== --- branches/cclib-0.5-prerelease/test/parseADF.py 2006-05-22 15:16:25 UTC (rev 146) +++ branches/cclib-0.5-prerelease/test/parseADF.py 2006-05-22 15:32:53 UTC (rev 147) @@ -8,5 +8,4 @@ for file in ["dvb_gopt.adfout"]: t = ADF(file) t.parse() - - + print len(t.atomcoords) Modified: branches/cclib-0.5-prerelease/test/testGeoOpt.py =================================================================== --- branches/cclib-0.5-prerelease/test/testGeoOpt.py 2006-05-22 15:16:25 UTC (rev 146) +++ branches/cclib-0.5-prerelease/test/testGeoOpt.py 2006-05-22 15:32:53 UTC (rev 147) @@ -12,10 +12,10 @@ self.assertEquals(self.data.homos,array([34])) def testatomcoords(self): - """Are atomcoords consistent with natom, Angstroms and geovalues?""" + """Are atomcoords consistent with natom and Angstroms?""" coords = self.data.atomcoords self.assertEquals(self.data.natom,len(coords[0]),"len(atomcoords[0]) is %d but natom is %d" % (self.data.natom,len(coords[0]))) - self.assertEquals(len(self.data.geovalues),len(coords),"len(atomcoords) is %d but len(geovalues) is % d" % (len(coords),len(self.data.geovalues))) + # Find the minimum distance between two C atoms mindist = 999 for i in range(self.data.natom-1): @@ -25,7 +25,13 @@ # Find the distance in the final iteration dist = math.sqrt(sum((coords[-1][i]-coords[-1][j])**2)) mindist = min(mindist,dist) - self.assert_(abs(mindist-1.34)<0.02,"Mindist is %f (not 1.34)" % mindist) + self.assert_(abs(mindist-1.34)<0.03,"Mindist is %f (not 1.34)" % mindist) + + def testatomcoords_more(self): + """Are atomcoords consistent with geovalues?""" + coords = self.data.atomcoords + self.assertEquals(len(self.data.geovalues),len(coords),"len(atomcoords) is %d but len(geovalues) is %d" % (len(coords),len(self.data.geovalues))) + def testnatom(self): """Is the number of atoms equal to 20?""" @@ -83,7 +89,13 @@ """ADF does not have scf values...OK?""" self.assert_(True) + def testatomcoords_more(self): + """Are atomcoords consistent with geovalues?""" + coords = self.data.atomcoords + self.assertEquals(len(self.data.geovalues),len(coords)-1,"len(atomcoords)-1 is %d but len(geovalues) is %d" % (len(coords)-1,len(self.data.geovalues))) + names = [ "Gaussian", "PCGamess", "GAMESS", "ADF" ] + tests = [ GaussianGeoOptTest, PCGamessGeoOptTest, GamessUSGeoOptTest, ADFGeoOptTest ] Modified: branches/cclib-0.5-prerelease/test/testSP.py =================================================================== --- branches/cclib-0.5-prerelease/test/testSP.py 2006-05-22 15:16:25 UTC (rev 146) +++ branches/cclib-0.5-prerelease/test/testSP.py 2006-05-22 15:32:53 UTC (rev 147) @@ -9,6 +9,10 @@ """Are the dims of the overlap matrix consistent with nbasis?""" self.assertEquals(self.data.aooverlaps.shape,(self.data.nbasis,self.data.nbasis)) + def testatomcoords(self): + """Are the dimensions of atomcoords 1 x natom x 3?""" + self.assertEquals(self.data.atomcoords.shape,(1,self.data.natom,3)) + def testdimmocoeffs(self): """Are the dimensions of mocoeffs equal to 1 x nmo x nbasis?""" self.assertEquals(self.data.mocoeffs.shape,(1,self.data.nmo,self.data.nbasis)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |