Skip to main content

Crate polysim_core

Crate polysim_core 

Source
Expand description

§polysim-core

Polymer structure generator and physical property simulator built on top of BigSMILES.

§Overview

polysim-core turns a BigSMILES string into one or more concrete polymer chains (represented as SMILES) and computes physical/chemical properties on them.

The typical workflow is:

  1. Parse a BigSMILES string with parse.
  2. Build a chain with one of the builders in builder.
  3. Compute properties via properties.

§Quick start

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

// Polyéthylène — 10 unités répétées
let bs = parse("{[]CC[]}").unwrap();
let chain = LinearBuilder::new(bs, BuildStrategy::ByRepeatCount(10))
    .homopolymer()
    .unwrap();

assert_eq!(chain.repeat_count, 10);
assert_eq!(chain.smiles, "CCCCCCCCCCCCCCCCCCCC");
// La masse moléculaire moyenne (Mn) est calculée automatiquement
assert!((chain.mn - 282.554).abs() < 0.01, "Mn = {} g/mol", chain.mn);

Re-exports§

pub use builder::BuildStrategy;
pub use error::PolySimError;
pub use polymer::PolymerChain;

Modules§

builder
Polymer chain builders.
error
polymer
Polymer chain representation.
properties
Physical and chemical property calculators.

Structs§

BigSmiles
A parsed BigSMILES string: a sequence of SMILES fragments and stochastic objects.

Functions§

parse
Parse a BigSMILES string into a BigSmiles AST.