From 1e5a1dc3f0de8788e02860ec7bbaab4d7ee7203d Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Tue, 24 Sep 2024 10:13:12 +0200 Subject: [PATCH 1/6] Fix warning spectral_profile Fix README Move testing files to subfolders to mimic src structure --- README.md | 17 ++++++++++++--- .../properties/spectral_profile.py | 2 +- tests/properties/__init__.py | 21 +++++++++++++++++++ tests/{ => properties}/test_band_gap.py | 0 tests/{ => properties}/test_band_structure.py | 0 tests/{ => properties}/test_energies.py | 0 tests/{ => properties}/test_fermi_surface.py | 0 tests/{ => properties}/test_forces.py | 0 .../{ => properties}/test_greens_function.py | 0 tests/{ => properties}/test_hopping_matrix.py | 0 tests/{ => properties}/test_permittivity.py | 0 .../{ => properties}/test_spectral_profile.py | 0 tests/utils/__init__.py | 21 +++++++++++++++++++ tests/{ => utils}/test_utils.py | 0 14 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 tests/properties/__init__.py rename tests/{ => properties}/test_band_gap.py (100%) rename tests/{ => properties}/test_band_structure.py (100%) rename tests/{ => properties}/test_energies.py (100%) rename tests/{ => properties}/test_fermi_surface.py (100%) rename tests/{ => properties}/test_forces.py (100%) rename tests/{ => properties}/test_greens_function.py (100%) rename tests/{ => properties}/test_hopping_matrix.py (100%) rename tests/{ => properties}/test_permittivity.py (100%) rename tests/{ => properties}/test_spectral_profile.py (100%) create mode 100644 tests/utils/__init__.py rename tests/{ => utils}/test_utils.py (100%) diff --git a/README.md b/README.md index 8bf9ba1d..a9314655 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,20 @@ # `nomad-simulations` -This is a plugin for [NOMAD](https://nomad-lab.eu) which contains the base sections definitions for materials science simulations. This schema can be used at any prefered level by the user, it can be modified and extended, and we welcome external collaborators. +The `nomad-simulations` is an open-source Python package for managing Materials Science simulation data. It is following the plugin architechture of [NOMAD](https://nomad-lab.eu). This package contains a set of section definitions (Python classes) with quantities (attributes) and methods defined to automate data extraction from different simulation codes. These section definitions can be used at any prefered level by the user, they can be modified and extended, and we welcome external collaborators. + +Read more in the [official documentation](https://nomad-coe.github.io/nomad-simulations/) page. ## Getting started `nomad-simulations` can be installed as a PyPI package using `pip`: + +> [!WARNING] +> Unfortunately, the current plugin mechanism is not supported by the latest nomad-lab version on PyPI and therefore an index url pointing to the NOMAD Gitlab registry needs to be added. + ```sh -pip install nomad-simulations +pip install nomad-simulations --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple ``` @@ -49,6 +55,11 @@ The plugin is still under development. If you would like to contribute, install uv pip install -e '.[dev]' ``` +**Note:** If you do not use `uv`, you need to add the `--index-url` flag as in the PyPI command for installing the package: +```sh +pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple +``` + ### Run the tests @@ -139,7 +150,7 @@ Read the [NOMAD plugin documentation](https://nomad-lab.eu/prod/v1/staging/docs/ Modify the script under `/nomad/scripts/install_default_plugins.sh` and add the path to this repository pointing to the `@develop` branch: ```sh -pip install git+https://github.com/nomad-coe/nomad-simulations.git@develop +git+https://github.com/nomad-coe/nomad-simulations.git@develop ``` Then, go to your NOMAD folder, activate your NOMAD virtual environment and run: diff --git a/src/nomad_simulations/schema_packages/properties/spectral_profile.py b/src/nomad_simulations/schema_packages/properties/spectral_profile.py index 2f086007..743cf289 100644 --- a/src/nomad_simulations/schema_packages/properties/spectral_profile.py +++ b/src/nomad_simulations/schema_packages/properties/spectral_profile.py @@ -109,7 +109,7 @@ def resolve_pdos_name(self, logger: 'BoundLogger') -> Optional[str]: Returns: (Optional[str]): The resolved `name` of the projected DOS profile. """ - if self.entity_ref is None: + if self.entity_ref is None and not self.name == 'ElectronicDensityOfStates': logger.warning( 'The `entity_ref` is not set for the DOS profile. Could not resolve the `name`.' ) diff --git a/tests/properties/__init__.py b/tests/properties/__init__.py new file mode 100644 index 00000000..52e83b1e --- /dev/null +++ b/tests/properties/__init__.py @@ -0,0 +1,21 @@ +# +# 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. +# + +from nomad import utils + +logger = utils.get_logger(__name__) diff --git a/tests/test_band_gap.py b/tests/properties/test_band_gap.py similarity index 100% rename from tests/test_band_gap.py rename to tests/properties/test_band_gap.py diff --git a/tests/test_band_structure.py b/tests/properties/test_band_structure.py similarity index 100% rename from tests/test_band_structure.py rename to tests/properties/test_band_structure.py diff --git a/tests/test_energies.py b/tests/properties/test_energies.py similarity index 100% rename from tests/test_energies.py rename to tests/properties/test_energies.py diff --git a/tests/test_fermi_surface.py b/tests/properties/test_fermi_surface.py similarity index 100% rename from tests/test_fermi_surface.py rename to tests/properties/test_fermi_surface.py diff --git a/tests/test_forces.py b/tests/properties/test_forces.py similarity index 100% rename from tests/test_forces.py rename to tests/properties/test_forces.py diff --git a/tests/test_greens_function.py b/tests/properties/test_greens_function.py similarity index 100% rename from tests/test_greens_function.py rename to tests/properties/test_greens_function.py diff --git a/tests/test_hopping_matrix.py b/tests/properties/test_hopping_matrix.py similarity index 100% rename from tests/test_hopping_matrix.py rename to tests/properties/test_hopping_matrix.py diff --git a/tests/test_permittivity.py b/tests/properties/test_permittivity.py similarity index 100% rename from tests/test_permittivity.py rename to tests/properties/test_permittivity.py diff --git a/tests/test_spectral_profile.py b/tests/properties/test_spectral_profile.py similarity index 100% rename from tests/test_spectral_profile.py rename to tests/properties/test_spectral_profile.py diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py new file mode 100644 index 00000000..52e83b1e --- /dev/null +++ b/tests/utils/__init__.py @@ -0,0 +1,21 @@ +# +# 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. +# + +from nomad import utils + +logger = utils.get_logger(__name__) diff --git a/tests/test_utils.py b/tests/utils/test_utils.py similarity index 100% rename from tests/test_utils.py rename to tests/utils/test_utils.py From 4148339d825a491d66e657d45e0ae5ec724ad030 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Tue, 24 Sep 2024 10:17:57 +0200 Subject: [PATCH 2/6] Deleted copyright notice at the beginning of each file: it does not make any sense to have it... --- .../schema_packages/__init__.py | 18 ------------- .../schema_packages/atoms_state.py | 18 ------------- .../schema_packages/general.py | 18 ------------- .../schema_packages/model_method.py | 18 ------------- .../schema_packages/model_system.py | 18 ------------- .../schema_packages/numerical_settings.py | 18 ------------- .../schema_packages/outputs.py | 18 ------------- .../schema_packages/physical_property.py | 18 ------------- .../schema_packages/properties/__init__.py | 18 ------------- .../schema_packages/properties/band_gap.py | 18 ------------- .../properties/band_structure.py | 18 ------------- .../schema_packages/properties/energies.py | 18 ------------- .../properties/fermi_surface.py | 18 ------------- .../schema_packages/properties/forces.py | 19 -------------- .../properties/greens_function.py | 18 ------------- .../properties/hopping_matrix.py | 18 ------------- .../properties/permittivity.py | 18 ------------- .../properties/spectral_profile.py | 18 ------------- .../properties/thermodynamics.py | 18 ------------- .../schema_packages/utils/__init__.py | 18 ------------- .../schema_packages/utils/utils.py | 26 ------------------- .../schema_packages/variables.py | 18 ------------- tests/__init__.py | 18 ------------- tests/conftest.py | 18 ------------- tests/test_atoms_state.py | 18 ------------- tests/test_general.py | 18 ------------- tests/test_model_method.py | 18 ------------- tests/test_model_system.py | 18 ------------- tests/test_numerical_settings.py | 18 ------------- tests/test_outputs.py | 18 ------------- tests/test_physical_properties.py | 18 ------------- tests/test_variables.py | 18 ------------- 32 files changed, 585 deletions(-) diff --git a/src/nomad_simulations/schema_packages/__init__.py b/src/nomad_simulations/schema_packages/__init__.py index d7b6e939..8b730793 100644 --- a/src/nomad_simulations/schema_packages/__init__.py +++ b/src/nomad_simulations/schema_packages/__init__.py @@ -1,21 +1,3 @@ -# -# 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. -# - from nomad.config.models.plugins import SchemaPackageEntryPoint from pydantic import Field diff --git a/src/nomad_simulations/schema_packages/atoms_state.py b/src/nomad_simulations/schema_packages/atoms_state.py index 72ddb2f3..32fbdd11 100644 --- a/src/nomad_simulations/schema_packages/atoms_state.py +++ b/src/nomad_simulations/schema_packages/atoms_state.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Any, Optional, Union import ase diff --git a/src/nomad_simulations/schema_packages/general.py b/src/nomad_simulations/schema_packages/general.py index d38de349..9a2d48f0 100644 --- a/src/nomad_simulations/schema_packages/general.py +++ b/src/nomad_simulations/schema_packages/general.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING if TYPE_CHECKING: diff --git a/src/nomad_simulations/schema_packages/model_method.py b/src/nomad_simulations/schema_packages/model_method.py index 2ef35b89..ac5daa82 100644 --- a/src/nomad_simulations/schema_packages/model_method.py +++ b/src/nomad_simulations/schema_packages/model_method.py @@ -1,21 +1,3 @@ -# -# 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 from typing import TYPE_CHECKING, Optional diff --git a/src/nomad_simulations/schema_packages/model_system.py b/src/nomad_simulations/schema_packages/model_system.py index e6276a3f..2408dd44 100644 --- a/src/nomad_simulations/schema_packages/model_system.py +++ b/src/nomad_simulations/schema_packages/model_system.py @@ -1,21 +1,3 @@ -# -# 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 from typing import TYPE_CHECKING, Optional diff --git a/src/nomad_simulations/schema_packages/numerical_settings.py b/src/nomad_simulations/schema_packages/numerical_settings.py index 4a36e8f1..515deea7 100644 --- a/src/nomad_simulations/schema_packages/numerical_settings.py +++ b/src/nomad_simulations/schema_packages/numerical_settings.py @@ -1,21 +1,3 @@ -# -# 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. -# - from itertools import accumulate, chain, tee from typing import TYPE_CHECKING, Optional, Union diff --git a/src/nomad_simulations/schema_packages/outputs.py b/src/nomad_simulations/schema_packages/outputs.py index 4b673ef9..1491fda3 100644 --- a/src/nomad_simulations/schema_packages/outputs.py +++ b/src/nomad_simulations/schema_packages/outputs.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Optional import numpy as np diff --git a/src/nomad_simulations/schema_packages/physical_property.py b/src/nomad_simulations/schema_packages/physical_property.py index af478fc0..5bb728bc 100644 --- a/src/nomad_simulations/schema_packages/physical_property.py +++ b/src/nomad_simulations/schema_packages/physical_property.py @@ -1,21 +1,3 @@ -# -# 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. -# - from functools import wraps from typing import TYPE_CHECKING, Any, Optional diff --git a/src/nomad_simulations/schema_packages/properties/__init__.py b/src/nomad_simulations/schema_packages/properties/__init__.py index 435738cc..69470a4f 100644 --- a/src/nomad_simulations/schema_packages/properties/__init__.py +++ b/src/nomad_simulations/schema_packages/properties/__init__.py @@ -1,21 +1,3 @@ -# -# 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. - from .band_gap import ElectronicBandGap from .band_structure import ElectronicBandStructure, ElectronicEigenvalues, Occupancy from .energies import ( diff --git a/src/nomad_simulations/schema_packages/properties/band_gap.py b/src/nomad_simulations/schema_packages/properties/band_gap.py index ee7c12dd..05c1ba57 100644 --- a/src/nomad_simulations/schema_packages/properties/band_gap.py +++ b/src/nomad_simulations/schema_packages/properties/band_gap.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Optional import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/band_structure.py b/src/nomad_simulations/schema_packages/properties/band_structure.py index f2c89b5f..c5e169b0 100644 --- a/src/nomad_simulations/schema_packages/properties/band_structure.py +++ b/src/nomad_simulations/schema_packages/properties/band_structure.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Optional, Union import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/energies.py b/src/nomad_simulations/schema_packages/properties/energies.py index 7ab68fe7..c726c4da 100644 --- a/src/nomad_simulations/schema_packages/properties/energies.py +++ b/src/nomad_simulations/schema_packages/properties/energies.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/fermi_surface.py b/src/nomad_simulations/schema_packages/properties/fermi_surface.py index 9829bff0..231e15ed 100644 --- a/src/nomad_simulations/schema_packages/properties/fermi_surface.py +++ b/src/nomad_simulations/schema_packages/properties/fermi_surface.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/forces.py b/src/nomad_simulations/schema_packages/properties/forces.py index b47048f6..cedf72f1 100644 --- a/src/nomad_simulations/schema_packages/properties/forces.py +++ b/src/nomad_simulations/schema_packages/properties/forces.py @@ -1,22 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/greens_function.py b/src/nomad_simulations/schema_packages/properties/greens_function.py index 51928a84..3da09e53 100644 --- a/src/nomad_simulations/schema_packages/properties/greens_function.py +++ b/src/nomad_simulations/schema_packages/properties/greens_function.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/hopping_matrix.py b/src/nomad_simulations/schema_packages/properties/hopping_matrix.py index 795ce5fb..094c901d 100644 --- a/src/nomad_simulations/schema_packages/properties/hopping_matrix.py +++ b/src/nomad_simulations/schema_packages/properties/hopping_matrix.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/permittivity.py b/src/nomad_simulations/schema_packages/properties/permittivity.py index 553dce5d..aeede940 100644 --- a/src/nomad_simulations/schema_packages/properties/permittivity.py +++ b/src/nomad_simulations/schema_packages/properties/permittivity.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Optional import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/spectral_profile.py b/src/nomad_simulations/schema_packages/properties/spectral_profile.py index 743cf289..8078ff3d 100644 --- a/src/nomad_simulations/schema_packages/properties/spectral_profile.py +++ b/src/nomad_simulations/schema_packages/properties/spectral_profile.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Optional import numpy as np diff --git a/src/nomad_simulations/schema_packages/properties/thermodynamics.py b/src/nomad_simulations/schema_packages/properties/thermodynamics.py index 0bcf9d7c..d6135943 100644 --- a/src/nomad_simulations/schema_packages/properties/thermodynamics.py +++ b/src/nomad_simulations/schema_packages/properties/thermodynamics.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING import numpy as np diff --git a/src/nomad_simulations/schema_packages/utils/__init__.py b/src/nomad_simulations/schema_packages/utils/__init__.py index dc4e7ea4..52d9ca22 100644 --- a/src/nomad_simulations/schema_packages/utils/__init__.py +++ b/src/nomad_simulations/schema_packages/utils/__init__.py @@ -1,21 +1,3 @@ -# -# 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. - from .utils import ( RussellSaundersState, get_composition, diff --git a/src/nomad_simulations/schema_packages/utils/utils.py b/src/nomad_simulations/schema_packages/utils/utils.py index e925b53b..1c689933 100644 --- a/src/nomad_simulations/schema_packages/utils/utils.py +++ b/src/nomad_simulations/schema_packages/utils/utils.py @@ -1,27 +1,7 @@ -# -# 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. -# - from math import factorial from typing import TYPE_CHECKING import numpy as np -from nomad.config import config if TYPE_CHECKING: from typing import Optional @@ -29,12 +9,6 @@ from nomad.datamodel.data import ArchiveSection from structlog.stdlib import BoundLogger - from nomad_simulations.schema_packages.model_system import Cell - -configuration = config.get_plugin_entry_point( - 'nomad_simulations.schema_packages:nomad_simulations_plugin' -) - def get_sibling_section( section: 'ArchiveSection', diff --git a/src/nomad_simulations/schema_packages/variables.py b/src/nomad_simulations/schema_packages/variables.py index ce02cfbb..34e3c8c4 100644 --- a/src/nomad_simulations/schema_packages/variables.py +++ b/src/nomad_simulations/schema_packages/variables.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import TYPE_CHECKING, Optional import numpy as np diff --git a/tests/__init__.py b/tests/__init__.py index 52e83b1e..5cdfd197 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,21 +1,3 @@ -# -# 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. -# - from nomad import utils logger = utils.get_logger(__name__) diff --git a/tests/conftest.py b/tests/conftest.py index 02c25e41..c68c036b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,21 +1,3 @@ -# -# 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 os from typing import Optional diff --git a/tests/test_atoms_state.py b/tests/test_atoms_state.py index dd2aa70c..081aa81f 100644 --- a/tests/test_atoms_state.py +++ b/tests/test_atoms_state.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional, Union import numpy as np diff --git a/tests/test_general.py b/tests/test_general.py index 06a360c9..a693f33c 100644 --- a/tests/test_general.py +++ b/tests/test_general.py @@ -1,21 +1,3 @@ -# -# 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 numpy as np import pytest from nomad.datamodel import EntryArchive diff --git a/tests/test_model_method.py b/tests/test_model_method.py index 7e51e22d..6f6e6393 100644 --- a/tests/test_model_method.py +++ b/tests/test_model_method.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import pytest diff --git a/tests/test_model_system.py b/tests/test_model_system.py index e189ace8..51afe5b6 100644 --- a/tests/test_model_system.py +++ b/tests/test_model_system.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import numpy as np diff --git a/tests/test_numerical_settings.py b/tests/test_numerical_settings.py index 70ab30da..6426b4cd 100644 --- a/tests/test_numerical_settings.py +++ b/tests/test_numerical_settings.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import numpy as np diff --git a/tests/test_outputs.py b/tests/test_outputs.py index a048b8ec..ba9d8149 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import pytest diff --git a/tests/test_physical_properties.py b/tests/test_physical_properties.py index b9e9e1bf..02ad7f7a 100644 --- a/tests/test_physical_properties.py +++ b/tests/test_physical_properties.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional, Union import numpy as np diff --git a/tests/test_variables.py b/tests/test_variables.py index c64faf91..f9fc3312 100644 --- a/tests/test_variables.py +++ b/tests/test_variables.py @@ -1,21 +1,3 @@ -# -# 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 pytest from nomad.datamodel import EntryArchive From 13658de6f6441b04674a7b8de2e2037eed0d31ed Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Tue, 24 Sep 2024 10:21:25 +0200 Subject: [PATCH 3/6] Changed __eq__ (and __ne__) for function is_equal_cell --- .../schema_packages/model_system.py | 35 +++++++++++++------ tests/test_model_system.py | 14 ++++---- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/nomad_simulations/schema_packages/model_system.py b/src/nomad_simulations/schema_packages/model_system.py index 2408dd44..0a1897d1 100644 --- a/src/nomad_simulations/schema_packages/model_system.py +++ b/src/nomad_simulations/schema_packages/model_system.py @@ -290,7 +290,14 @@ def _check_positions(self, positions_1, positions_2) -> list: break return check_positions - def __eq__(self, other) -> bool: + def is_equal_cell(self, other) -> bool: + """ + Check if the cell is equal to an`other` cell by comparing the `positions`. + Args: + other: The other cell to compare with. + Returns: + bool: True if the cells are equal, False otherwise. + """ # TODO implement checks on `lattice_vectors` and other quantities to ensure the equality of primitive cells if not isinstance(other, Cell): return False @@ -304,14 +311,13 @@ def __eq__(self, other) -> bool: return False n_positions = len(self.positions) - check_positions = self._check_positions(self.positions, other.positions) + check_positions = self._check_positions( + positions_1=self.positions, positions_2=other.positions + ) if len(check_positions) != n_positions: return False return True - def __ne__(self, other) -> bool: - return not self.__eq__(other) - def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: super().normalize(archive, logger) @@ -355,16 +361,26 @@ def __init__(self, m_def: 'Section' = None, m_context: 'Context' = None, **kwarg # Set the name of the section self.name = self.m_def.name - def __eq__(self, other) -> bool: + def is_equal_cell(self, other) -> bool: + """ + Check if the atomic cell is equal to an`other` atomic cell by comparing the `positions` and + the `AtomsState[*].chemical_symbol`. + Args: + other: The other atomic cell to compare with. + Returns: + bool: True if the atomic cells are equal, False otherwise. + """ if not isinstance(other, AtomicCell): return False # Compare positions using the parent sections's `__eq__` method - if not super().__eq__(other): + if not super().is_equal_cell(other=other): return False # Check that the `chemical_symbol` of the atoms in `cell_1` match with the ones in `cell_2` - check_positions = self._check_positions(self.positions, other.positions) + check_positions = self._check_positions( + positions_1=self.positions, positions_2=other.positions + ) try: for atom in check_positions: element_1 = self.atoms_state[atom[0]].chemical_symbol @@ -375,9 +391,6 @@ def __eq__(self, other) -> bool: return False return True - def __ne__(self, other) -> bool: - return not self.__eq__(other) - def to_ase_atoms(self, logger: 'BoundLogger') -> Optional[ase.Atoms]: """ Generates an ASE Atoms object with the most basic information from the parsed `AtomicCell` diff --git a/tests/test_model_system.py b/tests/test_model_system.py index 51afe5b6..87ecd33b 100644 --- a/tests/test_model_system.py +++ b/tests/test_model_system.py @@ -54,12 +54,11 @@ class TestCell: ), # different ordered positions but same cell ], ) - def test_eq_ne(self, cell_1: Cell, cell_2: Cell, result: bool): + def test_is_equal_cell(self, cell_1: Cell, cell_2: Cell, result: bool): """ - Test the `__eq__` and `__ne__` operator functions of `Cell`. + Test the `is_equal_cell` methods of `Cell`. """ - assert (cell_1 == cell_2) == result - assert (cell_1 != cell_2) != result + assert cell_1.is_equal_cell(other=cell_2) == result class TestAtomicCell: @@ -166,12 +165,11 @@ class TestAtomicCell: ), # different ordered positions but same chemical symbols ], ) - def test_eq_ne(self, cell_1: Cell, cell_2: Cell, result: bool): + def test_is_equal_cell(self, cell_1: Cell, cell_2: Cell, result: bool): """ - Test the `__eq__` and `__ne__` operator functions of `AtomicCell`. + Test the `is_equal_cell` methods of `AtomicCell`. """ - assert (cell_1 == cell_2) == result - assert (cell_1 != cell_2) != result + assert cell_1.is_equal_cell(other=cell_2) == result @pytest.mark.parametrize( 'chemical_symbols, atomic_numbers, formula, lattice_vectors, positions, periodic_boundary_conditions', From 3f77b857c0964165d8c2659bc5274f50f3cfc718 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Tue, 24 Sep 2024 10:25:28 +0200 Subject: [PATCH 4/6] Fix conftest imports Deleted configuration in wrong modules --- src/nomad_simulations/schema_packages/model_system.py | 5 ----- .../schema_packages/properties/band_structure.py | 5 ----- .../schema_packages/properties/spectral_profile.py | 5 ----- tests/properties/test_band_structure.py | 2 +- tests/properties/test_permittivity.py | 2 +- 5 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/nomad_simulations/schema_packages/model_system.py b/src/nomad_simulations/schema_packages/model_system.py index 0a1897d1..4804916d 100644 --- a/src/nomad_simulations/schema_packages/model_system.py +++ b/src/nomad_simulations/schema_packages/model_system.py @@ -14,7 +14,6 @@ Surface, ) from nomad.atomutils import Formula, get_normalized_wyckoff, search_aflow_prototype -from nomad.config import config from nomad.datamodel.data import ArchiveSection from nomad.datamodel.metainfo.annotations import ELNAnnotation from nomad.datamodel.metainfo.basesections import Entity, System @@ -32,10 +31,6 @@ is_not_representative, ) -configuration = config.get_plugin_entry_point( - 'nomad_simulations.schema_packages:nomad_simulations_plugin' -) - class GeometricSpace(Entity): """ diff --git a/src/nomad_simulations/schema_packages/properties/band_structure.py b/src/nomad_simulations/schema_packages/properties/band_structure.py index c5e169b0..a5f258a9 100644 --- a/src/nomad_simulations/schema_packages/properties/band_structure.py +++ b/src/nomad_simulations/schema_packages/properties/band_structure.py @@ -2,7 +2,6 @@ import numpy as np import pint -from nomad.config import config from nomad.metainfo import Quantity, SubSection if TYPE_CHECKING: @@ -20,10 +19,6 @@ from nomad_simulations.schema_packages.properties.fermi_surface import FermiSurface from nomad_simulations.schema_packages.utils import get_sibling_section -configuration = config.get_plugin_entry_point( - 'nomad_simulations.schema_packages:nomad_simulations_plugin' -) - class BaseElectronicEigenvalues(PhysicalProperty): """ diff --git a/src/nomad_simulations/schema_packages/properties/spectral_profile.py b/src/nomad_simulations/schema_packages/properties/spectral_profile.py index 8078ff3d..b1ed076b 100644 --- a/src/nomad_simulations/schema_packages/properties/spectral_profile.py +++ b/src/nomad_simulations/schema_packages/properties/spectral_profile.py @@ -2,7 +2,6 @@ import numpy as np import pint -from nomad.config import config from nomad.metainfo import MEnum, Quantity, SubSection if TYPE_CHECKING: @@ -16,10 +15,6 @@ from nomad_simulations.schema_packages.utils import get_sibling_section, get_variables from nomad_simulations.schema_packages.variables import Energy2 as Energy -configuration = config.get_plugin_entry_point( - 'nomad_simulations.schema_packages:nomad_simulations_plugin' -) - class SpectralProfile(PhysicalProperty): """ diff --git a/tests/properties/test_band_structure.py b/tests/properties/test_band_structure.py index 1e81aab5..9f931c49 100644 --- a/tests/properties/test_band_structure.py +++ b/tests/properties/test_band_structure.py @@ -24,8 +24,8 @@ from nomad_simulations.schema_packages.properties import ElectronicEigenvalues +from ..conftest import generate_electronic_eigenvalues from . import logger -from .conftest import generate_electronic_eigenvalues, generate_simulation class TestElectronicEigenvalues: diff --git a/tests/properties/test_permittivity.py b/tests/properties/test_permittivity.py index f6955f97..0a6b41ce 100644 --- a/tests/properties/test_permittivity.py +++ b/tests/properties/test_permittivity.py @@ -24,8 +24,8 @@ from nomad_simulations.schema_packages.properties import Permittivity from nomad_simulations.schema_packages.variables import Frequency, KMesh, Variables +from ..conftest import generate_k_space_simulation from . import logger -from .conftest import generate_k_space_simulation class TestPermittivity: From da96737bd3d1ea9daf6a0548f89fcc664934dd6e Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Tue, 24 Sep 2024 10:29:14 +0200 Subject: [PATCH 5/6] Restore configuration as it is indeed used --- src/nomad_simulations/schema_packages/model_system.py | 5 +++++ .../schema_packages/properties/band_structure.py | 5 +++++ .../schema_packages/properties/spectral_profile.py | 5 +++++ src/nomad_simulations/schema_packages/utils/utils.py | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/nomad_simulations/schema_packages/model_system.py b/src/nomad_simulations/schema_packages/model_system.py index 4804916d..0a1897d1 100644 --- a/src/nomad_simulations/schema_packages/model_system.py +++ b/src/nomad_simulations/schema_packages/model_system.py @@ -14,6 +14,7 @@ Surface, ) from nomad.atomutils import Formula, get_normalized_wyckoff, search_aflow_prototype +from nomad.config import config from nomad.datamodel.data import ArchiveSection from nomad.datamodel.metainfo.annotations import ELNAnnotation from nomad.datamodel.metainfo.basesections import Entity, System @@ -31,6 +32,10 @@ is_not_representative, ) +configuration = config.get_plugin_entry_point( + 'nomad_simulations.schema_packages:nomad_simulations_plugin' +) + class GeometricSpace(Entity): """ diff --git a/src/nomad_simulations/schema_packages/properties/band_structure.py b/src/nomad_simulations/schema_packages/properties/band_structure.py index a5f258a9..c5e169b0 100644 --- a/src/nomad_simulations/schema_packages/properties/band_structure.py +++ b/src/nomad_simulations/schema_packages/properties/band_structure.py @@ -2,6 +2,7 @@ import numpy as np import pint +from nomad.config import config from nomad.metainfo import Quantity, SubSection if TYPE_CHECKING: @@ -19,6 +20,10 @@ from nomad_simulations.schema_packages.properties.fermi_surface import FermiSurface from nomad_simulations.schema_packages.utils import get_sibling_section +configuration = config.get_plugin_entry_point( + 'nomad_simulations.schema_packages:nomad_simulations_plugin' +) + class BaseElectronicEigenvalues(PhysicalProperty): """ diff --git a/src/nomad_simulations/schema_packages/properties/spectral_profile.py b/src/nomad_simulations/schema_packages/properties/spectral_profile.py index b1ed076b..8078ff3d 100644 --- a/src/nomad_simulations/schema_packages/properties/spectral_profile.py +++ b/src/nomad_simulations/schema_packages/properties/spectral_profile.py @@ -2,6 +2,7 @@ import numpy as np import pint +from nomad.config import config from nomad.metainfo import MEnum, Quantity, SubSection if TYPE_CHECKING: @@ -15,6 +16,10 @@ from nomad_simulations.schema_packages.utils import get_sibling_section, get_variables from nomad_simulations.schema_packages.variables import Energy2 as Energy +configuration = config.get_plugin_entry_point( + 'nomad_simulations.schema_packages:nomad_simulations_plugin' +) + class SpectralProfile(PhysicalProperty): """ diff --git a/src/nomad_simulations/schema_packages/utils/utils.py b/src/nomad_simulations/schema_packages/utils/utils.py index 1c689933..1d40aa4a 100644 --- a/src/nomad_simulations/schema_packages/utils/utils.py +++ b/src/nomad_simulations/schema_packages/utils/utils.py @@ -2,6 +2,7 @@ from typing import TYPE_CHECKING import numpy as np +from nomad.config import config if TYPE_CHECKING: from typing import Optional @@ -9,6 +10,10 @@ from nomad.datamodel.data import ArchiveSection from structlog.stdlib import BoundLogger +configuration = config.get_plugin_entry_point( + 'nomad_simulations.schema_packages:nomad_simulations_plugin' +) + def get_sibling_section( section: 'ArchiveSection', From 8b706dccf1b5cf85fefe9c3075de59f8a23ef209 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Wed, 25 Sep 2024 08:35:40 +0200 Subject: [PATCH 6/6] Deleted copyright blocks --- tests/properties/__init__.py | 18 ------------------ tests/properties/test_band_gap.py | 18 ------------------ tests/properties/test_band_structure.py | 18 ------------------ tests/properties/test_energies.py | 18 ------------------ tests/properties/test_fermi_surface.py | 18 ------------------ tests/properties/test_forces.py | 18 ------------------ tests/properties/test_greens_function.py | 18 ------------------ tests/properties/test_hopping_matrix.py | 18 ------------------ tests/properties/test_permittivity.py | 18 ------------------ tests/properties/test_spectral_profile.py | 18 ------------------ tests/utils/__init__.py | 18 ------------------ tests/utils/test_utils.py | 18 ------------------ 12 files changed, 216 deletions(-) diff --git a/tests/properties/__init__.py b/tests/properties/__init__.py index 52e83b1e..5cdfd197 100644 --- a/tests/properties/__init__.py +++ b/tests/properties/__init__.py @@ -1,21 +1,3 @@ -# -# 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. -# - from nomad import utils logger = utils.get_logger(__name__) diff --git a/tests/properties/test_band_gap.py b/tests/properties/test_band_gap.py index 8d8a6b53..48939ea8 100644 --- a/tests/properties/test_band_gap.py +++ b/tests/properties/test_band_gap.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional, Union import numpy as np diff --git a/tests/properties/test_band_structure.py b/tests/properties/test_band_structure.py index 9f931c49..e5de0c5a 100644 --- a/tests/properties/test_band_structure.py +++ b/tests/properties/test_band_structure.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import numpy as np diff --git a/tests/properties/test_energies.py b/tests/properties/test_energies.py index 9f9dc01f..92ba8695 100644 --- a/tests/properties/test_energies.py +++ b/tests/properties/test_energies.py @@ -1,21 +1,3 @@ -# -# 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. -# - from nomad_simulations.schema_packages.properties import ( FermiLevel, KineticEnergy, diff --git a/tests/properties/test_fermi_surface.py b/tests/properties/test_fermi_surface.py index 05c7206b..c0d7d304 100644 --- a/tests/properties/test_fermi_surface.py +++ b/tests/properties/test_fermi_surface.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import pytest diff --git a/tests/properties/test_forces.py b/tests/properties/test_forces.py index 234cab0d..b260c3bc 100644 --- a/tests/properties/test_forces.py +++ b/tests/properties/test_forces.py @@ -1,21 +1,3 @@ -# -# 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. -# - from nomad_simulations.schema_packages.properties import TotalForce diff --git a/tests/properties/test_greens_function.py b/tests/properties/test_greens_function.py index 36b96222..b6335a4a 100644 --- a/tests/properties/test_greens_function.py +++ b/tests/properties/test_greens_function.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional, Union import pytest diff --git a/tests/properties/test_hopping_matrix.py b/tests/properties/test_hopping_matrix.py index b7cf43d7..e1a5a06e 100644 --- a/tests/properties/test_hopping_matrix.py +++ b/tests/properties/test_hopping_matrix.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import pytest diff --git a/tests/properties/test_permittivity.py b/tests/properties/test_permittivity.py index 0a6b41ce..cf6c0332 100644 --- a/tests/properties/test_permittivity.py +++ b/tests/properties/test_permittivity.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import numpy as np diff --git a/tests/properties/test_spectral_profile.py b/tests/properties/test_spectral_profile.py index 4184bbb7..38cb50ca 100644 --- a/tests/properties/test_spectral_profile.py +++ b/tests/properties/test_spectral_profile.py @@ -1,21 +1,3 @@ -# -# 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. -# - from typing import Optional import numpy as np diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py index 52e83b1e..5cdfd197 100644 --- a/tests/utils/__init__.py +++ b/tests/utils/__init__.py @@ -1,21 +1,3 @@ -# -# 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. -# - from nomad import utils logger = utils.get_logger(__name__) diff --git a/tests/utils/test_utils.py b/tests/utils/test_utils.py index 26f8a5d4..a50978f6 100644 --- a/tests/utils/test_utils.py +++ b/tests/utils/test_utils.py @@ -1,21 +1,3 @@ -# -# 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 pytest from nomad_simulations.schema_packages.model_system import (