Skip to main content

DFTD3Param

Struct DFTD3Param 

Source
pub struct DFTD3Param { /* private fields */ }
Expand description

Basic struct for damping parameters, representing a parametrization of a DFT-D3 method.

The damping parameters contained in the object are immutable. To change the parametrization, a new object must be created. Furthermore, the object is opaque to the user and the contained data cannot be accessed directly.

§Note

This struct is better not be initialized by user. Structs that implements DFTD3ParamAPI should be used for parameter initialization.

This struct is considered as a low-level parameter interface. This object does not have its official python wrapper correspondent. So use this struct with caution.

Official python wrapper provides (not exactly) abstract class DampingParam, which corresponds DFTD3ParamAPI in this project.

Implementations§

Source§

impl DFTD3Param

Source

pub fn new_zero_damping_f( s6: f64, s8: f64, s9: f64, rs6: f64, rs8: f64, alp: f64, ) -> Result<Self, DFTD3Error>

Create new zero damping parameters (failable)

Source

pub fn new_zero_damping( s6: f64, s8: f64, s9: f64, rs6: f64, rs8: f64, alp: f64, ) -> Self

Create new zero damping parameters

Examples found in repository?
examples/energy_r2scan_d3zero.rs (lines 66-73)
5fn main_test() {
6    // atom indices
7    let numbers = vec![6, 6, 6, 6, 6, 6, 53, 1, 1, 1, 1, 1, 16, 1, 6, 1, 1, 1];
8    // geometry in angstrom
9    #[rustfmt::skip]
10    let positions = vec![
11        -0.755422531,  -0.796459123,  -1.023590391,
12         0.634274834,  -0.880017014,  -1.075233285,
13         1.406955202,   0.199695367,  -0.653144334,
14         0.798863737,   1.361204515,  -0.180597909,
15        -0.593166787,   1.434312023,  -0.133597923,
16        -1.376239198,   0.359205222,  -0.553258516,
17        -1.514344238,   3.173268101,   0.573601106,
18         1.110906949,  -1.778801728,  -1.440619836,
19         1.399172302,   2.197767355,   0.147412751,
20         2.486417780,   0.142466525,  -0.689380574,
21        -2.454252250,   0.422581120,  -0.512807958,
22        -1.362353593,  -1.630564523,  -1.348743149,
23        -3.112683203,   6.289227834,   1.226984439,
24        -4.328789697,   5.797771251,   0.973373089,
25        -2.689135032,   6.703163830,  -0.489062886,
26        -1.684433029,   7.115457372,  -0.460265708,
27        -2.683867206,   5.816530502,  -1.115183775,
28        -3.365330613,   7.451201412,  -0.890098894,
29    ];
30    // convert angstrom to bohr
31    let positions = positions.iter().map(|&x| x / 0.52917721067).collect::<Vec<f64>>();
32    // generate DFTD3 model
33    let model = DFTD3Model::new(&numbers, &positions, None, None);
34    // explicitly set DFTD3 parameters
35    for atm in [true, false] {
36        let energy_ref = if atm { -0.01410721853585842 } else { -0.014100267345314462 };
37
38        let param = DFTD3ZeroDampingParamBuilder::default()
39            .s8(1.683)
40            .rs6(1.139)
41            .s9(if atm { 1.0 } else { 0.0 })
42            .init();
43        // obtain the dispersion energy without gradient and sigma
44        let (energy, _, _) = model.get_dispersion(&param, false).into();
45
46        println!("Dispersion energy: {}", energy);
47        assert!((energy - energy_ref).abs() < 1e-9);
48
49        // this way to provide custom damping parameter is also valid
50        let param = DFTD3ZeroDampingParam {
51            s6: 1.0,
52            s8: 1.683,
53            rs6: 1.139,
54            rs8: 1.0,
55            alp: 14.0,
56            s9: if atm { 1.0 } else { 0.0 },
57        };
58        let param = param.new_param();
59        // obtain the dispersion energy without gradient and sigma
60        let (energy, _, _) = model.get_dispersion(&param, false).into();
61
62        println!("Dispersion energy: {}", energy);
63        assert!((energy - energy_ref).abs() < 1e-9);
64
65        // this way to provide custom damping parameter is also valid
66        let param = DFTD3Param::new_zero_damping(
67            1.0,                         // s6
68            1.683,                       // s8
69            if atm { 1.0 } else { 0.0 }, // s9
70            1.139,                       // rs6
71            1.0,                         // rs8
72            14.0,                        // alp
73        );
74        // obtain the dispersion energy without gradient and sigma
75        let (energy, _, _) = model.get_dispersion(&param, false).into();
76
77        println!("Dispersion energy: {}", energy);
78        assert!((energy - energy_ref).abs() < 1e-9);
79    }
80}
Source

pub fn load_zero_damping_f(method: &str, atm: bool) -> Result<Self, DFTD3Error>

Load zero damping parameters from internal storage (failable)

Source

pub fn load_zero_damping(method: &str, atm: bool) -> Self

Load zero damping parameters from internal storage

Source

pub fn new_rational_damping_f( s6: f64, s8: f64, s9: f64, a1: f64, a2: f64, alp: f64, ) -> Result<Self, DFTD3Error>

Create new rational damping parameters (failable)

Source

pub fn new_rational_damping( s6: f64, s8: f64, s9: f64, a1: f64, a2: f64, alp: f64, ) -> Self

Create new rational damping parameters

Source

pub fn load_rational_damping_f( method: &str, atm: bool, ) -> Result<Self, DFTD3Error>

Load rational damping parameters from internal storage (failable)

Source

pub fn load_rational_damping(method: &str, atm: bool) -> Self

Load rational damping parameters from internal storage

Source

pub fn new_mzero_damping_f( s6: f64, s8: f64, s9: f64, rs6: f64, rs8: f64, alp: f64, bet: f64, ) -> Result<Self, DFTD3Error>

Create new modified zero damping parameters (failable)

Source

pub fn new_mzero_damping( s6: f64, s8: f64, s9: f64, rs6: f64, rs8: f64, alp: f64, bet: f64, ) -> Self

Create new modified zero damping parameters

Source

pub fn load_mzero_damping_f(method: &str, atm: bool) -> Result<Self, DFTD3Error>

Load modified zero damping parameters from internal storage (failable)

Source

pub fn load_mzero_damping(method: &str, atm: bool) -> Self

Load modified zero damping parameters from internal storage

Source

pub fn new_mrational_damping_f( s6: f64, s8: f64, s9: f64, a1: f64, a2: f64, alp: f64, ) -> Result<Self, DFTD3Error>

Create new modified rational damping parameters (failable)

Source

pub fn new_mrational_damping( s6: f64, s8: f64, s9: f64, a1: f64, a2: f64, alp: f64, ) -> Self

Create new modified rational damping parameters

Source

pub fn load_mrational_damping_f( method: &str, atm: bool, ) -> Result<Self, DFTD3Error>

Load modified rational damping parameters from internal storage (failable)

Source

pub fn load_mrational_damping(method: &str, atm: bool) -> Self

Load modified rational damping parameters from internal storage

Source

pub fn new_optimizedpower_damping_f( s6: f64, s8: f64, s9: f64, a1: f64, a2: f64, alp: f64, bet: f64, ) -> Result<Self, DFTD3Error>

Create new optimized damping parameters (failable)

Source

pub fn new_optimizedpower_damping( s6: f64, s8: f64, s9: f64, a1: f64, a2: f64, alp: f64, bet: f64, ) -> Self

Create new optimized damping parameters

Source

pub fn load_optimizedpower_damping_f( method: &str, atm: bool, ) -> Result<Self, DFTD3Error>

Load optimized damping parameters from internal storage (failable)

Source

pub fn load_optimizedpower_damping(method: &str, atm: bool) -> Self

Load optimized damping parameters from internal storage

Source

pub fn new_cso_damping_f( s6: f64, s9: f64, a1: f64, a2: f64, a3: f64, a4: f64, alp: f64, ) -> Result<Self, DFTD3Error>

Create new CSO damping parameters (failable)

Source

pub fn new_cso_damping( s6: f64, s9: f64, a1: f64, a2: f64, a3: f64, a4: f64, alp: f64, ) -> Self

Create new CSO damping parameters

Source

pub fn load_cso_damping_f(method: &str, atm: bool) -> Result<Self, DFTD3Error>

Load CSO damping parameters from internal storage (failable)

Source

pub fn load_cso_damping(method: &str, atm: bool) -> Self

Load CSO damping parameters from internal storage

Trait Implementations§

Source§

impl Drop for DFTD3Param

Source§

fn drop(&mut self)

Executes the destructor for this type. 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> 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, 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.