# Basis Set Superposition Corrections

Code author: Daniel G. A. Smith

`psi4.driver.driver_nbody.``nbody_gufunc`(func, method_string[, molecule, bsse_type, max_nbody, ptype, return_total_data])

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

  Returns: | return type of func – The data.
  Returns: | (float, `Wavefunction`) – data and wavefunction with energy/gradient/hessian set appropriately when return_wfn specified.

  Parameters:

  - func (function) –

    `energy` || etc.

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

  - method_string (string) –

    `'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 (string or list) –

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

    Type of BSSE correction to compute: CP, NoCP, or VMFC. The first in this list is 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 moleucle.

  - ptype (string) –

    `'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/etc) of the system, otherwise returns interaction data.

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

  - 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 (string) –

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

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

  - charge_type (string) –

    `MULLIKEN_CHARGES` || `LOWDIN_CHARGES`

    Default is `MULLIKEN_CHARGES`

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 :

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22

    # Counterpoise corrected CCSD(T) energy for the Helium dimer
    molecule mol {
      He
      --
      He 1 3
    }

    energy('CCSD(T)', bsse_type='cp')

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