[][src]Function lib3dmol::tools::center_of_mass

pub fn center_of_mass<T: GetAtom>(atom_list: &T) -> [f32; 3]

Calculate the center of mass for structure implementing the GetAtom trait

Atom masses are extracted from CHARMM Force Field .prm files. If CHARMM_FOLDER environement variable is set, .prm files in this folder are used. Else it will be files in datasets folder.

Example

use lib3dmol::{parser, tools};

let my_prot = parser::read_pdb("tests/tests_file/5jpq.pdb", "5jqp");

assert_eq!([239.22723, 239.0272, 246.19086], tools::center_of_mass(&my_prot))