Gamess(US) tutorial

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.

In [1]:
from chemtools.calculators.gamessus import GamessUS, GamessLogParser

GamessUS wrapper

Now we instantiate the object by calling Gamess with arguments corresponding to the local installation of GAMESS(US)

In [5]:
gamess = GamessUS(exevar="GAMESS_EXE",
                version="00",
                runopts=["1"],
                scratch="/home/lmentel/scratch")
In [6]:
gamess.rungms
Out[6]:
'/home/lmentel/Programs/gamess-us-aug2016/rungms'
In [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

In [8]:
inpfile = "h2_eq_pvtz_fci.inp"
with open(inpfile, 'w') as inp:
    inp.write(inpstr)

Run the calculation

In [12]:
logfile = gamess.run(inpfile)
In [13]:
logfile
Out[13]:
'h2_eq_pvtz_fci.log'

Parsing the results

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.

In [15]:
gamess.accomplished(logfile)
Out[15]:
True
In [14]:
gamess.parse(logfile, 'hf total energy')
Out[14]:
-1.1329605255
In [16]:
gamess.parse(logfile, "cisd total energy")
Out[16]:
-1.1723345936
In [18]:
gamess.parse(logfile, "correlation energy")
Out[18]:
-0.039374068100000104
In [17]:
gamess.parse(logfile, 'regexp', r'NUMBER OF CONFIGURATIONS\s*=\s*(\d+)')
Out[17]:
82.0
In [19]:
%version_information chemtools
Out[19]:
SoftwareVersion
Python3.6.3 64bit [GCC 7.2.0]
IPython6.2.1
OSLinux 4.9.0 4 amd64 x86_64 with debian 9.1
chemtools0.8.4
Mon Nov 27 19:27:43 2017 CET