Commit b442a460 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Improved sample normalization to consider formula and names to derive missing elements.

parent 3deb86a1
Pipeline #121360 passed with stages
in 28 minutes and 54 seconds
......@@ -140,6 +140,18 @@ class ResultsNormalizer(Normalizer):
sample = measurement.sample[0]
if len(sample.elements) > 0:
material.elements = sample.elements
else:
# Try to guess elements from sample formula or name
if sample.chemical_formula:
try:
material.elements = ase.Atoms(sample.chemical_formula).get_chemical_symbols()
except Exception:
if sample.name:
try:
material.elements = ase.Atoms(sample.name).get_chemical_symbols()
except Exception:
pass
if sample.chemical_formula:
material.chemical_formula_descriptive = sample.chemical_formula
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment