1use glam::DVec3;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6pub struct UffAtomType(pub String);
7
8impl UffAtomType {
9 pub fn as_str(&self) -> &str {
10 &self.0
11 }
12 pub fn unknown() -> Self {
13 Self("Unknown".to_string())
14 }
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct Atom {
20 pub element: usize,
22 pub position: DVec3,
24 pub force: DVec3,
26 pub charge: f64,
28 pub uff_type: UffAtomType,
30}
31
32impl Atom {
33 pub fn new(element: usize, position: DVec3) -> Self {
35 Self {
36 element,
37 position,
38 force: DVec3::ZERO,
39 charge: 0.0,
40 uff_type: UffAtomType::unknown(),
41 }
42 }
43
44 pub fn with_charge(mut self, charge: f64) -> Self {
46 self.charge = charge;
47 self
48 }
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct Bond {
54 pub atom_indices: (usize, usize),
56 pub order: f32,
58}