Skip to content

A simple nodejs tool to calculate the elemental composition of molecular formulae.

Notifications You must be signed in to change notification settings

jagill/node-molecular-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Molecular Parser

This is a simple tool that takes a molecular formula such as CH(CH2)2OH, and returns a map from elemental symbol to its count in the molecule.

Parser = require('molecularParser');

var elementCounts = Parser.decomposeFormula('CH(CH2)2OH');
// { C:3, H:6, O:1 }

var crazyCounts = Parser.decomposeFormula('(CH3)16(Tc(H2O)3CO(BrFe3(ReCl)3(SO4)2)2)2MnO4');
// { C: 18, H: 60, Tc: 2, O: 44, Br: 4, Fe: 12, Re: 12, Cl: 12, S: 8, Mn: 1 }

About

A simple nodejs tool to calculate the elemental composition of molecular formulae.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published