Basis Set Superposition Corrections

Code author: Daniel G. A. Smith

psi4.driver.driver_nbody.nbody_gufunc(func, method_string, **kwargs)[source]

Computes the nbody interaction energy, gradient, or Hessian depending on input. This is a generalized universal function for computing interaction and total quantities.


return type of func – The data.


(float, Wavefunction) – data and wavefunction with energy/gradient/hessian set appropriately when return_wfn specified.

  • func (Union[str, Callable]) –

    energy || etc.

    Python function that accepts method_string and a molecule. Returns a energy, gradient, or Hessian as requested.

  • method_string (str) –

    'scf' || 'mp2' || 'ci5' || etc.

    First argument, lowercase and usually unlabeled. Indicates the computational method to be passed to func.

  • molecule (molecule) –

    h2o || etc.

    The target molecule, if not the last molecule defined.

  • return_wfn (boolean) –

    'on' || \(\Rightarrow\) 'off' \(\Leftarrow\)

    Indicate to additionally return the Wavefunction calculation result as the second element of a tuple.

  • bsse_type (str or list) –

    'cp' || ['nocp', 'vmfc'] || \(\Rightarrow\) None \(\Leftarrow\) || etc.

    Type of BSSE correction to compute: CP for counterpoise correction, NoCP for plain supramolecular interaction energy, or VMFC for Valiron-Mayer Function Counterpoise correction. If a list is provided, the first string in the list determines which interaction or total energies/gradients/Hessians are returned by this function. By default, this function is not called.

  • max_nbody (int) –

    3 || etc.

    Maximum n-body to compute, cannot exceed the number of fragments in the molecule.

  • ptype (str) –

    'energy' || 'gradient' || 'hessian'

    Type of the procedure passed in.

  • return_total_data (boolean) –

    'on' || \(\Rightarrow\) 'off' \(\Leftarrow\)

    If True returns the total data (energy/gradient/Hessian) of the system, otherwise returns interaction data. Default is 'off' for energies, 'on' for gradients and Hessians. Note that the calculation of total counterpoise corrected energies implies the calculation of the energies of monomers in the monomer basis, hence specifying return_total_data = True may carry out more computations than return_total_data = False.

  • levels (dict) –

    {1: 'ccsd(t)', 2: 'mp2', 'supersystem': 'scf'} || {1: 2, 2: 'ccsd(t)', 3: 'mp2'} || etc

    Dictionary of different levels of theory for different levels of expansion Note that method_string is not used in this case. supersystem computes all higher order n-body effects up to the number of fragments.

  • embedding_charges (dict) –

    {1: [-0.834, 0.417, 0.417], ..}

    Dictionary of atom-centered point charges. keys: 1-based index of fragment, values: list of charges for each fragment.

  • charge_method (str) –

    scf/6-31g || b3lyp/6-31g* || etc

    Method to compute point charges for monomers. Overridden by embedding_charges if both are provided.

  • charge_type (str) –



The nbody function computes counterpoise-corrected (CP), non-CP (noCP), and Valiron-Mayer Function Counterpoise (VMFC) interaction energies for complexes composed of arbitrary numbers of monomers.

Examples :

# Counterpoise corrected CCSD(T) energies for the Helium dimer
molecule mol {
  He 1 3
# Calculate interaction energies only (skips monomers in monomer basis):
energy('CCSD(T)', bsse_type='cp')
# Calculate interaction and total energies, return interaction energies:
energy('CCSD(T)', bsse_type=['cp','nocp'])
# Calculate and return counterpoise-corrected gradient
# Useful for e.g. CP-corrected geometry optimization
gradient('CCSD(T)', bsse_type='cp', return_total_data=True)

# noCP, VMFC, and CP energy for a helium cluster, limited at 3 bodies
molecule mol {
  He 0 0 0
  He 0 0 4
  He 0 4 0
  He 4 0 0

# Returns the nocp energy as its first in the list
energy('CCSD(T)', bsse_type=['nocp', 'cp', 'vmfc'], max_nbody=3)