diff --git a/simulationdataschema/general.py b/simulationdataschema/general.py index aa0b6ada..13fcfc41 100644 --- a/simulationdataschema/general.py +++ b/simulationdataschema/general.py @@ -54,27 +54,20 @@ from nomad.datamodel.metainfo.basesections import Simulation as BaseSimulation from nomad.metainfo import SubSection from .model_system import ModelSystem +from .model_method import ModelMethod +from .outputs import Outputs class Simulation(BaseSimulation, EntryData): """ """ # m_def = Section(extends_base_section=True) + model_system = SubSection(sub_section=ModelSystem.m_def, repeats=True) - # method = SubSection( - # sub_section=Method.m_def, - # description=''' - # The input methodological parameters used for the computation. - # ''', - # repeats=True, - # ) - # calculation = SubSection( - # sub_section=Calculation.m_def, - # description=''' - # The output of a computation. It can reference a specific system and method section. - # ''', - # repeats=True, - # ) + + model_method = SubSection(sub_section=ModelMethod.m_def, repeats=True) + + outputs = SubSection(sub_section=Outputs.m_def, repeats=True) def _set_system_tree_index(self, system_parent: ModelSystem, tree_index: int = 0): for system_child in system_parent.model_system: diff --git a/simulationdataschema/model_method.py b/simulationdataschema/model_method.py new file mode 100644 index 00000000..26d0bda1 --- /dev/null +++ b/simulationdataschema/model_method.py @@ -0,0 +1,52 @@ +# +# Copyright The NOMAD Authors. +# +# This file is part of NOMAD. See https://nomad-lab.eu for further info. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Copyright The NOMAD Authors. +# +# This file is part of NOMAD. +# See https://nomad-lab.eu for further info. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import re +import numpy as np + +from nomad.units import ureg +from nomad.datamodel.data import ArchiveSection +from nomad.metainfo import Quantity, SubSection, SectionProxy, MEnum + + +class ModelMethod(ArchiveSection): + """ """ + + normalizer_level = 1 + + def normalize(self, archive, logger): + super().normalize(archive, logger) + self.logger = logger diff --git a/simulationdataschema/model_system.py b/simulationdataschema/model_system.py index 8266fad2..b98e5797 100644 --- a/simulationdataschema/model_system.py +++ b/simulationdataschema/model_system.py @@ -258,7 +258,7 @@ def normalize(self, archive, logger): return # If the labels and atomic_numbers are not specified, we return with an error - if not self.labels and not self.atomic_numbers: + if self.labels is None and self.atomic_numbers is None: logger.error( "Could not read parsed AtomicCell.labels or AtomicCell.atomic_positions." ) @@ -267,7 +267,7 @@ def normalize(self, archive, logger): atomic_numbers = self.atomic_numbers # Labels - if not atomic_labels and atomic_numbers is not None: + if atomic_labels is None and atomic_numbers is not None: try: atomic_labels = [ ase.data.chemical_symbols[number] for number in atomic_numbers @@ -286,7 +286,7 @@ def normalize(self, archive, logger): self.m_cache["ase_atoms"] = ase_atoms # Atomic numbers - if atomic_labels is not None and not atomic_numbers: + if atomic_labels is not None and atomic_numbers is None: atomic_numbers = ase_atoms.get_atomic_numbers() self.atomic_numbers = atomic_numbers diff --git a/simulationdataschema/outputs.py b/simulationdataschema/outputs.py new file mode 100644 index 00000000..f0230b9f --- /dev/null +++ b/simulationdataschema/outputs.py @@ -0,0 +1,52 @@ +# +# Copyright The NOMAD Authors. +# +# This file is part of NOMAD. See https://nomad-lab.eu for further info. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Copyright The NOMAD Authors. +# +# This file is part of NOMAD. +# See https://nomad-lab.eu for further info. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import re +import numpy as np + +from nomad.units import ureg +from nomad.datamodel.data import ArchiveSection +from nomad.metainfo import Quantity, SubSection, SectionProxy, MEnum + + +class Outputs(ArchiveSection): + """ """ + + normalizer_level = 2 + + def normalize(self, archive, logger): + super().normalize(archive, logger) + self.logger = logger