Skip to main content

dreid_forge/forge/config/
potential.rs

1//! Potential energy function type configurations.
2//!
3//! This module defines the available (configurable) functional forms
4//! of potential energy terms in the DREIDING force field.
5
6/// Bond stretching potential function type.
7///
8/// Determines the functional form used for bond stretching terms
9/// in the force field. Both options use the same equilibrium bond
10/// length but differ in behavior far from equilibrium.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
12pub enum BondPotentialType {
13    /// Harmonic bond potential.
14    #[default]
15    Harmonic,
16
17    /// Morse anharmonic potential.
18    Morse,
19}
20
21/// Angle bending potential function type.
22///
23/// Determines the functional form used for angle bending terms.
24/// The choice affects behavior especially for linear or near-linear
25/// angles.
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
27pub enum AnglePotentialType {
28    /// Cosine-harmonic or cosine-linear angle potential.
29    #[default]
30    Cosine,
31
32    /// Theta-harmonic angle potential.
33    Theta,
34}
35
36/// Van der Waals non-bonded potential function type.
37///
38/// Determines the functional form used for van der Waals (dispersion
39/// and repulsion) interactions between non-bonded atom pairs.
40#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
41pub enum VdwPotentialType {
42    /// Lennard-Jones 12-6 potential.
43    #[default]
44    LennardJones,
45
46    /// Buckingham (Exponential-6) potential.
47    Buckingham,
48}
49
50#[cfg(test)]
51mod tests {
52    use super::*;
53
54    #[test]
55    fn bond_potential_default() {
56        assert_eq!(BondPotentialType::default(), BondPotentialType::Harmonic);
57    }
58
59    #[test]
60    fn angle_potential_default() {
61        assert_eq!(AnglePotentialType::default(), AnglePotentialType::Cosine);
62    }
63
64    #[test]
65    fn vdw_potential_default() {
66        assert_eq!(VdwPotentialType::default(), VdwPotentialType::LennardJones);
67    }
68
69    #[test]
70    fn potential_types_are_copy() {
71        let bond = BondPotentialType::Morse;
72        let bond_copy = bond;
73        assert_eq!(bond, bond_copy);
74
75        let angle = AnglePotentialType::Cosine;
76        let angle_copy = angle;
77        assert_eq!(angle, angle_copy);
78
79        let vdw = VdwPotentialType::Buckingham;
80        let vdw_copy = vdw;
81        assert_eq!(vdw, vdw_copy);
82    }
83}