# pygamess
<span class="title-ref">pygamess</span> is a GAMESS wrapper for Python
## Requirements
- Python 3.7 or later (pygamess <0.5 supports only Python2)
- RDKit >= 2020.03.5
- GAMESS > Jun2020R1
- ruamel.YAML
## Setup
$ pip install pygamess
set GAMESS\_HOME environment in your .bashrc or .zshrc:
$ export GAMESS_HOME=/usr/local/gamess
***
Windows/Mac users can obtain the pre-compiled binary executables from [GAMESS download site](https://www.msg.chem.iastate.edu/gamess/download.html).
But Linux users need to compile the souce code.
***
## Test
$ pytest
## Basic Usage
### Single point calculation
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> r = g.run(m)
>>> r.total_energy
-152.127991054
Or use rdkit directly:
>>> from pygamess import Gamess
>>> from rdkit import Chem
>>> from rdkit.Chem import AllChem
>>> m = Chem.MolFromSmiles("CCO")
>>> m = Chem.AddHs(m)
>>> AllChem.EmbedMolecule(m)
0
>>> AllChem.UFFOptimizeMolecule(m,maxIters=200)
0
>>> g = Gamess()
>>> r = g.run(m)
>>> r.total_energy
-152.1279910526
The GamessOut object(r) contains the results of the GAMESS calculation
and the RDKit Chem object with the calculation results:
>>> r.total_energy
-152.1279910526
>>> r.HOMO
-0.3453
>>> r.nHOMO
-0.3978
>>> r.LUMO
0.5594
>>> r.nLUMO
0.6127
>>> r.dipole_moment
[0.681619, -0.605188, 1.146253, 1.464497]
>>> r.orbital_energies
[-20.2521, -11.0932, -11.0402, -1.286, -0.9614, -0.7909, -0.6269, -0.5716, -0.5347, -0.4976, -0.4705, -0.3978, -0.3453, 0.5594, 0.6127, 0.6639, 0.69, 0.7002, 0.7388, 0.7549, 0.7852]
>>> r.mulliken_charges
[-0.171226, 0.024351, -0.298162, 0.049615, 0.055831, 0.061924, 0.042714, 0.061112, 0.173842]
>>> r.lowdin_charges
[-0.089262, 0.062464, -0.212689, 0.022024, 0.02752, 0.031644, 0.010235, 0.026611, 0.121453]
The RDKit Chem object has the same information to store these data into
SDF:
>>> r.mol
<rdkit.Chem.rdchem.Mol object at 0x7ffd48217f30>
>>> r.mol.GetProp("total_energy")
'-152.12799105260001'
>>> r.mol.GetProp("HOMO")
'-0.3453'
>>> r.mol.GetProp("nHOMO")
'-0.39779999999999999'
>>> r.mol.GetProp("LUMO")
'0.55940000000000001'
>>> r.mol.GetProp("nLUMO")
'0.61270000000000002'
>>> r.mol.GetProp("dipole_moment")
'1.4644969999999999'
>>> r.mol.GetProp("dx")
'0.68161899999999997'
>>> r.mol.GetProp("dy")
'-0.60518799999999995'
>>> r.mol.GetProp("dz")
'1.146253'
>>> r.mol.GetProp("orbital_energies")
'-20.2521 -11.0932 -11.0402 -1.286 -0.9614 -0.7909 -0.6269 -0.5716 -0.5347 -0.4976 -0.4705 -0.3978 -0.3453 0.5594 0.6127 0.6639 0.69 0.7002 0.7388 0.7549 0.7852'
>>> for a in r.mol.GetAtoms():
... print("{}:\t{:.4f}\t{:.4f}".format(a.GetSymbol(), float(a.GetProp("mulliken_charge")), float(a.GetProp("lowdin_charge"))))
...
C: -0.1712 -0.0893
C: 0.0244 0.0625
O: -0.2982 -0.2127
H: 0.0496 0.0220
H: 0.0558 0.0275
H: 0.0619 0.0316
H: 0.0427 0.0102
H: 0.0611 0.0266
H: 0.1738 0.1215
### Geometry optimization
Set the run\_type as 'optimize'. This optimization process updates the
coordinates of the molecule:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> g.run_type('optimize')
>>> r = g.run(m)
>>> r.total_energy
-152.1330661028
>>> original_conf = m.GetConformer(0)
>>> optimized_conf = r.mol.GetConformer(0)
>>> for c in original_conf.GetPositions():
... print(c)
...
[ 0.91206647 -0.11944851 -0.1294722 ]
[-0.47153193 0.42043351 0.21118521]
[-1.44831334 -0.21539324 -0.56715297]
[ 0.9650486 -1.2050043 0.09903891]
[1.67955732 0.41189183 0.47186063]
[ 1.12654515 0.0378618 -1.20780162]
[-0.67995345 0.27545635 1.29552482]
[-0.49851483 1.50993204 -0.00177488]
[-1.58490399 -1.11572948 -0.17140791]
>>> for c in optimized_conf.GetPositions():
... print(c)
...
[ 0.91442972 -0.13086468 -0.12174822]
[-0.48373921 0.42850882 0.23169745]
[-1.54145595 -0.17763397 -0.52424945]
[ 0.97874385 -1.18768306 0.12185969]
[1.67944907 0.39674369 0.43935649]
[ 1.11452802 -0.00923776 -1.18177409]
[-0.65534535 0.31918718 1.31002371]
[-0.51450285 1.49751073 0.00304491]
[-1.4921073 -1.13653094 -0.2782105 ]
Or pass the options to a constractor::
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess(options={"contrl":{"runtyp":"optimize"}})
>>> r = g.run(m)
>>> r.total_energy
-152.1330661279
### Calculating IR spectra after optimization
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCC(=O)O")
>>> g = Gamess()
>>> g.run_type('optimize', hessend=True)
>>> r = g.run(m)
>>> r.ir_spectra
[('1.078', '0.058962'), ('0.361', '0.000420'), ('0.119', '0.000239'), ('0.703', '0.027425'), ('1.694', '0.025676'), ('3.212', '0.064166'), ('80.809', '0.030877'), ('220.540', '0.023447'), ('255.386', '0.510706'), ('362.039', '1.450661'), ('461.248', '0.076788'), ('590.483', '0.244231'), ('743.957', '0.128188'), ('915.147', '0.079289'), ('941.690', '0.122604'), ('1163.260', '0.213250'), ('1262.233', '0.180680'), ('1283.531', '0.070173'), ('1451.777', '0.939433'), ('1514.198', '0.042036'), ('1564.520', '3.659319'), ('1627.441', '0.509608'), ('1736.037', '0.011788'), ('1799.935', '0.021852'), ('1830.887', '0.076255'), ('1834.826', '0.085977'), ('2153.439', '1.875334'), ('3572.386', '0.028347'), ('3609.011', '0.023501'), ('3730.553', '0.009088'), ('3752.383', '0.015918'), ('3758.396', '0.003956'), ('4272.454', '0.229192')]
### GAMESS ###
# DFT ANALYTIC HESSIAN PRESENTLY HAS 5 RESTRICTIONS:
# $CONTRL: SCFTYP MUST BE EITHER RHF OR UHF
# $CONTRL: POINT GROUP SYMMETRY NOT ALLOWED, SET NOSYM=1
# $SCF: AO INTEGRAL DIRECT: SET DIRSCF=.TRUE.
# $CPHF: AO INTEGRAL DRIVEN: SET CPHF=AO
# AND THE FUNCTIONAL MUST NOT BE OF META-GGA TYPE.
### Changing basis sets
Use basis\_sets method:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> g.run_type = "optimize"
>>> g.run(m).total_energy
-152.127991054
>>> g.basis_sets("3-21G")
>>> g.run(m).total_energy
-153.2170653562
>>> g.basis_sets("6-31G")
>>> g.run(m).total_energy
-154.0054866151
>>> g.basis_sets("6-31G*")
>>> g.run(m).total_energy
-154.0702703669
>>> g.basis_sets("6-31G**")
>>> g.run(m).total_energy
-154.0843823698
Or edit the basis attribute directly:
>>> g.options({'basis':{'gbasis': 'sto', 'ngauss': '3'}})
>>> g.run(m).total_energy
-152.127991054
### Changing the electronic state
The ground state (default):
>>> from pygamess.utils import rdkit_optimize
>>> from pygamess import Gamess
>>> g = Gamess()
>>> g.basis_sets("6-31G*")
>>> m = rdkit_optimize("CCO")
>>> g.run_type("optimize")
>>> r = g.run(m)
>>> r.total_energy
-154.0755757352
The cationic state:
>>> g.scf_type("uhf")
>>> g.charge(1)
>>> g.multiplicity(2)
>>> r = g.run(m)
>>> r.total_energy
-153.7367666449
Or:
>>> g.options({"contrl":{"icharg": 1, "mult": 2, "scftyp": "uhf"}})
>>> r = g.run(m)
>>> r.total_energy
-153.7367666449
The anionic state:
>>> g.options({"contrl":{"icharg": -1, "mult": 2, "scftyp": "uhf"}})
>>> r = g.run(m)
>>> r.total_energy
-153.9302151707
The triplet state:
>>> g.options({"contrl":{"icharg": 0, "mult": 3, "scftyp": "uhf"}})
>>> r = g.run(m)
>>> r.total_energy
-153.9581403463
### DFT calculation
B3LYP/6-31G\*:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> g.run_type("optimize")
>>> g.basis_sets("6-31G*")
>>> g.dft_type("B3LYP")
>>> g.run(m).total_energy
-154.9387962055
M062X/6-31G\*\*:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> g.run_type("optimize")
>>> g.dft_type("M06-2X")
>>> g.basis_sets("6-31G**")
>>> g.run(m).total_energy
-154.9636095207
### PCM calculation
Pygamess currently only supports CPCM, but will support IEFPCM in the
future:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> g.basis_sets("6-31G*")
>>> g.pcm_type("water")
>>> g.run_type("optimize")
>>> r = g.run(m)
>>> r.total_energy
-154.0824604616
>>> r.internal_energy
-154.0748367584
>>> r.delta_internal_energy
0.0
>>> r.electrostatic_interaction
-0.0076237032
>>> r.pierotti_cavitation_energy
0.0
>>> r.dispersion_free_energy
0.0
>>> r.repulsion_free_energy
0.0
>>> r.total_interacion
-0.0076237032
### TDDFT calculation
The example compound(Methyl yellow) was downloaded from [PubchemQC project](http://pubchemqc.riken.jp/cgi-bin/molecularquery.py?name=methyl+yellow).
>>> from pygamess import Gamess
>>> from rdkit import Chem
>>> m = Chem.MolFromMolFile("examples/methyl_yellow.mol", removeHs=False)
>>> g = Gamess()
>>> g.dft_type("b3lyp", tddft=True)
>>> g.basis_sets("6-31G*")
>>> r = g.run(m)
>>> r.uv_spectra # (exitation ev, oscillator strength)
[('2.629', '0.0000'), ('3.217', '0.9349'), ('4.209', '0.0066'), ('4.263', '0.0020'), ('4.424', '0.1041'), ('4.779', '0.1068'), ('4.913', '0.0563'), ('4.940', '0.0001'), ('5.051', '0.0000'), ('5.430', '0.0006')]
- ref: [独習 量子化学計算(Self-study Quantum Chemical Calculations)](https://www.amazon.co.jp/gp/product/B0863C799Z/)
### NMR spectra calculation
Optimizing the compound:
>>> from pygamess import Gamess
>>> from rdkit import Chem
>>> g = Gamess()
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("C=CCBr")
>>> g.run_type("optimize")
>>> g.dft_type("b3lyp")
>>> g.basis_sets("6-31G*")
>>> r = g.run(m)
>>> with open("examples/C=CCBr.mol", "w") as f:
... f.write(Chem.MolToMolBlock(r.mol))
...
NMR spectra calculation (It takes a long time):
>>> from pygamess import Gamess
>>> from rdkit import Chem
>>> m = Chem.MolFromMolFile("examples/C=CCBr.mol", removeHs=False)
>>> g = Gamess(num_cores=1) # PARALLEL EXECUTION IS NOT ENABLED.
>>> g.basis_sets("6-31G*")
>>> g.run_type("nmr")
>>> r = g.run(m)
>>> r.isotropic_shielding
[79.8218, 68.6661, 157.7233, 2476.7501, 27.0851, 27.2072, 26.4652, 28.7654, 28.7932]
# NMR MAY BE COMPUTED ONLY FOR SCFTYP=RHF,
# NO CORRELATION OPTION (DFTTYP, CITYP, CCTYP, MPLEVL) MAY BE CHOSEN
# NO SEMI-EMPIRICAL OPTION (GBASIS=AM1/PM3/MNDO) MAY BE CHOSEN
# DIRECT AO INTEGRAL CALCULATION (DIRSCF) IS NOT ENABLED,
# AND/OR PARALLEL EXECUTION IS NOT ENABLED.
- ref: [独習 量子化学計算(Self-study Quantum Chemical Calculations)](https://www.amazon.co.jp/gp/product/B0863C799Z/)
### Printing GAMESS INPUT
use input method:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> m = rdkit_optimize("CO")
>>> g = Gamess()
>>> print(g.input(m))
$contrl scftyp=rhf runtyp=energy $end
$basis gbasis=sto ngauss=3 $end
$system mwords=100 $end
$DATA
6324
C1
C 6.0 -0.3577002260 0.0075902163 -0.0214817423
O 8.0 0.9087355734 -0.5349924519 -0.2611189822
H 1.0 -0.5468334701 0.0717914414 1.0721087268
H 1.0 -0.4337681128 1.0193437527 -0.4757947304
H 1.0 -1.1269974200 -0.6479305528 -0.4789564639
H 1.0 1.5565636556 0.0841975943 0.1652431920
$END
### Parsing a GAMESS output file
use gparse:
>>> from pygamess.gamout_parser import gparse
>>> r = gparse("/somewhere/gamess.out")
### Persistence of calculation results
save sdf file:
>>> from pygamess import Gamess
>>> from pygamess.utils import rdkit_optimize
>>> from rdkit import Chem
>>> m = rdkit_optimize("CCO")
>>> g = Gamess()
>>> r = g.run(m)
>>> w = Chem.SDWriter("CCO.sdf")
>>> w.write(r.mol)
>>> w.close()
load from sdf file:
>>> from pygamess.utils import sdf2gamout
>>> r = sdf2gamout("CCO.sdf")
>>> r = rs[0]
>>> r.HOMO
-0.3453
>>> r.mulliken_charges
['-0.17122599999999999', '0.024351000000000001', '-0.29816199999999998', '0.049614999999999999', '0.055830999999999999', '0.061924', '0.042714000000000002', '0.061112', '0.173842']
### Debugging pygamess
set PYGAMESS\_DEBUG environment:
$ export PYGAMESS_DEBUG=1
This won't remove the all files generated by the GAMESS executable,
including the output files.
set logger level:
>>> from pygamess import Gamess, logger
>>> import logging
>>> logger.setLevel(logging.DEBUG)
>>> g = Gamess()
DEBUG:pygamess.gamess:tmpdir: /var/folders/gm/4tcnnyqd09d2jt7p0dtvr28m0000gn/T/tmp889j9c7e
## History
### 0.6.9 (2023-09-18)
- Fix Mulliken/Lowdin population bug
### 0.6.8 (2023-09-10)
- Add Mulliken/Lowdin population
### 0.6.7 (2021-09-12)
- Bug fix (options)
- Support Windows pre-compiled GAMESS (#11)
- OS-dependent termination detection (#12)
### 0.6.6 (2021-08-31)
- Bug fix (SDF -> GamessOut)
### 0.6.5 (2021-08-31)
- Add SDF -> GamessOut object parser for persistence of calculation results
### 0.6.4 (2021-06-29)
- Store UV-spectra NMR-spectra and IR-spectra into Chem object
### 0.6.3 (2021-05-09)
- Support hessend (#8)
- Support TD-DFT (#2)
- Store the energy of each step during structural optimization (#7)
- Add the calculation condition into Chem object (#6)
- Support NMR calculation
### 0.6.2 (2021-05-05)
- Support options
- Add parser description
### 0.6.1 (2021-05-03)
- Fix bug (ModuleNotFoundError: No module named 'pygamess_utils')
- Change README format (rst -> md)
### 0.6.0 (2021-05-02)
- Support DFT calculation
- Support PCM calculation (C-PCM only)
- Improve the parser
- Support logger levels
- Change method name from "basis\_set" to "basis\_sets"
### 0.5.0 (2020-09-13)
- Support Python3
### 0.4.1.1 (2017-09-16)
- Update Readme
### 0.4.1 (2017-09-16)
- Bug fix (coordinates problem)
### 0.4.0 (2017-09-13)
- Change the backend library from openbabel to RDKit
### 0.3.0 (2012-03-31)
- Use internal rungms (default)
- Add basis\_set
method(STO-3G,3-21G,6-31G,6-311G,6-31G\*,6-31G\*\*,AM1,PM3,MNDO)
- Constructor can accept options
- Bug fixed (spin multiplicity)
### 0.2.2 (2012-03-30)
- Add charge settings
- Change Method name (gamess\_input -> input)
### 0.2.1 (2012-03-23)
- Bug fix (multiplicity setting for pybel)
- Bug fix (print error when rungms exec failed)
- Add document
### 0.2.0 (2012-03-06)
- Run method accepts OBMol and Pybel-Molecule object
### 0.1.2 (2011-09-23)
- Add CIS method (and optimization)
### 0.1.1 (2011-08-06)
- Update document
- Semiempical method (AM1, PM3, MNDO)
- Add statpt option
- Change default error print message (10 lines)
### 0.1 (2011-6-25)
- First release
Raw data
{
"_id": null,
"home_page": "https://github.com/kzfm/pygamess",
"name": "pygamess",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "chemistry",
"author": "Ohkawa Kazufumi",
"author_email": "kerolinq@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1a/d5/5cfe5a3712acfc8d83735c7db655c5fc5a890c37e922018f2d1c5498961d/pygamess-0.6.9.tar.gz",
"platform": null,
"description": "# pygamess\n\n<span class=\"title-ref\">pygamess</span> is a GAMESS wrapper for Python\n\n## Requirements\n\n- Python 3.7 or later (pygamess <0.5 supports only Python2)\n- RDKit >= 2020.03.5\n- GAMESS > Jun2020R1\n- ruamel.YAML\n\n## Setup\n\n $ pip install pygamess\n\nset GAMESS\\_HOME environment in your .bashrc or .zshrc:\n\n $ export GAMESS_HOME=/usr/local/gamess\n\n*** \nWindows/Mac users can obtain the pre-compiled binary executables from [GAMESS download site](https://www.msg.chem.iastate.edu/gamess/download.html).\nBut Linux users need to compile the souce code. \n***\n\n## Test\n\n $ pytest\n\n## Basic Usage\n\n### Single point calculation\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> r = g.run(m)\n >>> r.total_energy\n -152.127991054\n\nOr use rdkit directly:\n\n >>> from pygamess import Gamess\n >>> from rdkit import Chem\n >>> from rdkit.Chem import AllChem\n >>> m = Chem.MolFromSmiles(\"CCO\")\n >>> m = Chem.AddHs(m)\n >>> AllChem.EmbedMolecule(m)\n 0\n >>> AllChem.UFFOptimizeMolecule(m,maxIters=200)\n 0\n >>> g = Gamess()\n >>> r = g.run(m)\n >>> r.total_energy\n -152.1279910526\n\nThe GamessOut object(r) contains the results of the GAMESS calculation\nand the RDKit Chem object with the calculation results:\n\n >>> r.total_energy\n -152.1279910526\n >>> r.HOMO\n -0.3453\n >>> r.nHOMO\n -0.3978\n >>> r.LUMO\n 0.5594\n >>> r.nLUMO\n 0.6127\n >>> r.dipole_moment\n [0.681619, -0.605188, 1.146253, 1.464497]\n >>> r.orbital_energies\n [-20.2521, -11.0932, -11.0402, -1.286, -0.9614, -0.7909, -0.6269, -0.5716, -0.5347, -0.4976, -0.4705, -0.3978, -0.3453, 0.5594, 0.6127, 0.6639, 0.69, 0.7002, 0.7388, 0.7549, 0.7852]\n >>> r.mulliken_charges\n [-0.171226, 0.024351, -0.298162, 0.049615, 0.055831, 0.061924, 0.042714, 0.061112, 0.173842]\n >>> r.lowdin_charges\n [-0.089262, 0.062464, -0.212689, 0.022024, 0.02752, 0.031644, 0.010235, 0.026611, 0.121453]\n\nThe RDKit Chem object has the same information to store these data into\nSDF:\n\n >>> r.mol\n <rdkit.Chem.rdchem.Mol object at 0x7ffd48217f30>\n >>> r.mol.GetProp(\"total_energy\")\n '-152.12799105260001'\n >>> r.mol.GetProp(\"HOMO\")\n '-0.3453'\n >>> r.mol.GetProp(\"nHOMO\")\n '-0.39779999999999999'\n >>> r.mol.GetProp(\"LUMO\")\n '0.55940000000000001'\n >>> r.mol.GetProp(\"nLUMO\")\n '0.61270000000000002'\n >>> r.mol.GetProp(\"dipole_moment\")\n '1.4644969999999999'\n >>> r.mol.GetProp(\"dx\")\n '0.68161899999999997'\n >>> r.mol.GetProp(\"dy\")\n '-0.60518799999999995'\n >>> r.mol.GetProp(\"dz\")\n '1.146253'\n >>> r.mol.GetProp(\"orbital_energies\")\n '-20.2521 -11.0932 -11.0402 -1.286 -0.9614 -0.7909 -0.6269 -0.5716 -0.5347 -0.4976 -0.4705 -0.3978 -0.3453 0.5594 0.6127 0.6639 0.69 0.7002 0.7388 0.7549 0.7852'\n >>> for a in r.mol.GetAtoms():\n ... print(\"{}:\\t{:.4f}\\t{:.4f}\".format(a.GetSymbol(), float(a.GetProp(\"mulliken_charge\")), float(a.GetProp(\"lowdin_charge\"))))\n ... \n C: -0.1712 -0.0893\n C: 0.0244 0.0625\n O: -0.2982 -0.2127\n H: 0.0496 0.0220\n H: 0.0558 0.0275\n H: 0.0619 0.0316\n H: 0.0427 0.0102\n H: 0.0611 0.0266\n H: 0.1738 0.1215\n\n### Geometry optimization\n\nSet the run\\_type as 'optimize'. This optimization process updates the\ncoordinates of the molecule:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> g.run_type('optimize')\n >>> r = g.run(m)\n >>> r.total_energy\n -152.1330661028\n >>> original_conf = m.GetConformer(0)\n >>> optimized_conf = r.mol.GetConformer(0)\n >>> for c in original_conf.GetPositions():\n ... print(c)\n ... \n [ 0.91206647 -0.11944851 -0.1294722 ]\n [-0.47153193 0.42043351 0.21118521]\n [-1.44831334 -0.21539324 -0.56715297]\n [ 0.9650486 -1.2050043 0.09903891]\n [1.67955732 0.41189183 0.47186063]\n [ 1.12654515 0.0378618 -1.20780162]\n [-0.67995345 0.27545635 1.29552482]\n [-0.49851483 1.50993204 -0.00177488]\n [-1.58490399 -1.11572948 -0.17140791]\n >>> for c in optimized_conf.GetPositions():\n ... print(c)\n ... \n [ 0.91442972 -0.13086468 -0.12174822]\n [-0.48373921 0.42850882 0.23169745]\n [-1.54145595 -0.17763397 -0.52424945]\n [ 0.97874385 -1.18768306 0.12185969]\n [1.67944907 0.39674369 0.43935649]\n [ 1.11452802 -0.00923776 -1.18177409]\n [-0.65534535 0.31918718 1.31002371]\n [-0.51450285 1.49751073 0.00304491]\n [-1.4921073 -1.13653094 -0.2782105 ]\n\nOr pass the options to a constractor::\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess(options={\"contrl\":{\"runtyp\":\"optimize\"}})\n >>> r = g.run(m)\n >>> r.total_energy\n -152.1330661279\n\n### Calculating IR spectra after optimization\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCC(=O)O\")\n >>> g = Gamess()\n >>> g.run_type('optimize', hessend=True)\n >>> r = g.run(m)\n >>> r.ir_spectra\n [('1.078', '0.058962'), ('0.361', '0.000420'), ('0.119', '0.000239'), ('0.703', '0.027425'), ('1.694', '0.025676'), ('3.212', '0.064166'), ('80.809', '0.030877'), ('220.540', '0.023447'), ('255.386', '0.510706'), ('362.039', '1.450661'), ('461.248', '0.076788'), ('590.483', '0.244231'), ('743.957', '0.128188'), ('915.147', '0.079289'), ('941.690', '0.122604'), ('1163.260', '0.213250'), ('1262.233', '0.180680'), ('1283.531', '0.070173'), ('1451.777', '0.939433'), ('1514.198', '0.042036'), ('1564.520', '3.659319'), ('1627.441', '0.509608'), ('1736.037', '0.011788'), ('1799.935', '0.021852'), ('1830.887', '0.076255'), ('1834.826', '0.085977'), ('2153.439', '1.875334'), ('3572.386', '0.028347'), ('3609.011', '0.023501'), ('3730.553', '0.009088'), ('3752.383', '0.015918'), ('3758.396', '0.003956'), ('4272.454', '0.229192')]\n\n ### GAMESS ### \n # DFT ANALYTIC HESSIAN PRESENTLY HAS 5 RESTRICTIONS:\n # $CONTRL: SCFTYP MUST BE EITHER RHF OR UHF\n # $CONTRL: POINT GROUP SYMMETRY NOT ALLOWED, SET NOSYM=1\n # $SCF: AO INTEGRAL DIRECT: SET DIRSCF=.TRUE.\n # $CPHF: AO INTEGRAL DRIVEN: SET CPHF=AO\n # AND THE FUNCTIONAL MUST NOT BE OF META-GGA TYPE.\n\n### Changing basis sets\n\nUse basis\\_sets method:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> g.run_type = \"optimize\"\n >>> g.run(m).total_energy\n -152.127991054\n >>> g.basis_sets(\"3-21G\")\n >>> g.run(m).total_energy\n -153.2170653562\n >>> g.basis_sets(\"6-31G\")\n >>> g.run(m).total_energy\n -154.0054866151\n >>> g.basis_sets(\"6-31G*\")\n >>> g.run(m).total_energy\n -154.0702703669\n >>> g.basis_sets(\"6-31G**\")\n >>> g.run(m).total_energy\n -154.0843823698\n\nOr edit the basis attribute directly:\n\n >>> g.options({'basis':{'gbasis': 'sto', 'ngauss': '3'}})\n >>> g.run(m).total_energy\n -152.127991054\n\n### Changing the electronic state\n\nThe ground state (default):\n\n >>> from pygamess.utils import rdkit_optimize\n >>> from pygamess import Gamess\n >>> g = Gamess()\n >>> g.basis_sets(\"6-31G*\")\n >>> m = rdkit_optimize(\"CCO\")\n >>> g.run_type(\"optimize\")\n >>> r = g.run(m)\n >>> r.total_energy\n -154.0755757352\n\nThe cationic state:\n\n >>> g.scf_type(\"uhf\")\n >>> g.charge(1)\n >>> g.multiplicity(2)\n >>> r = g.run(m)\n >>> r.total_energy\n -153.7367666449\n\nOr:\n\n >>> g.options({\"contrl\":{\"icharg\": 1, \"mult\": 2, \"scftyp\": \"uhf\"}})\n >>> r = g.run(m)\n >>> r.total_energy\n -153.7367666449\n\nThe anionic state:\n\n >>> g.options({\"contrl\":{\"icharg\": -1, \"mult\": 2, \"scftyp\": \"uhf\"}})\n >>> r = g.run(m)\n >>> r.total_energy\n -153.9302151707\n\nThe triplet state:\n\n >>> g.options({\"contrl\":{\"icharg\": 0, \"mult\": 3, \"scftyp\": \"uhf\"}})\n >>> r = g.run(m)\n >>> r.total_energy\n -153.9581403463\n\n### DFT calculation\n\nB3LYP/6-31G\\*:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> g.run_type(\"optimize\")\n >>> g.basis_sets(\"6-31G*\")\n >>> g.dft_type(\"B3LYP\")\n >>> g.run(m).total_energy\n -154.9387962055\n\nM062X/6-31G\\*\\*:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> g.run_type(\"optimize\")\n >>> g.dft_type(\"M06-2X\")\n >>> g.basis_sets(\"6-31G**\")\n >>> g.run(m).total_energy\n -154.9636095207\n\n### PCM calculation\n\nPygamess currently only supports CPCM, but will support IEFPCM in the\nfuture:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> g.basis_sets(\"6-31G*\")\n >>> g.pcm_type(\"water\")\n >>> g.run_type(\"optimize\")\n >>> r = g.run(m)\n >>> r.total_energy\n -154.0824604616\n >>> r.internal_energy\n -154.0748367584\n >>> r.delta_internal_energy\n 0.0\n >>> r.electrostatic_interaction\n -0.0076237032\n >>> r.pierotti_cavitation_energy\n 0.0\n >>> r.dispersion_free_energy\n 0.0\n >>> r.repulsion_free_energy\n 0.0\n >>> r.total_interacion\n -0.0076237032\n\n### TDDFT calculation\n\nThe example compound(Methyl yellow) was downloaded from [PubchemQC project](http://pubchemqc.riken.jp/cgi-bin/molecularquery.py?name=methyl+yellow).\n\n >>> from pygamess import Gamess\n >>> from rdkit import Chem\n >>> m = Chem.MolFromMolFile(\"examples/methyl_yellow.mol\", removeHs=False)\n >>> g = Gamess()\n >>> g.dft_type(\"b3lyp\", tddft=True)\n >>> g.basis_sets(\"6-31G*\")\n >>> r = g.run(m)\n >>> r.uv_spectra # (exitation ev, oscillator strength)\n [('2.629', '0.0000'), ('3.217', '0.9349'), ('4.209', '0.0066'), ('4.263', '0.0020'), ('4.424', '0.1041'), ('4.779', '0.1068'), ('4.913', '0.0563'), ('4.940', '0.0001'), ('5.051', '0.0000'), ('5.430', '0.0006')]\n\n- ref: [\u72ec\u7fd2 \u91cf\u5b50\u5316\u5b66\u8a08\u7b97(Self-study Quantum Chemical Calculations)](https://www.amazon.co.jp/gp/product/B0863C799Z/)\n\n### NMR spectra calculation\n\nOptimizing the compound:\n\n >>> from pygamess import Gamess\n >>> from rdkit import Chem\n >>> g = Gamess()\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"C=CCBr\")\n >>> g.run_type(\"optimize\")\n >>> g.dft_type(\"b3lyp\")\n >>> g.basis_sets(\"6-31G*\")\n >>> r = g.run(m)\n >>> with open(\"examples/C=CCBr.mol\", \"w\") as f:\n ... f.write(Chem.MolToMolBlock(r.mol))\n ... \n\nNMR spectra calculation (It takes a long time):\n\n >>> from pygamess import Gamess\n >>> from rdkit import Chem\n >>> m = Chem.MolFromMolFile(\"examples/C=CCBr.mol\", removeHs=False)\n >>> g = Gamess(num_cores=1) # PARALLEL EXECUTION IS NOT ENABLED.\n >>> g.basis_sets(\"6-31G*\")\n >>> g.run_type(\"nmr\")\n >>> r = g.run(m)\n >>> r.isotropic_shielding\n [79.8218, 68.6661, 157.7233, 2476.7501, 27.0851, 27.2072, 26.4652, 28.7654, 28.7932]\n\n # NMR MAY BE COMPUTED ONLY FOR SCFTYP=RHF,\n # NO CORRELATION OPTION (DFTTYP, CITYP, CCTYP, MPLEVL) MAY BE CHOSEN\n # NO SEMI-EMPIRICAL OPTION (GBASIS=AM1/PM3/MNDO) MAY BE CHOSEN\n # DIRECT AO INTEGRAL CALCULATION (DIRSCF) IS NOT ENABLED,\n # AND/OR PARALLEL EXECUTION IS NOT ENABLED.\n\n- ref: [\u72ec\u7fd2 \u91cf\u5b50\u5316\u5b66\u8a08\u7b97(Self-study Quantum Chemical Calculations)](https://www.amazon.co.jp/gp/product/B0863C799Z/)\n\n### Printing GAMESS INPUT\n\nuse input method:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> m = rdkit_optimize(\"CO\")\n >>> g = Gamess()\n >>> print(g.input(m))\n $contrl scftyp=rhf runtyp=energy $end\n $basis gbasis=sto ngauss=3 $end\n $system mwords=100 $end\n $DATA\n 6324\n C1\n C 6.0 -0.3577002260 0.0075902163 -0.0214817423 \n O 8.0 0.9087355734 -0.5349924519 -0.2611189822 \n H 1.0 -0.5468334701 0.0717914414 1.0721087268 \n H 1.0 -0.4337681128 1.0193437527 -0.4757947304 \n H 1.0 -1.1269974200 -0.6479305528 -0.4789564639 \n H 1.0 1.5565636556 0.0841975943 0.1652431920 \n $END\n\n### Parsing a GAMESS output file\n\nuse gparse:\n\n >>> from pygamess.gamout_parser import gparse\n >>> r = gparse(\"/somewhere/gamess.out\")\n\n### Persistence of calculation results\n\nsave sdf file:\n\n >>> from pygamess import Gamess\n >>> from pygamess.utils import rdkit_optimize\n >>> from rdkit import Chem\n >>> m = rdkit_optimize(\"CCO\")\n >>> g = Gamess()\n >>> r = g.run(m)\n >>> w = Chem.SDWriter(\"CCO.sdf\")\n >>> w.write(r.mol)\n >>> w.close()\n\nload from sdf file:\n\n >>> from pygamess.utils import sdf2gamout\n >>> r = sdf2gamout(\"CCO.sdf\")\n >>> r = rs[0]\n >>> r.HOMO\n -0.3453\n >>> r.mulliken_charges\n ['-0.17122599999999999', '0.024351000000000001', '-0.29816199999999998', '0.049614999999999999', '0.055830999999999999', '0.061924', '0.042714000000000002', '0.061112', '0.173842']\n\n### Debugging pygamess\n\nset PYGAMESS\\_DEBUG environment:\n\n $ export PYGAMESS_DEBUG=1\n\nThis won't remove the all files generated by the GAMESS executable,\nincluding the output files.\n\nset logger level:\n\n >>> from pygamess import Gamess, logger\n >>> import logging\n >>> logger.setLevel(logging.DEBUG)\n >>> g = Gamess()\n DEBUG:pygamess.gamess:tmpdir: /var/folders/gm/4tcnnyqd09d2jt7p0dtvr28m0000gn/T/tmp889j9c7e\n\n## History\n\n### 0.6.9 (2023-09-18)\n\n- Fix Mulliken/Lowdin population bug\n\n### 0.6.8 (2023-09-10)\n\n- Add Mulliken/Lowdin population\n\n### 0.6.7 (2021-09-12)\n\n- Bug fix (options)\n- Support Windows pre-compiled GAMESS (#11)\n- OS-dependent termination detection (#12)\n\n### 0.6.6 (2021-08-31)\n\n- Bug fix (SDF -> GamessOut)\n\n### 0.6.5 (2021-08-31)\n\n- Add SDF -> GamessOut object parser for persistence of calculation results\n\n### 0.6.4 (2021-06-29)\n\n- Store UV-spectra NMR-spectra and IR-spectra into Chem object\n\n### 0.6.3 (2021-05-09)\n\n- Support hessend (#8)\n- Support TD-DFT (#2)\n- Store the energy of each step during structural optimization (#7)\n- Add the calculation condition into Chem object (#6)\n- Support NMR calculation\n\n### 0.6.2 (2021-05-05)\n\n- Support options\n- Add parser description\n\n### 0.6.1 (2021-05-03)\n\n- Fix bug (ModuleNotFoundError: No module named 'pygamess_utils')\n- Change README format (rst -> md)\n\n### 0.6.0 (2021-05-02)\n\n- Support DFT calculation\n- Support PCM calculation (C-PCM only)\n- Improve the parser\n- Support logger levels\n- Change method name from \"basis\\_set\" to \"basis\\_sets\"\n\n### 0.5.0 (2020-09-13)\n\n- Support Python3\n\n### 0.4.1.1 (2017-09-16)\n\n- Update Readme\n\n### 0.4.1 (2017-09-16)\n\n- Bug fix (coordinates problem)\n\n### 0.4.0 (2017-09-13)\n\n- Change the backend library from openbabel to RDKit\n\n### 0.3.0 (2012-03-31)\n\n- Use internal rungms (default)\n- Add basis\\_set\n method(STO-3G,3-21G,6-31G,6-311G,6-31G\\*,6-31G\\*\\*,AM1,PM3,MNDO)\n- Constructor can accept options\n- Bug fixed (spin multiplicity)\n\n### 0.2.2 (2012-03-30)\n\n- Add charge settings\n- Change Method name (gamess\\_input -> input)\n\n### 0.2.1 (2012-03-23)\n\n- Bug fix (multiplicity setting for pybel)\n- Bug fix (print error when rungms exec failed)\n- Add document\n\n### 0.2.0 (2012-03-06)\n\n- Run method accepts OBMol and Pybel-Molecule object\n\n### 0.1.2 (2011-09-23)\n\n- Add CIS method (and optimization)\n\n### 0.1.1 (2011-08-06)\n\n- Update document\n- Semiempical method (AM1, PM3, MNDO)\n- Add statpt option\n- Change default error print message (10 lines)\n\n### 0.1 (2011-6-25)\n\n- First release\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "GAMESS wrapper for Python",
"version": "0.6.9",
"project_urls": {
"Homepage": "https://github.com/kzfm/pygamess"
},
"split_keywords": [
"chemistry"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ad55cfe5a3712acfc8d83735c7db655c5fc5a890c37e922018f2d1c5498961d",
"md5": "4839bd3a1fe924525e0f95b3a7f776a3",
"sha256": "1d0223124823fbf1b6f0a2218ce6aa942e19d4e2d84c5483309e1ba4bec5858a"
},
"downloads": -1,
"filename": "pygamess-0.6.9.tar.gz",
"has_sig": false,
"md5_digest": "4839bd3a1fe924525e0f95b3a7f776a3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24544,
"upload_time": "2023-09-17T23:22:38",
"upload_time_iso_8601": "2023-09-17T23:22:38.583300Z",
"url": "https://files.pythonhosted.org/packages/1a/d5/5cfe5a3712acfc8d83735c7db655c5fc5a890c37e922018f2d1c5498961d/pygamess-0.6.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-17 23:22:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kzfm",
"github_project": "pygamess",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pygamess"
}