chemcore icon indicating copy to clipboard operation
chemcore copied to clipboard

exact molecular mass and average molecular mass

Open bddap opened this issue 3 years ago • 2 comments

A new feature mentioned in https://github.com/rapodaca/chemcore/issues/5#issuecomment-859951452

bddap avatar Jun 13 '22 17:06 bddap

Looking into the atom representation, https://github.com/rapodaca/chemcore/blob/06732d97690eba82049e05246a431fd6699bc6eb/src/molecule/atom.rs#L5

The optional element makes this inappropriate:

fn molecular_mass_average(mol: &impl Molecule) -> Da;

leaving this as a sensible option:

fn molecular_mass_average(mol: &impl Molecule) -> Option<Da>;

Is element: None meant to indicate a SMARTS wildcard?

bddap avatar Jun 13 '22 17:06 bddap

element: None could be used for systems (like SMILES) that have the notion of optional elements. It could also be used for cases, aside from specific serialization formats, in which the element is unknown. This does mean than mass calculators would need to check for a missing element, but that's just the type system enforcing the problem's constraints.

rapodaca avatar Oct 08 '23 21:10 rapodaca