gosh_dimer/
lib.rs

1// [[file:../dimer.note::c6f8257d][c6f8257d]]
2mod cg;
3mod dimer;
4mod fourier;
5mod options;
6mod raw;
7mod rotation;
8mod translation;
9
10#[cfg(test)]
11mod test;
12// c6f8257d ends here
13
14// [[file:../dimer.note::1e3853ed][1e3853ed]]
15// #![deny(warnings)]
16
17use gut::prelude::*;
18use std::f64::consts::PI;
19use vecfx::*;
20
21type DVector = nalgebra::DVector<f64>;
22
23use raw::*;
24// 1e3853ed ends here
25
26// [[file:../dimer.note::3da305d7][3da305d7]]
27/// The trait for evaluation of potential surface required in DIMER algorithm
28pub trait EvaluateDimer {
29    /// Get current position
30    fn position(&self) -> &[f64];
31
32    /// Update current position
33    fn set_position(&mut self, position: &[f64]);
34
35    /// Get energy of potential at current position
36    fn get_energy(&mut self) -> Result<f64>;
37
38    /// Get force of potential at current position
39    fn get_force(&mut self) -> Result<&[f64]>;
40}
41// 3da305d7 ends here
42
43// [[file:../dimer.note::a7df26ce][a7df26ce]]
44/// Main entry point for DIMER algorithm
45pub struct Dimer {
46    /// Dimer algorithm parameters
47    pub vars: UserOptions,
48}
49
50impl Dimer {
51    /// Construct a dimer for optimization.
52    pub fn new() -> Self {
53        Self {
54            vars: UserOptions::default(),
55        }
56    }
57}
58
59pub use crate::dimer::*;
60pub use options::UserOptions;
61// a7df26ce ends here
62
63// [[file:../dimer.note::cfd3ba0e][cfd3ba0e]]
64#[cfg(feature = "adhoc")]
65/// Docs for local mods
66pub mod docs {
67    macro_rules! export_doc {
68        ($l:ident) => {
69            pub mod $l {
70                pub use crate::$l::*;
71            }
72        };
73    }
74
75    export_doc!(raw);
76    export_doc!(fourier);
77    export_doc!(options);
78    export_doc!(rotation);
79    export_doc!(translation);
80    export_doc!(cg);
81}
82// cfd3ba0e ends here