Skip to main content

D4Model

Struct D4Model 

Source
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

Source

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.

Source

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.

Source

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.

Source

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]

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V