dreid_forge/forge/config/
mod.rs

1//! Configuration types for DREIDING parameterization.
2//!
3//! This module defines all configuration structures used to control the
4//! behavior of the [`forge`](super::forge) function. Settings include
5//! potential function types, charge calculation methods, and custom
6//! parameter file paths.
7//!
8//! # Overview
9//!
10//! - [`ForgeConfig`] — Main configuration struct
11//! - [`ChargeMethod`] — Charge calculation method selection
12//! - [`QeqConfig`] — QEq charge equilibration settings
13//! - [`HybridConfig`] — Hybrid biological/QEq charge assignment
14//! - [`BondPotentialType`] — Bond stretching potential selection
15//! - [`AnglePotentialType`] — Angle bending potential selection
16//! - [`VdwPotentialType`] — Van der Waals potential selection
17
18mod charge;
19mod potential;
20
21pub use charge::{
22    BasisType, ChargeMethod, DampingStrategy, EmbeddedQeqConfig, HybridConfig, LigandChargeConfig,
23    LigandQeqMethod, NucleicScheme, ProteinScheme, QeqConfig, ResidueSelector, SolverOptions,
24    WaterScheme,
25};
26pub use potential::{AnglePotentialType, BondPotentialType, VdwPotentialType};
27
28/// Main configuration for DREIDING force field parameterization.
29///
30/// Controls all aspects of the parameterization process, including
31/// potential function types, charge calculation method, and optional
32/// custom parameter files.
33///
34/// # Examples
35///
36/// ```
37/// use dreid_forge::{ForgeConfig, ChargeMethod, QeqConfig, BondPotentialType};
38///
39/// // Default configuration (no charges)
40/// let default = ForgeConfig::default();
41///
42/// // Custom configuration with QEq charges and Morse bonds
43/// let custom = ForgeConfig {
44///     charge_method: ChargeMethod::Qeq(QeqConfig::default()),
45///     bond_potential: BondPotentialType::Morse,
46///     ..Default::default()
47/// };
48/// ```
49#[derive(Debug, Clone)]
50pub struct ForgeConfig {
51    /// Custom atom typing rules in TOML format.
52    ///
53    /// If `None`, uses the built-in DREIDING typing rules from `dreid-typer`.
54    pub rules: Option<String>,
55
56    /// Custom force field parameters in TOML format.
57    ///
58    /// If `None`, uses the embedded `default.params.toml` with standard
59    /// DREIDING parameters.
60    pub params: Option<String>,
61
62    /// Method for calculating partial atomic charges.
63    pub charge_method: ChargeMethod,
64
65    /// Type of bond stretching potential to generate.
66    pub bond_potential: BondPotentialType,
67
68    /// Type of angle bending potential to generate.
69    pub angle_potential: AnglePotentialType,
70
71    /// Type of van der Waals non-bonded potential to generate.
72    pub vdw_potential: VdwPotentialType,
73}
74
75impl Default for ForgeConfig {
76    fn default() -> Self {
77        Self {
78            rules: None,
79            params: None,
80            charge_method: ChargeMethod::None,
81            bond_potential: BondPotentialType::Harmonic,
82            angle_potential: AnglePotentialType::ThetaHarmonic,
83            vdw_potential: VdwPotentialType::LennardJones,
84        }
85    }
86}
87
88#[cfg(test)]
89mod tests {
90    use super::*;
91
92    #[test]
93    fn default_config_values() {
94        let config = ForgeConfig::default();
95        assert!(config.rules.is_none());
96        assert!(config.params.is_none());
97        assert!(matches!(config.charge_method, ChargeMethod::None));
98        assert_eq!(config.bond_potential, BondPotentialType::Harmonic);
99        assert_eq!(config.angle_potential, AnglePotentialType::ThetaHarmonic);
100        assert_eq!(config.vdw_potential, VdwPotentialType::LennardJones);
101    }
102}