The gamessus
module contains the GamessUS
convenience class, which is python wrapper for running the Gamess(US) program with methods for writing input files, running the calculations and parsing the output files.
[1]:
from chemtools.calculators.gamessus import GamessUS, GamessLogParser
Now we instantiate the object by calling Gamess
with arguments corresponding to the local installation of GAMESS(US)
[5]:
gamess = GamessUS(exevar="GAMESS_EXE",
version="00",
runopts=["1"],
scratch="/home/lmentel/scratch")
[6]:
gamess.rungms
[6]:
'/home/lmentel/Programs/gamess-us-aug2016/rungms'
[7]:
inpstr = """ $CONTRL scftyp=rhf runtyp=energy maxit=30 mult=1 ispher=1
itol=30 icut=30 units=bohr cityp=guga qmttol=1.0e-8 $END
$SYSTEM timlim=525600 mwords=100 $END
$SCF dirscf=.false. $END
$CIDRT iexcit=2 nfzc=0 ndoc=1 nval=27 group=d2h stsym=ag
mxnint=14307305 $END
$GUGDIA prttol=1.0e-6 cvgtol=1.0e-10 $END
$DATA
H2 cc-pVTZ
dnh 2
H 1.00 0.000000 0.000000 0.700000
S 3
1 33.8700000 0.0060680
2 5.0950000 0.0453080
3 1.1590000 0.2028220
S 1
1 0.3258000 1.0000000
S 1
1 0.1027000 1.0000000
P 1
1 1.4070000 1.0000000
P 1
1 0.3880000 1.0000000
D 1
1 1.0570000 1.0000000
$END
"""
Write the input file
[8]:
inpfile = "h2_eq_pvtz_fci.inp"
with open(inpfile, 'w') as inp:
inp.write(inpstr)
Run the calculation
[12]:
logfile = gamess.run(inpfile)
[13]:
logfile
[13]:
'h2_eq_pvtz_fci.log'
GamessUS
has only rudimentary parsing methods implemented for the purpouses of being compliant with basis set optimizer API, however there is a dedicated parser class implemented in chemtools
called GamessLogParser
. There is also a separate class wrapper to parsing and writing Gamess(US) input files, and another one for reading binary files produced during the calculation such as integral files and the dictionary file.
[15]:
gamess.accomplished(logfile)
[15]:
True
[14]:
gamess.parse(logfile, 'hf total energy')
[14]:
-1.1329605255
[16]:
gamess.parse(logfile, "cisd total energy")
[16]:
-1.1723345936
[18]:
gamess.parse(logfile, "correlation energy")
[18]:
-0.039374068100000104
[17]:
gamess.parse(logfile, 'regexp', r'NUMBER OF CONFIGURATIONS\s*=\s*(\d+)')
[17]:
82.0
[19]:
%version_information chemtools
[19]:
Software | Version |
---|---|
Python | 3.6.3 64bit [GCC 7.2.0] |
IPython | 6.2.1 |
OS | Linux 4.9.0 4 amd64 x86_64 with debian 9.1 |
chemtools | 0.8.4 |
Mon Nov 27 19:27:43 2017 CET |