From 9dc62d0bbdc0f1f5f17e6d258d9da0372104d8d6 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Fri, 9 Feb 2024 09:52:07 +0100 Subject: [PATCH] Fixed imports by moving utils under simulationdataschema/ Fix creating of Symmetry and ChemicalFormula --- simulationdataschema/model_system.py | 10 ++++------ {utils => simulationdataschema/utils}/__init__.py | 0 {utils => simulationdataschema/utils}/utils.py | 0 3 files changed, 4 insertions(+), 6 deletions(-) rename {utils => simulationdataschema/utils}/__init__.py (100%) rename {utils => simulationdataschema/utils}/utils.py (100%) diff --git a/simulationdataschema/model_system.py b/simulationdataschema/model_system.py index ffe7eb30..e913addf 100644 --- a/simulationdataschema/model_system.py +++ b/simulationdataschema/model_system.py @@ -59,7 +59,7 @@ from nomad.datamodel.metainfo.basesections import System, GeometricSpace from nomad.datamodel.metainfo.annotations import ELNAnnotation -from ..utils import get_sub_section_from_section_parent +from .utils import get_sub_section_from_section_parent class AtomicCell(GeometricSpace): @@ -555,7 +555,7 @@ class ChemicalFormula(ArchiveSection): """, ) - def resolve_chemical_formulas(self, formula): + def resolve_chemical_formulas(self, formula: Formula): """ Resolves the chemical formulas of the `ModelSystem` in different formats. @@ -833,15 +833,13 @@ def normalize(self, archive, logger): ) = self.resolve_system_type_and_dimensionality(ase_atoms) # Creating and normalizing Symmetry section if self.type == "bulk" and self.symmetry is not None: - sec_symmetry = Symmetry() + sec_symmetry = self.m_create(Symmetry) sec_symmetry.normalize(archive, logger) - self.symmetry.append(sec_symmetry) # Creating and normalizing ChemicalFormula section # TODO add support for fractional formulas (possibly add `AtomicCell.concentrations` for each species) - sec_chemical_formula = ChemicalFormula() + sec_chemical_formula = self.m_create(ChemicalFormula) sec_chemical_formula.normalize(archive, logger) - self.chemical_formula.append(sec_chemical_formula) if sec_chemical_formula.m_cache: self.elemental_composition = sec_chemical_formula.m_cache.get( "elemental_composition", [] diff --git a/utils/__init__.py b/simulationdataschema/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to simulationdataschema/utils/__init__.py diff --git a/utils/utils.py b/simulationdataschema/utils/utils.py similarity index 100% rename from utils/utils.py rename to simulationdataschema/utils/utils.py