Skip to content

Commit

Permalink
Make chemical formula generation and normalization of atom types cond…
Browse files Browse the repository at this point in the history
…itional
  • Loading branch information
Bernadette-Mohr committed Nov 27, 2024
1 parent 4f1692a commit a3805c2
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/nomad_simulations/schema_packages/model_system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
import sys
from typing import TYPE_CHECKING, Optional

import ase
Expand Down Expand Up @@ -1304,11 +1305,16 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
sec_symmetry = self.m_create(Symmetry)
sec_symmetry.normalize(archive, logger)

print(self.model_system)
print(self.cell[0])
print(self.cell[0].particles_state[0].particle_type)
sys.exit()
# Creating and normalizing ChemicalFormula section
# TODO add support for fractional formulas (possibly add `AtomicCell.concentrations` for each species)
sec_chemical_formula = self.m_create(ChemicalFormula)
sec_chemical_formula.normalize(archive, logger)
if sec_chemical_formula.m_cache:
self.elemental_composition = sec_chemical_formula.m_cache.get(
'elemental_composition', []
)
if self.cell[0].name == 'AtomicCell':
# TODO add support for fractional formulas (possibly add `AtomicCell.concentrations` for each species)
sec_chemical_formula = self.m_create(ChemicalFormula)
sec_chemical_formula.normalize(archive, logger)
if sec_chemical_formula.m_cache:
self.elemental_composition = sec_chemical_formula.m_cache.get(
'elemental_composition', []
)

0 comments on commit a3805c2

Please sign in to comment.