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 Psi4conda installer, gCP has already been installed alongside.

  • If using the PSI4 conda package, the gcp conda package can be obtained through conda install gcp -c psi4 or conda install psi4-rt -c psi4.

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

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

  • func (str, optional) – 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 (int or str, optional) – 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, optional) – Amount of printing. Unused at present.


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