# Interface to gCP by S. Grimme

Code author: Lori A. Burns

Section author: Lori A. Burns

Module: Samples

## Installation

Binary

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

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`) 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

      1
      energy('hf3c')

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

      1
      optimize('pbeh3c')

- HF-3c with non-standard basis

      1
      2
      set basis cc-pvdz
      energy('hf3c')

- PBEh-3c with default basis after basis set

      1
      2
      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.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    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.interface_gcp.``run_gcp`(self, func=None, dertype=None, verbose=False)

  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.