Interface to gCP by S. Grimme

Code author: Lori A. Burns

Section author: Lori A. Burns

Module: Samples



  • gCP is available as a conda package for Linux and macOS (and Windows, through the Ubuntu shell).

  • If using the PSI4 binary, gCP has already been installed alongside.

  • 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.

  • To remove a conda installation, conda remove gcp.


  • 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) must be found in your PSIPATH or PATH (in that order). 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 DFTD3 executable 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

  • PBEh-3c optimization with default def2-mSVP basis

  • HF-3c with non-standard basis

    set basis cc-pvdz
  • PBEh-3c with default basis after basis set

    set basis cc-pvdz

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 1 2.0


>>> E, G = nene.run_gcp('hf3c')

>>> E, G = nene.run_gcp(func='HF3c', verbose=True)
qcdb.interface_gcp.run_gcp(self, func=None, dertype=None, verbose=False)[source]

Function to call Grimme’s dftd3 program ( to compute the -D correction of level dashlvl using parameters for the functional func. The dictionary dashparam can be used to supply a full set of dispersion parameters in the absense of func or to supply individual overrides in the presence of func. Returns energy if dertype is 0, gradient if dertype is 1, else tuple of energy and gradient if dertype unspecified. The dftd3 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.