Interface to gCP by S. Grimme¶
Code author: Lori A. Burns
Section author: Lori A. Burns
Module: Samples
Installation¶
Binary
There are two implementations of gCP; see Empirical dispersion correction packages . The newer “mctc” one is preferred, while the older “classic” one will work for the immediate future. PSI4 will automatically select whichever is available.
gCP is available as a conda package for Linux and macOS and Windows.
If using the Psi4conda installer, gCP has already been installed alongside.
If using the PSI4 conda package, the classic gcp conda package can be obtained through
conda install gcp -c psi4
or the newer implementation throughconda install gcp-correction -c conda-forge
.If using PSI4 built from source, and anaconda or miniconda has already been installed (instructions at Quick Installation), the gcp executable can be obtained through
conda install gcp -c psi4
orconda install gcp-correction -c conda-forge
.To remove a conda installation,
conda remove gcp
orconda remove gcp-correction
.
Source
If using PSI4 built from source and you want to build gCP from from source also, follow the instructions provided with the source (essentially, download the freely available tarball, unpack the source, edit the Makefile to select a Fortran compiler, and run make).
To be used by PSI4, the program binary (gcp
or mctc-gcp
) must be
found in your PATH
so that QCEngine can detect it. Check if and where
found through qcengine info
. If
PSI4 is unable to execute the binary, an error will be reported.
To preferentially use a particular gcp compilation, simply adjust its
position in the path environment variables.
Running gCP¶
At present there is a limited interface to gCP that is used
only to implement the “HF-3c” [Sure:2013:1672] and “PBEh-3c”
[Grimme:2015:054107] methods (both energy and gradient). The interface
can use classic or mctc-gcp executables interchangeably and will prefer the latter.
A DFTD3 executable, classic or simple-dftd3,
must also be available for these methods to
run. Unlike every other method in PSI4, if a basis set has not been
set, these will default to their intended basis sets: MINIX for HF-3c
and def2-mSVP for PBEh-3c. If a basis has previously been set, but you
want to use the default basis, use the slash syntax to “empty” the basis
option for the scope of the current calculation, energy("hf3c/")
.
A few practical examples:
HF-3c single point with default minix basis
energy('hf3c')
PBEh-3c optimization with default def2-mSVP basis
optimize('pbeh3c')
HF-3c with non-standard basis
set basis cc-pvdz energy('hf3c')
PBEh-3c with default basis after basis set
set basis cc-pvdz energy('pbeh3c/')
If only BSSE/basis set corrections (rather than total energies) are of
interest, the gcp
program can be run independently of the scf
through the python function run_gcp()
. (This function
is the same PSI4/gcp
interface that is called during an scf job.)
This route is much faster than running a HF or DFT energy.
molecule nene {
Ne
Ne 1 2.0
}
nene.update_geometry()
>>> E, G = nene.run_gcp('hf3c')
>>> E, G = nene.run_gcp(func='HF3c', verbose=True)
- qcdb.Molecule.run_gcp(self, func=None, dertype=None, verbose=1)¶
Compute geometrical BSSE correction via Grimme’s GCP program.
Function to call Grimme’s GCP program https://www.chemie.uni-bonn.de/pctc/mulliken-center/software/gcp/gcp to compute an a posteriori geometrical BSSE correction to self for several HF, generic DFT, and specific HF-3c and PBEh-3c method/basis combinations, func. Returns energy if dertype is 0, gradient if dertype is 1, else tuple of energy and gradient if dertype unspecified. The gcp executable must be independently compiled and found in
PATH
orPSIPATH
. self may be either a qcdb.Molecule (sensibly) or a psi4.Molecule (works b/c psi4.Molecule has been extended by this method py-side and only public interface fns used) or a string that can be instantiated into a qcdb.Molecule.- Parameters:
func (
Optional
[str
]) – Name of method/basis combination or composite method for which to compute the correction (e.g., HF/cc-pVDZ, DFT/def2-SVP, HF3c, PBEh3c).dertype (
Union
[int
,str
,None
]) – Maximum derivative level at which to run GCP. For large molecules, energy-only calculations can be significantly more efficient. Influences return values, see below.verbose (
int
) – Amount of printing. Unused at present.
- Returns:
energy (float) – When dertype=0, energy [Eh].
gradient (ndarray) – When dertype=1, (nat, 3) gradient [Eh/a0].
(energy, gradient) (tuple of float and ndarray) – When dertype=None, both energy [Eh] and (nat, 3) gradient [Eh/a0].