Skip to content

Commit

Permalink
correct bug in condition for update_chemical_info function
Browse files Browse the repository at this point in the history
  • Loading branch information
schumannj committed Sep 23, 2024
1 parent 5901bd6 commit cc43e82
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 36 deletions.
8 changes: 5 additions & 3 deletions src/nomad_catalysis/schema_packages/catalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,15 +716,17 @@ def normalize(self, archive, logger):
elif '_' in self.name:
self.name = self.name.replace('_', ' ')

if self.name and self.pure_component is None:
import time

if self.name and (
self.pure_component is None or self.pure_component.iupac_name is None
):
pure_component = self.update_chemical_info()
self.pure_component = pure_component

if self.pure_component.iupac_name is not None:
return
else:
import time

time.sleep(1)
self.pure_component.normalize(archive, logger)

Expand Down
75 changes: 42 additions & 33 deletions src/nomad_catalysis/schema_packages/chemical_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'pub_chem_id': 281,
'iupac_name': 'carbon monoxide',
'molecular_formula': 'CO',
'molecular_mass': 28.01,
'molar_mass': 28.01,
'inchi': 'InChI=1S/CO/c1-2',
'inchi_key': 'UGFAIRIUMAVXCW-UHFFFAOYSA-N',
'cas_number': '630-08-0',
Expand All @@ -13,7 +13,7 @@
'pub_chem_id': 280,
'iupac_name': 'carbon dioxide',
'molecular_formula': 'CO2',
'molecular_mass': 44.01,
'molar_mass': 44.01,
'inchi': 'InChI=1S/CO2/c2-1-3',
'inchi_key': 'CURLTUGMZLYLDI-UHFFFAOYSA-N',
'cas_number': '124-38-9',
Expand All @@ -23,14 +23,14 @@
'pub_chem_id': 1032,
'iupac_name': 'propanoic acid',
'molecular_formula': 'C3H6O2',
'molecular_mass': 74.08,
'molar_mass': 74.08,
},
'propionic acid': 'propanoic acid', # Reference to 'propanoic acid'
'ammonia': {
'pub_chem_id': 222,
'iupac_name': 'ammonia', # actually 'azane'
'molecular_formula': 'H3N',
'molecular_mass': 17.03,
'molar_mass': 17.03,
'inchi': 'InChI=1S/H3N/h1H3',
'inchi_key': 'QGZKDVFQNNGYKY-UHFFFAOYSA-N',
'cas_number': '7664-41-7',
Expand All @@ -40,7 +40,7 @@
'pub_chem_id': 783,
'iupac_name': 'molecular hydrogen',
'molecular_formula': 'H2',
'molecular_mass': 2.016,
'molar_mass': 2.016,
'inchi': 'InChI=1S/H2/h1H',
'inchi_key': 'UFHFLCQGNIYNRP-UHFFFAOYSA-N',
'cas_number': '1333-74-0',
Expand All @@ -51,15 +51,15 @@
'pub_chem_id': 962,
'iupac_name': 'water', # actually 'oxidane'
'molecular_formula': 'H2O',
'molecular_mass': 18.015,
'molar_mass': 18.015,
'inchi': 'InChI=1S/H2O/h1H2',
},
'H2O': 'water', # Reference to 'water'
'argon': {
'pub_chem_id': 23968,
'iupac_name': 'argon',
'molecular_formula': 'Ar',
'molecular_mass': 39.9,
'molar_mass': 39.9,
'inchi': 'InChI=1S/Ar',
'inchi_key': 'XKRFYHLGVUSROY-UHFFFAOYSA-N',
'cas_number': '7440-37-1',
Expand All @@ -69,7 +69,7 @@
'pub_chem_id': 947,
'iupac_name': 'molecular nitrogen',
'molecular_formula': 'N2',
'molecular_mass': 28.014,
'molar_mass': 28.014,
'inchi': 'InChI=1S/N2/c1-2',
'inchi_key': 'IJGRMHOSHXDMSA-UHFFFAOYSA-N',
'cas_number': '7727-37-9',
Expand All @@ -80,7 +80,7 @@
'pub_chem_id': 977,
'iupac_name': 'molecular oxygen',
'molecular_formula': 'O2',
'molecular_mass': 32.00,
'molar_mass': 32.00,
'inchi': 'InChI=1S/O2/c1-2',
'inchi_key': 'MYMOFIZGZYHOMD-UHFFFAOYSA-N',
'cas_number': '7782-44-7',
Expand All @@ -91,7 +91,7 @@
'pub_chem_id': 297,
'iupac_name': 'methane',
'molecular_formula': 'CH4',
'molecular_mass': 16.043,
'molar_mass': 16.043,
'inchi': 'InChI=1S/CH4/h1H4',
'inchi_key': 'VNWKTOKETHGBQD-UHFFFAOYSA-N',
'cas_number': '74-82-8',
Expand All @@ -101,7 +101,7 @@
'pub_chem_id': 6324,
'iupac_name': 'ethane',
'molecular_formula': 'C2H6',
'molecular_mass': 30.07,
'molar_mass': 30.07,
'inchi': 'InChI=1S/C2H6/c1-2/h1-2H3',
'inchi_key': 'OTMSDBZUPAUEDD-UHFFFAOYSA-N',
'cas_number': '74-84-0',
Expand All @@ -111,7 +111,7 @@
'pub_chem_id': 6325,
'iupac_name': 'ethene',
'molecular_formula': 'C2H4',
'molecular_mass': 28.05,
'molar_mass': 28.05,
'inchi': 'InChI=1S/C2H4/c1-2/h1-2H2',
'inchi_key': 'VGGSQFUCUMXWEO-UHFFFAOYSA-N',
'cas_number': '74-85-1',
Expand All @@ -122,7 +122,7 @@
'pub_chem_id': 6326,
'iupac_name': 'ethyne',
'molecular_formula': 'C2H2',
'molecular_mass': 26.04,
'molar_mass': 26.04,
'inchi': 'InChI=1S/C2H2/c1-2/h1-2H',
'inchi_key': 'HSFWRNGVRCDJHI-UHFFFAOYSA-N',
'cas_number': '74-86-2',
Expand All @@ -134,16 +134,17 @@
'pub_chem_id': 176,
'iupac_name': 'acetic acid',
'molecular_formula': 'C2H4O2',
'molecular_mass': 60.05,
'molar_mass': 60.05,
'inchi': 'InChI=1S/C2H4O2/c1-2(3)4/h1H3,(H,3,4)',
'inchi_key': 'QTBSBXVTEAMEQO-UHFFFAOYSA-N',
'cas_number': '64-19-7',
},
'aceticacid': 'acetic acid', # Reference to 'acetic acid'
'propane': {
'pub_chem_id': 6334,
'iupac_name': 'propane',
'molecular_formula': 'C3H8',
'molecular_mass': 44.10,
'molar_mass': 44.10,
'inchi': 'InChI=1S/C3H8/c1-3-2/h3H2,1-2H3',
'inchi_key': 'ATUOYWHBWRKTHZ-UHFFFAOYSA-N',
'cas_number': '74-98-6',
Expand All @@ -153,7 +154,7 @@
'pub_chem_id': 8252,
'iupac_name': 'prop-1-ene',
'molecular_formula': 'C3H6',
'molecular_mass': 42.08,
'molar_mass': 42.08,
'inchi': 'InChI=1S/C3H6/c1-3-2/h3H,1H2,2H3',
'cas_number': '115-07-1',
},
Expand All @@ -163,7 +164,7 @@
'pub_chem_id': 6335,
'iupac_name': 'propyne',
'molecular_formula': 'C3H4',
'molecular_mass': 40.06,
'molar_mass': 40.06,
'inchi': 'InChI=1S/C3H4/c1-3-2/h1H,3H2',
},
'propine': 'propyne', # Reference to 'propyne'
Expand All @@ -172,7 +173,7 @@
'pub_chem_id': 6581,
'iupac_name': 'prop-2-enoic acid',
'molecular_formula': 'C3H4O2',
'molecular_mass': 72.06,
'molar_mass': 72.06,
'inchi': 'InChI=1S/C3H4O2/c1-2-3(4)5/h2H,1H2,(H,4,5)',
'inchi_key': 'NIXOWILDQLNWCW-UHFFFAOYSA-N',
'cas_number': '79-10-7',
Expand All @@ -182,7 +183,7 @@
'pub_chem_id': 177,
'iupac_name': 'acetaldehyde',
'molecular_formula': 'C2H4O',
'molecular_mass': 44.05,
'molar_mass': 44.05,
'inchi': 'InChI=1S/C2H4O/c1-2-3/h2H,1H3',
'inchi_key': 'IKHGUXGNUITLKF-UHFFFAOYSA-N',
'cas_number': '75-07-0',
Expand All @@ -191,17 +192,25 @@
'pub_chem_id': 7843,
'iupac_name': 'butane',
'molecular_formula': 'C4H10',
'molecular_mass': 58.12,
'molar_mass': 58.12,
'inchi': 'InChI=1S/C4H10/c1-3-4-2/h3-4H2,1-2H3',
'inchi_key': 'KDXKERNSBIXSRK-UHFFFAOYSA-N',
'cas_number': '106-97-8',
},
'n-butane': 'butane', # Reference to 'butane'
'nbutane': 'butane', # Reference to 'butane'
'2-methylpropane': {
'pub_chem_id': 6360,
'iupac_name': '2-methylpropane',
'molecular_formula': 'C4H10',
'molar_mass': 58.12,
},
'isobutane': '2-methylpropane',
'ethanol': {
'pub_chem_id': 702,
'iupac_name': 'ethanol',
'molecular_formula': 'C2H6O',
'molecular_mass': 46.07,
'molar_mass': 46.07,
'inchi': 'InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3',
'inchi_key': 'LFQSCWFLJHTTHZ-UHFFFAOYSA-N',
'cas_number': '64-17-5',
Expand All @@ -212,7 +221,7 @@
'pub_chem_id': 887,
'iupac_name': 'methanol',
'molecular_formula': 'CH4O',
'molecular_mass': 32.04,
'molar_mass': 32.04,
'inchi': 'InChI=1S/CH4O/c1-2/h2H,1H3',
'inchi_key': 'OKKJLVBELUTLKV-UHFFFAOYSA-N',
'cas_number': '67-56-1',
Expand All @@ -224,7 +233,7 @@
'pub_chem_id': 284,
'iupac_name': 'formic acid',
'molecular_formula': 'CH2O2',
'molecular_mass': 46.03,
'molar_mass': 46.03,
'inchi': 'InChI=1S/CH2O2/c2-1-3/h1H,(H,2,3)',
'inchi_key': 'BDAGIHXWWSANSR-UHFFFAOYSA-N',
'cas_number': '64-18-6',
Expand All @@ -235,7 +244,7 @@
'pub_chem_id': 7847,
'iupac_name': 'prop-2-enal',
'molecular_formula': 'C3H4O',
'molecular_mass': 56.06,
'molar_mass': 56.06,
'inchi': 'InChI=1S/C3H4O/c1-2-3-4/h2-3H,1H2',
},
'acrolein': 'prop-2-enal', # Reference to 'prop-2-enal'
Expand All @@ -244,15 +253,15 @@
'pub_chem_id': 527,
'iupac_name': 'propanal',
'molecular_formula': 'C3H6O',
'molecular_mass': 58.08,
'molar_mass': 58.08,
'inchi': 'InChI=1S/C3H6O/c1-2-3-4/h3H,2H,1H3',
},
'propionaldehyde': 'propanal', # Reference to 'propanal'
'propan-2-one': {
'pub_chem_id': 180,
'iupac_name': 'propan-2-one',
'molecular_formula': 'C3H6O',
'molecular_mass': 58.08,
'molar_mass': 58.08,
'inchi': 'InChI=1S/C3H6O/c1-3(2)2/h1-2H3',
'inchi_key': 'CSCPPACGZOOCGX-UHFFFAOYSA-N',
'cas_number': '67-64-1',
Expand All @@ -262,7 +271,7 @@
'pub_chem_id': 3776,
'iupac_name': 'propan-2-ol',
'molecular_formula': 'C3H8O',
'molecular_mass': 60.10,
'molar_mass': 60.10,
'inchi': 'InChI=1S/C3H8O/c1-3(2)4/h3-4H,1-2H3',
'inchi_key': 'KZBMWSRVAYFASW-UHFFFAOYSA-N',
'cas_number': '67-63-0',
Expand All @@ -273,7 +282,7 @@
'pub_chem_id': 7858,
'iupac_name': 'prop-2-en-1-ol',
'molecular_formula': 'C3H6O',
'molecular_mass': 58.08,
'molar_mass': 58.08,
'inchi': 'InChI=1S/C3H6O/c1-2-3-4/h2,4H,1,3H2',
'inchi_key': 'QWVGKYWNOKOFNN-UHFFFAOYSA-N',
'cas_number': '107-18-6',
Expand All @@ -283,7 +292,7 @@
'pub_chem_id': 1031,
'iupac_name': 'propan-1-ol',
'molecular_formula': 'C3H8O',
'molecular_mass': 60.10,
'molar_mass': 60.10,
'inchi': 'InChI=1S/C3H8O/c1-2-3-4/h4H,2-3H2,1H3',
'inchi_key': 'XNWBBONJTDVZCF-UHFFFAOYSA-N',
'cas_number': '71-23-8',
Expand All @@ -294,16 +303,16 @@
'pub_chem_id': 7844,
'iupac_name': 'but-1-ene',
'molecular_formula': 'C4H8',
'molecular_mass': 56.11,
'molar_mass': 56.11,
'inchi': 'InChI=1S/C4H8/c1-3-4-2/h3H,1,4H2,2H3',
},
'butylene': '1-butene', # Reference to '1-butene'
'n-Butene': '1-butene', # Reference to '1-butene'
'' 'furan': {
'furan': {
'pub_chem_id': 8029,
'iupac_name': 'furan',
'molecular_formula': 'C4H4O',
'molecular_mass': 68.07,
'molar_mass': 68.07,
'inchi': 'InChI=1S/C4H4O/c1-2-4-5-3-1/h1-4H',
'inchi_key': 'NNTHXFGICWXRPZ-UHFFFAOYSA-N',
'cas_number': '110-00-9',
Expand All @@ -313,7 +322,7 @@
'pub_chem_id': 7923,
'iupac_name': 'furan-2,5-dione',
'molecular_formula': 'C4H2O3',
'molecular_mass': 98.06,
'molar_mass': 98.06,
'inchi': 'InChI=1S/C4H2O3/c5-3-1-2-4(6)7-3/h1-2H',
},
'maleic anhydride': 'furan-2,5-dione', # Reference to 'furan-2,5-dione'
Expand Down

0 comments on commit cc43e82

Please sign in to comment.