1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#![allow(dead_code)]
#[derive(Debug, Clone)]
pub struct UnitCell {
a: f64,
b: f64,
c: f64,
alpha: f64,
beta: f64,
gamma: f64,
}
impl UnitCell {
pub fn new(a: f64, b: f64, c: f64, alpha: f64, beta: f64, gamma: f64) -> UnitCell {
UnitCell {
a,
b,
c,
alpha,
beta,
gamma,
}
}
pub fn a(&self) -> f64 {
self.a
}
pub fn b(&self) -> f64 {
self.b
}
pub fn c(&self) -> f64 {
self.c
}
pub fn alpha(&self) -> f64 {
self.alpha
}
pub fn beta(&self) -> f64 {
self.beta
}
pub fn gamma(&self) -> f64 {
self.gamma
}
pub fn size(&self) -> (f64, f64, f64) {
(self.a, self.b, self.c)
}
}
impl PartialEq for UnitCell {
fn eq(&self, other: &Self) -> bool {
self.size() == other.size()
&& self.alpha == other.alpha
&& self.beta == other.beta
&& self.gamma == other.gamma
}
}