EmpiricalDispersion

class psi4.driver.EmpiricalDispersion(*, name_hint=None, level_hint=None, param_tweaks=None, engine=None, gcp_engine=None, save_pairwise_disp=False)[source]

Bases: object

Lightweight unification of empirical dispersion calculation modes.

dashlevel

{“d1”, “d2”, “chg”, “das2009”, “das2010”, “nl”, “dmp2”, “d3zero2b”, “d3bj2b”, “d3mzero2b”, “d3mbj2b”, “d3zeroatm”, “d3bjatm”, “d3mzeroatm”, “d3mbjatm”, “d4bjeeqatm”} Name of dispersion correction to be applied. Resolved from name_hint and/or level_hint into a key of empirical_dispersion_resources.dashcoeff.

Type:

str

dashparams

Complete set of parameter values defining the flexible parts of dashlevel. Number and parameter names vary by dashlevel. Resolved into a complete set (keys of dashcoeff[dashlevel][‘default’]) from name_hint and/or dashcoeff_supplement and/or user param_tweaks.

Type:

dict

fctldash

If dashparams for dashlevel corresponds to a defined, named, untweaked “functional-dashlevel” set, then that functional. Otherwise, empty string.

Type:

str

description

Tagline for dispersion dashlevel.

Type:

str

dashlevel_citation

Literature reference for dispersion dashlevel in general, not necessarily for dashparams.

Type:

str

dashparams_citation

Literature reference for dispersion parameters, if dashparams corresponds to a defined, named, untweaked “functional-dashlevel” set with a citation. Otherwise, empty string.

Type:

str

dashcoeff_supplement

See description in qcengine.programs.empirical_dispersion_resources.from_arrays. Used here to “bless” the dispersion definitions attached to the procedures/dft/<rung>_functionals-defined dictionaries as legit, non-custom, and of equal validity to qcengine.programs.empirical_dispersion_resources.dashcoeff itself for purposes of validating fctldash.

Type:

dict

engine

{‘libdisp’, “s-dftd3”, ‘dftd3’, ‘nl’, ‘mp2d’, “dftd4”} Compute engine for dispersion. One of Psi4’s internal libdisp library, external Grimme or Beran projects, or nl.

Type:

str

disp

Only present for engine =libdisp. Psi4 class instance prepared to compute dispersion.

Type:

Dispersion

ordered_params

Fixed-order list of relevant parameters for dashlevel. Matches DISPERSION CORRECTION ENERGY ordering. Used for printing.

Type:

list

Parameters:
  • name_hint (Optional[str]) – Name of functional (func only, func & disp, or disp only) for which to compute dispersion (e.g., blyp, BLYP-D2, blyp-d3bj, blyp-d3(bj), hf+d). Any or all parameters initialized from dashcoeff[dashlevel][functional-without-dashlevel] or dashcoeff_supplement[dashlevel][functional-with-dashlevel] can be overwritten via param_tweaks.

  • level_hint (Optional[str]) – Name of dispersion correction to be applied (e.g., d, D2, d3(bj), das2010). Must be key in dashcoeff or “alias” or “formal” to one.

  • param_tweaks (Union[Dict, List, None]) – Values for the same keys as dashcoeff[dashlevel][‘default’] (and same order if list) used to override any or all values initialized by name_hint. Extra parameters will error.

  • engine (Optional[str]) – Override which code computes dispersion. See above for allowed values. Formerly (pre Nov 2022) only relevant for -D2, which can be computed by libdisp or dftd3. Now (post Nov 2022) also relevant for -D3 variants, which can be computed by dftd3 executable or simple-dftd3 Python module.

  • gcp_engine (Optional[str]) – Override which code computes the gcp correction. Now can use classic gcp or mctc-gcp executables.

  • save_pairwise_disp (bool) – Whether to request atomic pairwise analysis.

Methods Summary

compute_energy(molecule[, wfn])

Compute dispersion energy based on engine, dispersion level, and parameters in self.

compute_gradient(molecule[, wfn])

Compute dispersion gradient based on engine, dispersion level, and parameters in self.

compute_hessian(molecule[, wfn])

Compute dispersion Hessian based on engine, dispersion level, and parameters in self.

print_out()

Format dispersion parameters of self for output file.

Methods Documentation

compute_energy(molecule, wfn=None)[source]

Compute dispersion energy based on engine, dispersion level, and parameters in self.

Parameters:
  • molecule (Molecule) – System for which to compute empirical dispersion correction.

  • wfn (Optional[Wavefunction]) – Location to set QCVariables

Returns:

Dispersion energy [Eh].

Return type:

float

Notes

DISPERSION CORRECTION ENERGY

Disp always set. Overridden in SCF finalization, but that only changes for “-3C” methods.

fctl DISPERSION CORRECTION ENERGY

Set if fctldash nonempty.

compute_gradient(molecule, wfn=None)[source]

Compute dispersion gradient based on engine, dispersion level, and parameters in self.

Parameters:
  • molecule (Molecule) – System for which to compute empirical dispersion correction.

  • wfn (Optional[Wavefunction]) – Location to set QCVariables

Returns:

(nat, 3) dispersion gradient [Eh/a0].

Return type:

Matrix

compute_hessian(molecule, wfn=None)[source]

Compute dispersion Hessian based on engine, dispersion level, and parameters in self. Uses finite difference, as no dispersion engine has analytic second derivatives.

Parameters:
  • molecule (Molecule) – System for which to compute empirical dispersion correction.

  • wfn (Optional[Wavefunction]) – Location to set QCVariables

Returns:

(3*nat, 3*nat) dispersion Hessian [Eh/a0/a0].

Return type:

Matrix

print_out()[source]

Format dispersion parameters of self for output file.