Skip to main content

ice/
ice.rs

1/* Copyright (c) d-SEAMS developers */
2fn diamond(nrep: usize) -> (Vec<f64>, f64) {
3    let a = 2.75 * 4.0 / 3.0_f64.sqrt();
4    let fcc = [
5        [0.0, 0.0, 0.0],
6        [0.5, 0.5, 0.0],
7        [0.5, 0.0, 0.5],
8        [0.0, 0.5, 0.5],
9    ];
10    let basis = [[0.0, 0.0, 0.0], [0.25, 0.25, 0.25]];
11    let mut xyz = Vec::new();
12    for i in 0..nrep {
13        for j in 0..nrep {
14            for k in 0..nrep {
15                for shift in fcc {
16                    for site in basis {
17                        xyz.push((i as f64 + shift[0] + site[0]) * a);
18                        xyz.push((j as f64 + shift[1] + site[1]) * a);
19                        xyz.push((k as f64 + shift[2] + site[2]) * a);
20                    }
21                }
22            }
23        }
24    }
25    (xyz, nrep as f64 * a)
26}
27
28fn main() {
29    let (xyz, length) = diamond(2);
30    let mut sys = seams::System::new().expect("system");
31    sys.set_ortho(&xyz, length, length, length).expect("frame");
32    let ice = sys
33        .chill_plus(&seams::ChillOptions::default())
34        .expect("chill+");
35    println!(
36        "dseams {} cubic {} of {}",
37        seams::version(),
38        ice.counts[0],
39        ice.labels.len()
40    );
41}
42
43#[test]
44fn example_runs() {
45    main();
46}