Psi4

class chemsh.Psi4(frag: ~chemsh.objects.fragment.Fragment = <chemsh.objects.fragment.Fragment object>, method: str = 'rhf', basis: str = '3-21G', charge: int = 0, mult: int = 1, input_file_name: str = '_psi4.inp', output_file_name: str = '_psi4.out', convergence: float = 1e-08, functional: str = '', maxiter: int = 30, use_ri: bool = False, nprocs: int = 1, syscmd: str = 'psi4', fcidump: bool = False, set_options: dict = {})[source]

Interface to Psi4

frag

The geometry and physical properties of the system to study

Type:

Fragment, default: Fragment()

method

Defines the level of theory must be one of: [“HF”, “DFT”, “UDFT”, “RHF”, “ROHF”, “UHF”, “CUHF”, “RKS”, “UKS”]

Type:

str, default: “rhf”

basis

Defines the basis set

Type:

str, default: “3-21G”

charge

Charge of the system

Type:

int, default: 0

mult

Multiplicity of the system

Type:

int, default: 1

input_file_name

Input file name that ChemShell will write and overwrite

Type:

str, default: “_psi4.inp”

output_file_name

Output file name that ChemShell will read from and will be overwritten by Psi4

Type:

str, default: “_psi4.out”

convergence

Defines the energy convergence parameter for the SCF cycle

Type:

float, default: 1.0e-8

functional

Available only when using Density Functional Theory

Type:

str, default: “”

maxiter

Maximum number of SCF cycles

Type:

int, default: 30

use_ri

Whether to use Resolution of the Identity (RI)

Type:

bool, default: False

nprocs

Number of threads that PSi4 will use

Type:

int, default: 1

syscmd

Defines the Psi4 executable (must be in path)

Type:

str, default: “psi4”

fcidump

Should Psi4 output an FCIDUMP file?

Type:

bool, default: False

set_options

Additional options to be set in Psi4. They must take the form: set key value

Type:

dict, default: dict()

Notes

This interface uses the Psi4 input files and executable, not the Python API. The minimum required version of Psi4 is 1.9.1.

Examples

#
# Psi4 HF single point energy
#

from chemsh import Fragment, Psi4, SP

# Define a fragment using a json file
water = Fragment(coords="water.cjson")

# set up a qm task
qm_task = Psi4(frag=water, method="hf", basis="3-21g")

# define a single point calculation
sp = SP(theory=qm_task, gradients=True)

# run the single point calculation
sp.run()

# print the energy & gradients
print(sp.result.energy)
print(sp.result.gradients)
#
# Psi4/Gulp QM/MM Water Optimisation, with electrostatic
# embedding
# see "chemsh-py/tests/qmmm/psi4-gulp/h2o_dimer_elec_opt.py"
#
from chemsh import Fragment, Psi4, GULP, QMMM, Opt

# Define the water dimer from json
water = Fragment(coords='h2o_dimer.cjson')

# Define the GULP FF parameters
ff = '''#
# molmec removes Coulomb terms between bonded atoms
# and between atoms bonded to a common third atom
keyword molmec
# Flexible TIP3P model
# last number in LJ term is a cutoff
lennard 12 6 kcal x13
O O 582000.0 595.0 99.9
# intramolecular force-field parameters for MM
# from QM calculation on water monomer
# Note GULP k is twice that of ChemShell format
harmonic bond kcal
H O 1059.162 0.96
# Note GULP k is twice that of ChemShell format
# note different ordering of atoms
three bond kcal
O H H  68.087  104.5
'''

# Define the QM region calculation
qm = Psi4(method="hf", basis="3-21g")

# Define the MM region calculation
mm = GULP(ff=ff, molecule=True)

# Define the QM/MM calculation
qmmm = QMMM(frag=water, qm_region=range(3), qm=qm, mm=mm,
            embedding='electrostatic', coupling='covalent')

# Define and run the optimisation
optimisation = Opt(theory=qmmm)
optimisation.run()
__init__(frag: ~chemsh.objects.fragment.Fragment = <chemsh.objects.fragment.Fragment object>, method: str = 'rhf', basis: str = '3-21G', charge: int = 0, mult: int = 1, input_file_name: str = '_psi4.inp', output_file_name: str = '_psi4.out', convergence: float = 1e-08, functional: str = '', maxiter: int = 30, use_ri: bool = False, nprocs: int = 1, syscmd: str = 'psi4', fcidump: bool = False, set_options: dict = {})[source]