castep_param_io/param/units/
inv_length_unit.rs1use std::fmt::Display;
2
3use serde::{Deserialize, Serialize};
4
5use crate::param::KeywordDisplay;
6
7#[derive(
8 Debug, Clone, Copy, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Default,
9)]
10pub enum InvLengthUnit {
14 Bohr,
15 Meter,
16 Nanometer,
17 #[default]
18 Ang,
19}
20
21impl Display for InvLengthUnit {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 match self {
24 InvLengthUnit::Bohr => f.write_str("1/"),
25 InvLengthUnit::Meter => f.write_str("1/m"),
26 InvLengthUnit::Nanometer => f.write_str("1/nm"),
27 InvLengthUnit::Ang => f.write_str("1/ang"),
28 }
29 }
30}
31
32impl KeywordDisplay for InvLengthUnit {
33 fn field(&self) -> String {
34 "INV_LENGTH_UNIT".to_string()
35 }
36}