#![allow(unused)]
use super::macros::derive_styles;
include!(concat!(env!("OUT_DIR"), "/styles/pair_styles.rs"));
pub struct PairStyleInfo {
pub min_args: usize,
pub max_args: Option<usize>,
pub min_coeffs: usize,
pub max_coeffs: Option<usize>,
pub arg_context: &'static str,
pub coeff_context: &'static str,
}
impl PairStyle {
pub fn info(&self) -> Option<PairStyleInfo> {
use PairStyle as PS;
match self {
PS::LjCut => Some(PairStyleInfo {
min_args: 1,
max_args: Some(1),
min_coeffs: 2,
max_coeffs: Some(3),
arg_context: "cutoff",
coeff_context: "epsilon sigma (cutoff)",
}),
PS::LjCutCoulCut => Some(PairStyleInfo {
min_args: 1,
max_args: Some(2),
min_coeffs: 2,
max_coeffs: Some(4),
arg_context: "cutoff (cutoff2)",
coeff_context: "epsilon sigma (cutoff) (cutoff2)",
}),
PS::LjCutCoulLong | PS::LjCutCoulMsm => Some(PairStyleInfo {
min_args: 1,
max_args: Some(2),
min_coeffs: 2,
max_coeffs: Some(3),
arg_context: "cutoff (cutoff2)",
coeff_context: "epsilon sigma (cutoff)",
}),
PS::LjCutCoulDebye | PS::LjCutCoulDsf | PS::LjCutCoulWolf => Some(PairStyleInfo {
min_args: 2,
max_args: Some(3),
min_coeffs: 2,
max_coeffs: Some(4),
arg_context: "alpha/kappa cutoff (cutoff2)",
coeff_context: "epsilon sigma (cutoff) (cutoff2)",
}),
PS::LjCutTip4pCut | PS::LjCutTip4pLong => Some(PairStyleInfo {
min_args: 6,
max_args: Some(7),
min_coeffs: 2,
max_coeffs: Some(3),
arg_context: "otype htype btype atype qdist cutoff (cutoff2)",
coeff_context: "epsilon sigma (lj_cutoff)",
}),
PS::Hybrid => Some(PairStyleInfo {
min_args: 1,
max_args: None,
min_coeffs: 1,
max_coeffs: None,
arg_context: "style1 args style2 args...",
coeff_context: "style args",
}),
_ => None,
}
}
pub fn min_args(&self) -> Option<usize> {
self.info().map(|i| i.min_args)
}
pub fn max_args(&self) -> Option<usize> {
self.info().map(|i| i.max_args)?
}
pub fn min_coeffs(&self) -> Option<usize> {
self.info().map(|i| i.min_coeffs)
}
pub fn max_coeffs(&self) -> Option<usize> {
self.info().map(|i| i.max_coeffs)?
}
pub fn arg_context(&self) -> Option<&str> {
self.info().map(|i| i.arg_context)
}
pub fn coeff_context(&self) -> Option<&str> {
self.info().map(|i| i.coeff_context)
}
}
#[cfg(test)]
mod tests {
#[test]
#[ignore = "test is incomplete."]
fn correct_number_of_args_in_context() {
todo!("try all styles that have infos and check if the context message matches the expected number of args and funcs.
");
}
}