xnn.common.models.d4.D4Dispersion#

class xnn.common.models.d4.D4Dispersion(model=None, **d4_options)[source]#

Bases: DispersionCorrection

DFT-D4 dispersion as an xnn potential, standalone or wrapped around a model.

Standalone (model=None) it is the pure D4 dispersion energy – what dftd4 computes – and is registered as the model "d4". Given a short-range model it adds the D4 energy to that model’s prediction (see DispersionCorrection for the wrapper semantics). Enable from a config with model.extra["dispersion"] or wrap directly:

model = D4Dispersion(build_model(cfg.model), cutoff_pair=12.0,
                     switch_width_pair=2.0)
out = ForceStressOutput(model, compute_stress=True)(graph)
Parameters:
  • model (InteratomicPotential or None, optional) – The short-range model to correct; None for pure dispersion.

  • **d4_options – Keyword arguments of DFTD4 (damping parameters, cutoffs, switching widths, trainable).

Variables:

d4 (DFTD4) – The dispersion evaluator (alias of term).

Notes

Besides the wrapper’s common outputs, forward adds the per-atom "eeq_charges", "polarizabilities" and "dynamic_polarizabilities"; standalone, "node_features" is the per-atom (CN, EEQ charge, static polarizability) triple.

property d4: DFTD4#

The DFTD4 evaluator.

classmethod from_config(cfg)[source]#

Build a standalone D4 model; options are read from cfg.extra.

Recognized keys are the DFTD4 arguments (s6, s8, a1, a2, s9, alp, ga, gc, wf, cutoff_pair, cutoff_triple, cutoff_cn, cutoff_eeq_cn, switch_width_pair, switch_width_triple, trainable). cfg.cutoff is ignored: the neighbor-list radius follows from the D4 cutoffs. To correct another model with D4 put the same keys under that model’s extra["dispersion"] instead.

Return type:

D4Dispersion