castep_param_io/param/units/
velocity_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 VelocityUnit {
14 AtomicUnitOfVelocity,
15 #[default]
16 AngPerPs,
17 AngPerFs,
18 BohrPerPs,
19 BohrPerFs,
20 MetersPerSecond,
21}
22
23impl Display for VelocityUnit {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self {
26 VelocityUnit::AtomicUnitOfVelocity => f.write_str("auv"),
27 VelocityUnit::AngPerPs => f.write_str("ang/ps"),
28 VelocityUnit::AngPerFs => f.write_str("ang/fs"),
29 VelocityUnit::BohrPerPs => f.write_str("bohr/ps"),
30 VelocityUnit::BohrPerFs => f.write_str("bohr/fs"),
31 VelocityUnit::MetersPerSecond => f.write_str("m/s"),
32 }
33 }
34}
35
36impl KeywordDisplay for VelocityUnit {
37 fn field(&self) -> String {
38 "VELOCITY_UNIT".to_string()
39 }
40}