{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Gamess(US) tutorial\n", "\n", "The `gamessus` module contains the `GamessUS` convenience class, which is python wrapper for running the [Gamess(US)](http://www.msg.ameslab.gov/GAMESS/) program with methods for writing input files, running the calculations and parsing the output files. \n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from chemtools.calculators.gamessus import GamessUS, GamessLogParser" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## GamessUS wrapper" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we instantiate the object by calling `Gamess` with arguments corresponding to the local installation of GAMESS(US)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "gamess = GamessUS(exevar=\"GAMESS_EXE\",\n", " version=\"00\",\n", " runopts=[\"1\"],\n", " scratch=\"/home/lmentel/scratch\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/home/lmentel/Programs/gamess-us-aug2016/rungms'" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gamess.rungms" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "inpstr = \"\"\" $CONTRL scftyp=rhf runtyp=energy maxit=30 mult=1 ispher=1\n", " itol=30 icut=30 units=bohr cityp=guga qmttol=1.0e-8 $END\n", " $SYSTEM timlim=525600 mwords=100 $END\n", " $SCF dirscf=.false. $END\n", " $CIDRT iexcit=2 nfzc=0 ndoc=1 nval=27 group=d2h stsym=ag\n", " mxnint=14307305 $END\n", " $GUGDIA prttol=1.0e-6 cvgtol=1.0e-10 $END\n", " $DATA\n", "H2 cc-pVTZ\n", "dnh 2\n", "\n", "H 1.00 0.000000 0.000000 0.700000\n", "S 3\n", " 1 33.8700000 0.0060680 \n", " 2 5.0950000 0.0453080 \n", " 3 1.1590000 0.2028220 \n", "S 1\n", " 1 0.3258000 1.0000000 \n", "S 1\n", " 1 0.1027000 1.0000000 \n", "P 1\n", " 1 1.4070000 1.0000000 \n", "P 1\n", " 1 0.3880000 1.0000000 \n", "D 1\n", " 1 1.0570000 1.0000000 \n", "\n", " $END\n", "\"\"\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Write the input file" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "inpfile = \"h2_eq_pvtz_fci.inp\"\n", "with open(inpfile, 'w') as inp:\n", " inp.write(inpstr)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run the calculation" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "logfile = gamess.run(inpfile)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'h2_eq_pvtz_fci.log'" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "logfile" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Parsing the results\n", "\n", "`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." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gamess.accomplished(logfile)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-1.1329605255" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gamess.parse(logfile, 'hf total energy')" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-1.1723345936" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gamess.parse(logfile, \"cisd total energy\")" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-0.039374068100000104" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gamess.parse(logfile, \"correlation energy\")" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "82.0" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gamess.parse(logfile, 'regexp', r'NUMBER OF CONFIGURATIONS\\s*=\\s*(\\d+)')" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "application/json": { "Software versions": [ { "module": "Python", "version": "3.6.3 64bit [GCC 7.2.0]" }, { "module": "IPython", "version": "6.2.1" }, { "module": "OS", "version": "Linux 4.9.0 4 amd64 x86_64 with debian 9.1" }, { "module": "chemtools", "version": "0.8.4" } ] }, "text/html": [ "
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
" ], "text/latex": [ "\\begin{tabular}{|l|l|}\\hline\n", "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n", "Python & 3.6.3 64bit [GCC 7.2.0] \\\\ \\hline\n", "IPython & 6.2.1 \\\\ \\hline\n", "OS & Linux 4.9.0 4 amd64 x86\\_64 with debian 9.1 \\\\ \\hline\n", "chemtools & 0.8.4 \\\\ \\hline\n", "\\hline \\multicolumn{2}{|l|}{Mon Nov 27 19:27:43 2017 CET} \\\\ \\hline\n", "\\end{tabular}\n" ], "text/plain": [ "Software versions\n", "Python 3.6.3 64bit [GCC 7.2.0]\n", "IPython 6.2.1\n", "OS Linux 4.9.0 4 amd64 x86_64 with debian 9.1\n", "chemtools 0.8.4\n", "Mon Nov 27 19:27:43 2017 CET" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%version_information chemtools" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 1 }