xnn.common.models.d4.D4Dispersion#
- class xnn.common.models.d4.D4Dispersion(model=None, **d4_options)[source]#
Bases:
DispersionCorrectionDFT-D4 dispersion as an xnn potential, standalone or wrapped around a model.
Standalone (
model=None) it is the pure D4 dispersion energy – whatdftd4computes – and is registered as the model"d4". Given a short-rangemodelit adds the D4 energy to that model’s prediction (seeDispersionCorrectionfor the wrapper semantics). Enable from a config withmodel.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;
Nonefor 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,
forwardadds the per-atom"eeq_charges","polarizabilities"and"dynamic_polarizabilities"; standalone,"node_features"is the per-atom (CN, EEQ charge, static polarizability) triple.- classmethod from_config(cfg)[source]#
Build a standalone D4 model; options are read from
cfg.extra.Recognized keys are the
DFTD4arguments (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.cutoffis ignored: the neighbor-list radius follows from the D4 cutoffs. To correct another model with D4 put the same keys under that model’sextra["dispersion"]instead.- Return type: