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 term 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 angle potential (DREIDING original).
29    CosineHarmonic,
30
31    /// Theta-harmonic angle potential.
32    #[default]
33    ThetaHarmonic,
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    /// Exponential-6 (Buckingham) potential.
47    Exponential6,
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!(
62            AnglePotentialType::default(),
63            AnglePotentialType::ThetaHarmonic
64        );
65    }
66
67    #[test]
68    fn vdw_potential_default() {
69        assert_eq!(VdwPotentialType::default(), VdwPotentialType::LennardJones);
70    }
71
72    #[test]
73    fn potential_types_are_copy() {
74        let bond = BondPotentialType::Morse;
75        let bond_copy = bond;
76        assert_eq!(bond, bond_copy);
77
78        let angle = AnglePotentialType::CosineHarmonic;
79        let angle_copy = angle;
80        assert_eq!(angle, angle_copy);
81
82        let vdw = VdwPotentialType::Exponential6;
83        let vdw_copy = vdw;
84        assert_eq!(vdw, vdw_copy);
85    }
86}