DFTD4RationalDampingParam

Struct DFTD4RationalDampingParam 

Source
pub struct DFTD4RationalDampingParam {
    pub s6: f64,
    pub s8: f64,
    pub s9: f64,
    pub a1: f64,
    pub a2: f64,
    pub alp: f64,
}
Expand description

DFTD4 rational damping parameters.

§API documentation for custom damping parameter specification

If your task is to retrive damping parameters of some specific xc-functionals, you may wish to try DFTD4Param::load_rational_damping function.

In this crate, you may have three ways to define customized parameters:

  • By DFTD4RationalDampingParam struct. In this way, all parameters (include optional parameters with default value) must be provided. For example:

    let param = DFTD4RationalDampingParam {
        s6: 1.0,
        s8: 1.683,
        s9: 1.0,
        a1: 1.139,
        a2: 1.5,
        alp: 16.0,
    };
    let param = param.new_param();
    // this will give param: DFTD4Param
  • By DFTD4RationalDampingParamBuilder struct. In this way, optional parameters can be omitted. For example:

    let param = DFTD4RationalDampingParamBuilder::default()
        .s8(1.683)
        .a1(1.139)
        .a2(1.5)
        .init();
    // this will give param: DFTD4Param
  • By DFTD4Param utility. In this way, all parameters must be provided. For example of B3-Zero:

    let param = DFTD4Param::new_rational_damping(
        1.0,   // s6
        1.683, // s8
        1.0,   // s9
        1.139, // a1
        1.0,   // a2
        16.0,  // alp
    );

Fields§

§s6: f64

optional, default 1.0

§s8: f64§s9: f64

optional, default 1.0

§a1: f64§a2: f64§alp: f64

optional, default 16.0

Implementations§

Source§

impl DFTD4RationalDampingParam

Source

pub fn new_param(self) -> DFTD4Param

Examples found in repository?
examples/test_interface.rs (line 295)
248fn test_pair_resolved() {
249    // Calculate pairwise resolved dispersion energy for a molecule
250    let thr = 1.0e-8;
251
252    let numbers = vec![16, 16, 16, 16, 16, 16, 16, 16];
253    #[rustfmt::skip]
254    let positions = vec![
255        -4.15128787379191,  1.71951973863958, -0.93066267097296,
256        -4.15128787379191, -1.71951973863958,  0.93066267097296,
257        -1.71951973863958, -4.15128787379191, -0.93066267097296,
258         1.71951973863958, -4.15128787379191,  0.93066267097296,
259         4.15128787379191, -1.71951973863958, -0.93066267097296,
260         4.15128787379191,  1.71951973863958,  0.93066267097296,
261         1.71951973863958,  4.15128787379191, -0.93066267097296,
262        -1.71951973863958,  4.15128787379191,  0.93066267097296,
263    ];
264    #[rustfmt::skip]
265    let pair_disp2 = vec![
266        -0.00000000e-0, -5.80599854e-4, -4.74689854e-4, -2.11149449e-4, -1.63163128e-4, -2.11149449e-4, -4.74689854e-4, -5.80599854e-4,
267        -5.80599854e-4, -0.00000000e-0, -5.80599854e-4, -4.74689854e-4, -2.11149449e-4, -1.63163128e-4, -2.11149449e-4, -4.74689854e-4,
268        -4.74689854e-4, -5.80599854e-4, -0.00000000e-0, -5.80599854e-4, -4.74689854e-4, -2.11149449e-4, -1.63163128e-4, -2.11149449e-4,
269        -2.11149449e-4, -4.74689854e-4, -5.80599854e-4, -0.00000000e-0, -5.80599854e-4, -4.74689854e-4, -2.11149449e-4, -1.63163128e-4,
270        -1.63163128e-4, -2.11149449e-4, -4.74689854e-4, -5.80599854e-4, -0.00000000e-0, -5.80599854e-4, -4.74689854e-4, -2.11149449e-4,
271        -2.11149449e-4, -1.63163128e-4, -2.11149449e-4, -4.74689854e-4, -5.80599854e-4, -0.00000000e-0, -5.80599854e-4, -4.74689854e-4,
272        -4.74689854e-4, -2.11149449e-4, -1.63163128e-4, -2.11149449e-4, -4.74689854e-4, -5.80599854e-4, -0.00000000e-0, -5.80599854e-4,
273        -5.80599854e-4, -4.74689854e-4, -2.11149449e-4, -1.63163128e-4, -2.11149449e-4, -4.74689854e-4, -5.80599854e-4, -0.00000000e-0,
274    ];
275    #[rustfmt::skip]
276    let pair_disp3 = vec![
277        0.00000000e-0, 3.39353850e-7, 8.74462839e-7, 1.17634100e-6, 9.86937310e-7, 1.17634100e-6, 8.74462839e-7, 3.39353850e-7,
278        3.39353850e-7, 0.00000000e-0, 3.39353850e-7, 8.74462839e-7, 1.17634100e-6, 9.86937310e-7, 1.17634100e-6, 8.74462839e-7,
279        8.74462839e-7, 3.39353850e-7, 0.00000000e-0, 3.39353850e-7, 8.74462839e-7, 1.17634100e-6, 9.86937310e-7, 1.17634100e-6,
280        1.17634100e-6, 8.74462839e-7, 3.39353850e-7, 0.00000000e-0, 3.39353850e-7, 8.74462839e-7, 1.17634100e-6, 9.86937310e-7,
281        9.86937310e-7, 1.17634100e-6, 8.74462839e-7, 3.39353850e-7, 0.00000000e-0, 3.39353850e-7, 8.74462839e-7, 1.17634100e-6,
282        1.17634100e-6, 9.86937310e-7, 1.17634100e-6, 8.74462839e-7, 3.39353850e-7, 0.00000000e-0, 3.39353850e-7, 8.74462839e-7,
283        8.74462839e-7, 1.17634100e-6, 9.86937310e-7, 1.17634100e-6, 8.74462839e-7, 3.39353850e-7, 0.00000000e-0, 3.39353850e-7,
284        3.39353850e-7, 8.74462839e-7, 1.17634100e-6, 9.86937310e-7, 1.17634100e-6, 8.74462839e-7, 3.39353850e-7, 0.00000000e-0,
285    ];
286
287    let model = DFTD4Model::new(&numbers, &positions, None, None, None);
288
289    let param = DFTD4RationalDampingParamBuilder::default()
290        .s8(1.20065498)
291        .a1(0.40085597)
292        .a2(5.02928789)
293        .build()
294        .unwrap()
295        .new_param();
296    let res = model.get_pairwise_dispersion(&param);
297
298    for (a, b) in res.pair_energy2.iter().zip(pair_disp2.iter()) {
299        assert_abs_diff_eq!(a, b, epsilon = thr);
300    }
301
302    for (a, b) in res.pair_energy3.iter().zip(pair_disp3.iter()) {
303        assert_abs_diff_eq!(a, b, epsilon = thr);
304    }
305}
Source

pub fn new_param_f(self) -> Result<DFTD4Param, DFTD4Error>

Trait Implementations§

Source§

impl Clone for DFTD4RationalDampingParam

Source§

fn clone(&self) -> DFTD4RationalDampingParam

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DFTD4RationalDampingParam

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.