adelq / thermochem

Useful Python modules for Thermodynamics and Thermochemistry
http://thermochem.readthedocs.io
Other
30 stars 17 forks source link

Extra Spaces in BURCAT_THR.xml #27

Open gh-wf opened 10 months ago

gh-wf commented 10 months ago

I noticed several extra spaces in various elements. Two examples include:

N2 REF ELEMENT H2 REF ELEMENT

Is there any specific reason for this, or can I fix the xml and propose to update it?

I noticed because I was getting an error from db.getelementdata using the string without the double space.

ZGainsforth commented 10 months ago

Possibly, though it may be more optimal to make the code tolerant of multiple spaces in names. The BURCAT_THR.xml is downloaded directly (i.e. not modified or created by us) from the Burcat website: Burcat link. Thus, if we ever re-download a newer version, the spaces may creep back in. In addition, there may be spaces in some other phase names which we simply haven't found yet.

So a slick solution could be to do a regex on the user's input which converts all whitespace (\s+ or similar) to a single space, and then apply the same regex to the field read from the database. That solves this instance and any future whitespace instance.