castep_param_io/param/density_mixing_params/
mix_cut_off_energy.rs

1use castep_param_derive::KeywordDisplayStruct;
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5use crate::param::EnergyUnit;
6
7/// This keyword determines the cutoff energy for the densities used in the
8/// density mixing scheme.
9/// The value specified determines the extent of the grid used for mixing old
10/// and new densities. Density components with wave vectors higher than that specified are not mixed.
11/// # Default
12/// The default value is the CUT_OFF_ENERGY.
13/// # Example
14/// `MIX_CUT_OFF_ENERGY : 250.0 eV`
15#[derive(
16    Debug,
17    Clone,
18    Copy,
19    PartialEq,
20    PartialOrd,
21    Serialize,
22    Deserialize,
23    Default,
24    KeywordDisplayStruct,
25    Builder,
26)]
27#[keyword_display(field = "MIX_CUT_OFF_ENERGY", display_format = "{:20.15} {}", from=f64)]
28pub struct MixCutOffEnergy {
29    pub cutoff_energy: f64,
30    #[keyword_display(is_option = true)]
31    pub unit: Option<EnergyUnit>,
32}
33#[cfg(test)]
34mod test {
35    use crate::param::KeywordDisplay;
36
37    use super::MixCutOffEnergy;
38
39    #[test]
40    fn mix_cut_off_energy() {
41        let mix_cutoff = MixCutOffEnergy {
42            cutoff_energy: 250.0,
43            unit: None,
44        };
45        println!("{}", mix_cutoff.output());
46    }
47}