#geometry #chemical

gchemol-geometry

gchemol: a Graph-based CHEMical Objects Library

7 releases

0.1.1 Dec 8, 2022
0.1.0 Mar 23, 2022
0.0.41 Feb 19, 2022
0.0.39 Mar 10, 2020
0.0.38 Feb 14, 2020

#211 in Math

Download history 47/week @ 2022-12-02 78/week @ 2022-12-09 28/week @ 2022-12-16 50/week @ 2022-12-23 19/week @ 2022-12-30 31/week @ 2023-01-06 14/week @ 2023-01-13 58/week @ 2023-01-20 44/week @ 2023-01-27 78/week @ 2023-02-03 76/week @ 2023-02-10 123/week @ 2023-02-17 47/week @ 2023-02-24 69/week @ 2023-03-03 16/week @ 2023-03-10 60/week @ 2023-03-17

212 downloads per month
Used in 15 crates (2 directly)

GPL-3.0 license

48KB
837 lines

Example

use gchemol::geom::Superpose;
use gchemol::Molecule;
use gchemol::prelude::*;

// load test molecules
let mol1 = Molecule::from_file("tests/files/alignment/reference.mol2").unwrap();
let mol2 = Molecule::from_file("tests/files/alignment/candidate.mol2").unwrap();

// take the first 5 atoms for superposition
let reference: Vec<_> = mol1.positions().take(5).collect();
let candidate: Vec<_> = mol2.positions().take(5).collect();

// align the candidate onto the reference
let sp = Superpose::new(&candidate).onto(&reference, None);

// apply superposition to all atoms
let superimposed_structure = sp.apply(&candidate);

// apply translation only
let translated_structure = sp.apply_translation(&candidate);

Dependencies

~9–16MB
~321K SLoC