pub struct D4Model {
pub nat: usize,
pub elements: Vec<u8>,
pub cn: Vec<f64>,
/* private fields */
}Expand description
Pre-computed self-consistent D4 model.
Created once before the SCC loop, holds the dispersion matrix and
coordination numbers. At each SCC iteration, call weight_references
with current charges, then get_potential and get_energy.
Fields§
§nat: usize§elements: Vec<u8>§cn: Vec<f64>D4 coordination numbers (electronegativity-weighted, DFT-D3 type).
Implementations§
Source§impl D4Model
impl D4Model
Sourcepub fn new(elements: &[u8], positions: &[[f64; 3]]) -> Self
pub fn new(elements: &[u8], positions: &[[f64; 3]]) -> Self
Create a new D4 model for the given molecular geometry.
Computes D4 coordination numbers, scaled reference polarizabilities, reference C6 coefficients, and the BJ-damped dispersion matrix.
Sourcepub fn weight_references(&self, charges: &[f64]) -> D4Weights
pub fn weight_references(&self, charges: &[f64]) -> D4Weights
Compute reference weights from coordination numbers and charges.
This implements weight_references from dftd4, computing gwvec and dgwdq
for each atom and reference using CN-dependent Gaussian weighting with
charge-dependent zeta scaling.
Sourcepub fn get_potential(&self, weights: &D4Weights) -> Vec<f64>
pub fn get_potential(&self, weights: &D4Weights) -> Vec<f64>
Compute the D4 atom-resolved potential for the Fock matrix.
Returns vat[iat] to be added to pot%vat (atom-resolved charge potential). Formula: vat[iat] = Σ_iref Σ_jat Σ_jref dispmat[iref,iat,jref,jat] * dgwdq[iat][iref] * gwvec[jat][jref]
This is the ncoup=1 (atom-wise weighting) path from tblite.
Sourcepub fn get_energy(&self, weights: &D4Weights) -> f64
pub fn get_energy(&self, weights: &D4Weights) -> f64
Compute the self-consistent D4 pairwise dispersion energy.
E_disp = 0.5 * Σ_iat Σ_iref Σ_jat Σ_jref gwvec[iat][iref] * dispmat * gwvec[jat][jref]
Sourcepub fn get_atm_energy(&self, positions: &[[f64; 3]]) -> f64
pub fn get_atm_energy(&self, positions: &[[f64; 3]]) -> f64
Compute ATM three-body dispersion energy (non-SC, uses q=0 weights).
This is the get_engrad / get_dispersion3 path from tblite,
evaluated with zero charges.
Auto Trait Implementations§
impl Freeze for D4Model
impl RefUnwindSafe for D4Model
impl Send for D4Model
impl Sync for D4Model
impl Unpin for D4Model
impl UnsafeUnpin for D4Model
impl UnwindSafe for D4Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.