CalebBell / thermo

Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)
MIT License
594 stars 114 forks source link

throw a "Chemical name not recognized" exception using CAS_from_any('C9H8O4') #66

Closed leeathorskey closed 3 years ago

leeathorskey commented 3 years ago

Hello, Caleb,

 I'd like to get some properties about aspirin, when I type CAS_from_any('50-78-2') or CAS_from_any('aspirin') ,it return the right result, but  throw a "Chemical name not recognized" exception  when using  CAS_from_any('C9H8O4').

 Please fix it.
CalebBell commented 3 years ago

Hi Lee,

There are lots of chemicals with that formula. Those interfaces are designed to only return hits when the input string is unique, to avoid the ambiguity of the case when there are multiple possible results. The database in thermo contains the following chemicals with the same formula:

['2-acetyloxybenzoic acid', '4-methoxycarbonylbenzoic acid', '3-(4-hydroxyphenyl)-2-oxidanylidene-propanoic acid', 'ethanoyl benzenecarboperoxoate', '4-acetyloxybenzoic acid', '4-methylphthalic acid', '2-methoxycarbonylbenzoic acid', '7-methoxy-1,3-benzodioxole-5-carbaldehyde', '2-(2-methanoylphenoxy)ethanoic acid', '2-(2-hydroxy-2-oxoethyl)benzoic acid', 'methyl 1,3-benzodioxole-5-carboxylate', '2-phenylpropanedioic acid', '2-(1,3-benzodioxol-5-yl)ethanoic acid', '2-(4-methanoylphenoxy)ethanoic acid', '(4-methanoylphenyl) methyl carbonate', 'bicyclo[2.2.1]hepta-2,5-diene-2,3-dicarboxylic acid', '3-acetyloxybenzoic acid', '(e)-3-[3,4-bis(oxidanyl)phenyl]prop-2-enoic acid', 'methyl 2-(4-hydroxyphenyl)-2-oxidanylidene-ethanoate', '2-methylbenzene-1,3-dicarboxylic acid']

I hope you can understand that it is a good idea not to use the formula when there are lots of possible matches. Sincerely, Caleb

leeathorskey commented 3 years ago

Hi Caleb,

  Thanks a lot for your replying. I am trying to write a software to search and display chemical attributes and thermo help me a lot, thermo is wonderful.

image