Skip to main content

total_atom_count

Function total_atom_count 

Source
pub fn total_atom_count(chain: &PolymerChain) -> usize
Expand description

Nombre total d’atomes dans la chaîne (atomes lourds + hydrogènes implicites/explicites).

§Exemple

use polysim_core::{parse, builder::{linear::LinearBuilder, BuildStrategy},
                   properties::formula::total_atom_count};

let bs = parse("{[]CC[]}").unwrap();
let chain = LinearBuilder::new(bs, BuildStrategy::ByRepeatCount(1))
    .homopolymer()
    .unwrap();
// CC = éthane C₂H₆ → 2 + 6 = 8 atomes
assert_eq!(total_atom_count(&chain), 8);