castep_param_io/param/electronic/spin.rs
1
2use castep_param_derive::KeywordDisplay;
3use serde::{Deserialize, Serialize};
4
5#[derive(
6 Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize, Default, KeywordDisplay,
7)]
8#[keyword_display(field = "SPIN", from=f64, value=f64)]
9/// This keyword determines the initial value for the number of unpaired electrons in a spin-polarized calculation. This value may be optimized during the CASTEP calculation depending on the values of SPIN_FIX and FIX_OCCUPANCY.
10/// The SPIN keyword cannot be used in conjunction with either of NUP or NDOWN keywords.
11/// # Default
12/// 0 when the total number of electrons in the system is even.
13/// 1 when the total number of electrons in the system is odd.
14pub struct Spin(f64);
15
16#[cfg(test)]
17mod test {
18 use crate::param::KeywordDisplay;
19
20 use super::Spin;
21
22 #[test]
23 fn spin() {
24 let spin = Spin(2.0);
25 println!("{}", spin.output())
26 }
27}