periodic-table icon indicating copy to clipboard operation
periodic-table copied to clipboard

Parsing Complex Formulae

Open sabidhasan opened this issue 7 years ago • 2 comments

Hello,

Would you be open to a modification of the atomicMass function that allows it to parse complex formulae?

I mean two things by this:

  1. Natural formulas with no spaces between the elements (C6H12O6 rather than C6 H12 O6)
  2. Brackets (eg C2[Cr(H2O)4]2N2 for the sake of illustration)

I wrote a Python module at one point with this functionality so it should be pretty easy to port to JS.

If interested, I can fork and make a PR

sabidhasan avatar Dec 24 '17 03:12 sabidhasan

@sabidhasan perhaps you are interested for a similar solution in C++? Then take a look at my repository GTK-Periodic-Table-Molecular-Formula ...

ekuester avatar Nov 06 '18 15:11 ekuester

Might I recommend adding a separate helper function that would format a given complex string into one more readable by functions like atomicMass? I could write one up and make a PR fairly easily if need be; I've worked on a similar project in JS before.

Papayaman1000 avatar Feb 11 '19 17:02 Papayaman1000