1use crate::auxiliary::atom::{Atom, AtomKind, ElementMap};
4use crate::auxiliary::molecule::Molecule;
5use nalgebra::Point3;
6
7#[must_use]
8pub(crate) fn gen_twisted_h8(theta: f64) -> Molecule {
9 let emap = ElementMap::new();
10 let (atomic_number, atomic_mass) = emap.get("H").expect("Unable to retrieve element.");
11 let atoms: [Atom; 8] = [
12 Atom {
13 kind: AtomKind::Ordinary,
14 atomic_number: *atomic_number,
15 atomic_symbol: "H".to_owned(),
16 atomic_mass: *atomic_mass,
17 coordinates: Point3::new(0.0, 0.0, 0.0),
18 threshold: 1e-7,
19 },
20 Atom {
21 kind: AtomKind::Ordinary,
22 atomic_number: *atomic_number,
23 atomic_symbol: "H".to_owned(),
24 atomic_mass: *atomic_mass,
25 coordinates: Point3::new(1.0, 0.0, 0.0),
26 threshold: 1e-7,
27 },
28 Atom {
29 kind: AtomKind::Ordinary,
30 atomic_number: *atomic_number,
31 atomic_symbol: "H".to_owned(),
32 atomic_mass: *atomic_mass,
33 coordinates: Point3::new(1.0, 1.0, 0.0),
34 threshold: 1e-7,
35 },
36 Atom {
37 kind: AtomKind::Ordinary,
38 atomic_number: *atomic_number,
39 atomic_symbol: "H".to_owned(),
40 atomic_mass: *atomic_mass,
41 coordinates: Point3::new(0.0, 1.0, 0.0),
42 threshold: 1e-7,
43 },
44 Atom {
45 kind: AtomKind::Ordinary,
46 atomic_number: *atomic_number,
47 atomic_symbol: "H".to_owned(),
48 atomic_mass: *atomic_mass,
49 coordinates: Point3::new(
50 1.0 / (2.0_f64.sqrt()) * (5.0 * std::f64::consts::FRAC_PI_4 + theta).cos() + 0.5,
51 1.0 / (2.0_f64.sqrt()) * (5.0 * std::f64::consts::FRAC_PI_4 + theta).sin() + 0.5,
52 2.0,
53 ),
54 threshold: 1e-7,
55 },
56 Atom {
57 kind: AtomKind::Ordinary,
58 atomic_number: *atomic_number,
59 atomic_symbol: "H".to_owned(),
60 atomic_mass: *atomic_mass,
61 coordinates: Point3::new(
62 1.0 / (2.0_f64.sqrt()) * (7.0 * std::f64::consts::FRAC_PI_4 + theta).cos() + 0.5,
63 1.0 / (2.0_f64.sqrt()) * (7.0 * std::f64::consts::FRAC_PI_4 + theta).sin() + 0.5,
64 2.0,
65 ),
66 threshold: 1e-7,
67 },
68 Atom {
69 kind: AtomKind::Ordinary,
70 atomic_number: *atomic_number,
71 atomic_symbol: "H".to_owned(),
72 atomic_mass: *atomic_mass,
73 coordinates: Point3::new(
74 1.0 / (2.0_f64.sqrt()) * (1.0 * std::f64::consts::FRAC_PI_4 + theta).cos() + 0.5,
75 1.0 / (2.0_f64.sqrt()) * (1.0 * std::f64::consts::FRAC_PI_4 + theta).sin() + 0.5,
76 2.0,
77 ),
78 threshold: 1e-7,
79 },
80 Atom {
81 kind: AtomKind::Ordinary,
82 atomic_number: *atomic_number,
83 atomic_symbol: "H".to_owned(),
84 atomic_mass: *atomic_mass,
85 coordinates: Point3::new(
86 1.0 / (2.0_f64.sqrt()) * (3.0 * std::f64::consts::FRAC_PI_4 + theta).cos() + 0.5,
87 1.0 / (2.0_f64.sqrt()) * (3.0 * std::f64::consts::FRAC_PI_4 + theta).sin() + 0.5,
88 2.0,
89 ),
90 threshold: 1e-7,
91 },
92 ];
93 Molecule::from_atoms(&atoms, 1e-7)
94}
95
96#[must_use]
97pub(crate) fn gen_arbitrary_half_sandwich(n: u32) -> Molecule {
98 let emap = ElementMap::new();
99 let mut atoms: Vec<Atom> = vec![];
100 let (h_atomic_number, h_atomic_mass) = emap.get("H").expect("Unable to retrieve element.");
101 let (c_atomic_number, c_atomic_mass) = emap.get("C").expect("Unable to retrieve element.");
102 let (v_atomic_number, v_atomic_mass) = emap.get("V").expect("Unable to retrieve element.");
103 atoms.push(Atom {
104 kind: AtomKind::Ordinary,
105 atomic_number: *v_atomic_number,
106 atomic_symbol: "V".to_owned(),
107 atomic_mass: *v_atomic_mass,
108 coordinates: Point3::new(0.0, 0.0, 1.0 + 0.1 * (f64::from(n))),
109 threshold: 1e-7,
110 });
111 for i in 0..n {
112 atoms.push(Atom {
113 kind: AtomKind::Ordinary,
114 atomic_number: *c_atomic_number,
115 atomic_symbol: "C".to_owned(),
116 atomic_mass: *c_atomic_mass,
117 coordinates: Point3::new(
118 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
119 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
120 0.0,
121 ),
122 threshold: 1e-7,
123 });
124 atoms.push(Atom {
125 kind: AtomKind::Ordinary,
126 atomic_number: *h_atomic_number,
127 atomic_symbol: "H".to_owned(),
128 atomic_mass: *h_atomic_mass,
129 coordinates: Point3::new(
130 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
131 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
132 0.0,
133 ),
134 threshold: 1e-7,
135 });
136 }
137 Molecule::from_atoms(&atoms, 1e-7)
138}
139
140#[must_use]
141pub(crate) fn gen_arbitrary_eclipsed_sandwich(n: u32) -> Molecule {
142 let emap = ElementMap::new();
143 let mut atoms: Vec<Atom> = vec![];
144 let (h_atomic_number, h_atomic_mass) = emap.get("H").expect("Unable to retrieve element.");
145 let (c_atomic_number, c_atomic_mass) = emap.get("C").expect("Unable to retrieve element.");
146 let (m_atomic_number, m_atomic_mass) = emap.get("Co").expect("Unable to retrieve element.");
147 atoms.push(Atom {
148 kind: AtomKind::Ordinary,
149 atomic_number: *m_atomic_number,
150 atomic_symbol: "Co".to_owned(),
151 atomic_mass: *m_atomic_mass,
152 coordinates: Point3::new(0.0, 0.0, 0.0),
153 threshold: 1e-7,
154 });
155 for i in 0..n {
156 atoms.push(Atom {
157 kind: AtomKind::Ordinary,
158 atomic_number: *c_atomic_number,
159 atomic_symbol: "C".to_owned(),
160 atomic_mass: *c_atomic_mass,
161 coordinates: Point3::new(
162 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
163 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
164 -1.0 - 0.1 * (f64::from(n)),
165 ),
166 threshold: 1e-7,
167 });
168 atoms.push(Atom {
169 kind: AtomKind::Ordinary,
170 atomic_number: *h_atomic_number,
171 atomic_symbol: "H".to_owned(),
172 atomic_mass: *h_atomic_mass,
173 coordinates: Point3::new(
174 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
175 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
176 -1.0 - 0.1 * (f64::from(n)),
177 ),
178 threshold: 1e-7,
179 });
180 atoms.push(Atom {
181 kind: AtomKind::Ordinary,
182 atomic_number: *c_atomic_number,
183 atomic_symbol: "C".to_owned(),
184 atomic_mass: *c_atomic_mass,
185 coordinates: Point3::new(
186 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
187 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
188 1.0 + 0.1 * (f64::from(n)),
189 ),
190 threshold: 1e-7,
191 });
192 atoms.push(Atom {
193 kind: AtomKind::Ordinary,
194 atomic_number: *h_atomic_number,
195 atomic_symbol: "H".to_owned(),
196 atomic_mass: *h_atomic_mass,
197 coordinates: Point3::new(
198 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
199 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
200 1.0 + 0.1 * (f64::from(n)),
201 ),
202 threshold: 1e-7,
203 });
204 }
205 Molecule::from_atoms(&atoms, 1e-7)
206}
207
208#[must_use]
209pub fn gen_arbitrary_twisted_sandwich(n: u32, frac: f64) -> Molecule {
210 let emap = ElementMap::new();
211 let mut atoms: Vec<Atom> = vec![];
212 let (h_atomic_number, h_atomic_mass) = emap.get("H").expect("Unable to retrieve element.");
213 let (c_atomic_number, c_atomic_mass) = emap.get("C").expect("Unable to retrieve element.");
214 let (m_atomic_number, m_atomic_mass) = emap.get("Co").expect("Unable to retrieve element.");
215 atoms.push(Atom {
216 kind: AtomKind::Ordinary,
217 atomic_number: *m_atomic_number,
218 atomic_symbol: "Co".to_owned(),
219 atomic_mass: *m_atomic_mass,
220 coordinates: Point3::new(0.0, 0.0, 0.0),
221 threshold: 1e-7,
222 });
223 for i in 0..n {
224 atoms.push(Atom {
225 kind: AtomKind::Ordinary,
226 atomic_number: *c_atomic_number,
227 atomic_symbol: "C".to_owned(),
228 atomic_mass: *c_atomic_mass,
229 coordinates: Point3::new(
230 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
231 1.0 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
232 -1.0 - 0.1 * (f64::from(n)),
233 ),
234 threshold: 1e-7,
235 });
236 atoms.push(Atom {
237 kind: AtomKind::Ordinary,
238 atomic_number: *h_atomic_number,
239 atomic_symbol: "H".to_owned(),
240 atomic_mass: *h_atomic_mass,
241 coordinates: Point3::new(
242 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
243 1.5 * ((f64::from(i)) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
244 -1.0 - 0.1 * (f64::from(n)),
245 ),
246 threshold: 1e-7,
247 });
248 atoms.push(Atom {
249 kind: AtomKind::Ordinary,
250 atomic_number: *c_atomic_number,
251 atomic_symbol: "C".to_owned(),
252 atomic_mass: *c_atomic_mass,
253 coordinates: Point3::new(
254 1.0 * ((f64::from(i) + frac) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
255 1.0 * ((f64::from(i) + frac) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
256 1.0 + 0.1 * (f64::from(n)),
257 ),
258 threshold: 1e-7,
259 });
260 atoms.push(Atom {
261 kind: AtomKind::Ordinary,
262 atomic_number: *h_atomic_number,
263 atomic_symbol: "H".to_owned(),
264 atomic_mass: *h_atomic_mass,
265 coordinates: Point3::new(
266 1.5 * ((f64::from(i) + frac) * 2.0 * std::f64::consts::PI / (f64::from(n))).cos(),
267 1.5 * ((f64::from(i) + frac) * 2.0 * std::f64::consts::PI / (f64::from(n))).sin(),
268 1.0 + 0.1 * (f64::from(n)),
269 ),
270 threshold: 1e-7,
271 });
272 }
273 Molecule::from_atoms(&atoms, 1e-7)
274}