vibeqc.compute_d4

vibeqc.compute_d4(mol, functional, *, charge=0.0, with_gradient=False, backend='dftd4', ref_data_path=None)[source]

D4 dispersion correction (Caldeweyher et al. 2019).

Parameters:
  • mol (vibeqc._vibeqc_core.Molecule) – vibeqc.Molecule. Atomic positions in bohr.

  • functional (str) – Lowercase functional name ("b2plyp", "dsd-pbep86", "b3lyp", "pbe0", "pw1pw", …). For the dftd4 backend, anything the reference library catalogs is accepted. For the native backend, the name is looked up in vibeqc.dispersion_d4_parameters.

  • charge (float) – Total molecular charge. D4 includes a charge-dependent C6 scaling (the main upgrade over D3). Default 0.0 (neutral).

  • with_gradient (bool) – When True, the returned D4Result carries the (n_atoms, 3) gradient of E_disp in Hartree/bohr.

  • backend (str) – "dftd4" (default, requires optional dependency) or "native" (Phase D4b, requires generated reference dataset).

  • ref_data_path (str | None) – Path to a JSON reference dataset file for the native backend. If None, looks for VIBEQC_D4_REFDATA env var, then d4_reference_data.json in the current directory.

Return type:

D4Result

Raises:
  • ImportError – If backend="dftd4" and the optional dftd4 package is not installed.

  • FileNotFoundError – If backend="native" and no reference dataset can be found.

  • RuntimeError – If dftd4 does not recognise the requested functional (re-raised from dftd4.interface with a clearer message).