Interface to gCP by S. Grimme

Code author: Lori A. Burns

Section author: Lori A. Burns

Module: Samples

https://img.shields.io/badge/home-gCP-5077AB.svg
https://img.shields.io/badge/docs-latest-5077AB.svg

Installation

Binary

  • https://anaconda.org/psi4/gcp/badges/version.svg
  • 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. Starting with v1.9, only “mctc-gcp” is supported, though the now untested “classic” continues to work for many applications.

  • 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 through conda 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 or conda install gcp-correction -c conda-forge.

  • To remove a conda installation, conda remove gcp or conda remove gcp-correction.

Source

  • https://img.shields.io/badge/home-gCP-5077AB.svg
  • 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], “PBEh-3c” [Grimme:2015:054107], “B97-3c” [Brandenburg:2018:b973c], “r2SCAN-3c” [Grimme:2021:064103], and “wB97X-3c” [Muller:2023:014103] methods (both energy and gradient). The interface can use classic or mctc-gcp executables but only the latter implements “B97-3c” and “r2SCAN-3c”. The newest wB97X-3c method doesn’t use a gcp correction (it does use ECPs down to first row elements) but is listed here for completeness of the “3c” family. A DFTD3 executable, classic or simple-dftd3, must also be available for the HF-3c, PBEh-3c, or B97-3c methods to run. A DFTD4 python module must also be available for the r2SCAN-3c or wB97X-3c methods to run. These method are defined with their own basis set and thus no basis set should be set by the user. PSI4 will select the intended basis sets: HF-3c/MINIX, PBEh-3c/def2-mSVP, B97-3c/def2-mTZVP, r2SCAN-3c/def2-mTZVPP, wB97X-3c/vDZP. If a basis has previously been set for another calculation, 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')
    
  • r2SCAN-3c with default basis after basis set

    set basis cc-pvdz
    energy('r2scan3c/')
    

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 or PSIPATH. 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].