Skip to content

Commit bf1f6f4

Browse files
committed
Merge branch 'develop' into coupled_cluster
2 parents 022c1fa + 5d162aa commit bf1f6f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+326
-788
lines changed

CITATION.cff

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cff-version: 1.2.0
2+
title: NOMAD Simulations
3+
message: >-
4+
If you use this software, please cite it using the
5+
metadata from this file.
6+
type: software
7+
authors:
8+
- given-names: José M.
9+
family-names: Pizarro
10+
orcid: 'https://orcid.org/0000-0002-6751-8192'
11+
- given-names: Esma B.
12+
family-names: Boydas
13+
orcid: 'https://orcid.org/0009-0005-6729-4706'
14+
- given-names: Nathan
15+
family-names: Daelman
16+
orcid: 'https://orcid.org/0000-0002-7647-1816'
17+
- given-names: Alvin Noe
18+
family-names: Ladines
19+
orcid: 'https://orcid.org/0000-0003-0077-2097'
20+
- given-names: Bernadette
21+
family-names: Mohr
22+
orcid: 'https://orcid.org/0000-0003-0903-0073'
23+
- given-names: Joseph F.
24+
family-names: Rudzinski
25+
orcid: 'https://orcid.org/0000-0003-3403-640X'
26+
doi:
27+
repository-code: 'https://github.com/nomad-coe/nomad-simulations'
28+
url: 'https://nomad-coe.github.io/nomad-simulations/'
29+
abstract: >-
30+
`nomad-simulations` is a plugin for the NOMAD software (https://zenodo.org/doi/10.5281/zenodo.8366162)
31+
providing a common data standard and analysis tools for parsed Materials Science and Quantum Chemistry
32+
simulations. This standard is used as a template and is populated by the many available NOMAD parsers to transform their
33+
inputs / outputs into a structured data format. This plugin is community-driven, and users are encourage to
34+
contribute towards providing Findable, Accessible, Interoperable, and Reusable (FAIR) data.
35+
36+
license: Apache-2.0

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,26 @@
22
![](https://coveralls.io/repos/github/nomad-coe/nomad-simulations/badge.svg?branch=develop)
33
![](https://img.shields.io/pypi/v/nomad-simulations)
44
![](https://img.shields.io/pypi/pyversions/nomad-simulations)
5+
[![DOI](https://zenodo.org/badge/744481756.svg)](https://zenodo.org/badge/latestdoi/744481756)
56

67

78

89
# `nomad-simulations`
910

10-
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.
11+
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.
12+
13+
Read more in the [official documentation](https://nomad-coe.github.io/nomad-simulations/) page.
1114

1215

1316
## Getting started
1417

1518
`nomad-simulations` can be installed as a PyPI package using `pip`:
19+
20+
> [!WARNING]
21+
> 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.
22+
1623
```sh
17-
pip install nomad-simulations
24+
pip install nomad-simulations --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
1825
```
1926

2027

@@ -48,6 +55,11 @@ The plugin is still under development. If you would like to contribute, install
4855
uv pip install -e '.[dev]'
4956
```
5057

58+
**Note:** If you do not use `uv`, you need to add the `--index-url` flag as in the PyPI command for installing the package:
59+
```sh
60+
pip install -e '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple
61+
```
62+
5163

5264
### Run the tests
5365

@@ -138,7 +150,7 @@ Read the [NOMAD plugin documentation](https://nomad-lab.eu/prod/v1/staging/docs/
138150
Modify the script under `/nomad/scripts/install_default_plugins.sh` and add the path to this repository pointing to the `@develop` branch:
139151
```sh
140152
<other-content-in-install_default_plugins.sh...>
141-
pip install git+https://github.com/nomad-coe/nomad-simulations.git@develop
153+
git+https://github.com/nomad-coe/nomad-simulations.git@develop
142154
```
143155

144156
Then, go to your NOMAD folder, activate your NOMAD virtual environment and run:
@@ -160,6 +172,8 @@ plugins:
160172
**Note!**
161173
Once you modify your `nomad.yaml` file adding `include`, all the default plugins will be disconnected, so you will need to include them as well.
162174

175+
## How to cite this work
176+
Pizarro, J.M., Boydas, E.B., Daelman, N., Ladines, A.N., Mohr, B. & Rudzinski, J.F., NOMAD Simulations [Computer software]. https://doi.org/xxxxx
163177

164178
## Main contributors
165179
| Name | E-mail | Topics | Github profiles |

src/nomad_simulations/schema_packages/__init__.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,23 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
from nomad.config.models.plugins import SchemaPackageEntryPoint
202
from pydantic import Field
213

224

235
class NOMADSimulationsEntryPoint(SchemaPackageEntryPoint):
246
dos_energy_tolerance: float = Field(
257
8.01088e-21,
26-
description='Tolerance of the DOS energies in Joules to match the reference of energies in the DOS normalize function.',
8+
description='Tolerance (in joules) of the DOS energies to match the reference of energies in the DOS normalize function.',
279
)
2810
dos_intensities_threshold: float = Field(
2911
1e-8,
30-
description='Threshold value at which the DOS intensities are considered non-zero.',
12+
description='Threshold value (in joules^-1) at which the DOS intensities are considered non-zero.',
3113
)
3214
occupation_tolerance: float = Field(
3315
1e-3,
3416
description='Tolerance for the occupation of a eigenstate to be non-occupied.',
3517
)
3618
fermi_surface_tolerance: float = Field(
3719
1e-8,
38-
description='Tolerance for energies to be close to the Fermi level and hence define the Fermi surface of a material.',
20+
description='Tolerance (in joules) for energies to be close to the Fermi level and hence define the Fermi surface of a material.',
3921
)
4022
symmetry_tolerance: float = Field(
4123
0.1, description='Tolerance for the symmetry analyzer used from MatID.'
@@ -48,6 +30,10 @@ class NOMADSimulationsEntryPoint(SchemaPackageEntryPoint):
4830
64,
4931
description='Limite of the number of atoms in the unit cell to be treated for the system type classification from MatID to work. This is done to avoid overhead of the package.',
5032
)
33+
equal_cell_positions_tolerance: float = Field(
34+
1e-12,
35+
description='Tolerance (in meters) for the cell positions to be considered equal.',
36+
)
5137

5238
def load(self):
5339
from nomad_simulations.schema_packages.general import m_package

src/nomad_simulations/schema_packages/atoms_state.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
from typing import TYPE_CHECKING, Any, Optional, Union
202

213
import ase

src/nomad_simulations/schema_packages/general.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
from typing import TYPE_CHECKING
202

213
if TYPE_CHECKING:

src/nomad_simulations/schema_packages/model_method.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
import re
202
from typing import TYPE_CHECKING, Optional
213

src/nomad_simulations/schema_packages/model_system.py

Lines changed: 70 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
import re
202
from typing import TYPE_CHECKING, Optional
213

@@ -296,6 +278,46 @@ class Cell(GeometricSpace):
296278
""",
297279
)
298280

281+
def _check_positions(self, positions_1, positions_2) -> list:
282+
# Check that all the `positions`` of `cell_1` match with the ones in `cell_2`
283+
check_positions = []
284+
for i1, pos1 in enumerate(positions_1):
285+
for i2, pos2 in enumerate(positions_2):
286+
if np.allclose(
287+
pos1, pos2, atol=configuration.equal_cell_positions_tolerance
288+
):
289+
check_positions.append([i1, i2])
290+
break
291+
return check_positions
292+
293+
def is_equal_cell(self, other) -> bool:
294+
"""
295+
Check if the cell is equal to an`other` cell by comparing the `positions`.
296+
Args:
297+
other: The other cell to compare with.
298+
Returns:
299+
bool: True if the cells are equal, False otherwise.
300+
"""
301+
# TODO implement checks on `lattice_vectors` and other quantities to ensure the equality of primitive cells
302+
if not isinstance(other, Cell):
303+
return False
304+
305+
# If the `positions` are empty, return False
306+
if self.positions is None or other.positions is None:
307+
return False
308+
309+
# The `positions` should have the same length (same number of positions)
310+
if len(self.positions) != len(other.positions):
311+
return False
312+
n_positions = len(self.positions)
313+
314+
check_positions = self._check_positions(
315+
positions_1=self.positions, positions_2=other.positions
316+
)
317+
if len(check_positions) != n_positions:
318+
return False
319+
return True
320+
299321
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
300322
super().normalize(archive, logger)
301323

@@ -339,6 +361,36 @@ def __init__(self, m_def: 'Section' = None, m_context: 'Context' = None, **kwarg
339361
# Set the name of the section
340362
self.name = self.m_def.name
341363

364+
def is_equal_cell(self, other) -> bool:
365+
"""
366+
Check if the atomic cell is equal to an`other` atomic cell by comparing the `positions` and
367+
the `AtomsState[*].chemical_symbol`.
368+
Args:
369+
other: The other atomic cell to compare with.
370+
Returns:
371+
bool: True if the atomic cells are equal, False otherwise.
372+
"""
373+
if not isinstance(other, AtomicCell):
374+
return False
375+
376+
# Compare positions using the parent sections's `__eq__` method
377+
if not super().is_equal_cell(other=other):
378+
return False
379+
380+
# Check that the `chemical_symbol` of the atoms in `cell_1` match with the ones in `cell_2`
381+
check_positions = self._check_positions(
382+
positions_1=self.positions, positions_2=other.positions
383+
)
384+
try:
385+
for atom in check_positions:
386+
element_1 = self.atoms_state[atom[0]].chemical_symbol
387+
element_2 = other.atoms_state[atom[1]].chemical_symbol
388+
if element_1 != element_2:
389+
return False
390+
except Exception:
391+
return False
392+
return True
393+
342394
def to_ase_atoms(self, logger: 'BoundLogger') -> Optional[ase.Atoms]:
343395
"""
344396
Generates an ASE Atoms object with the most basic information from the parsed `AtomicCell`

src/nomad_simulations/schema_packages/numerical_settings.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
from itertools import accumulate, chain, tee
202
from typing import TYPE_CHECKING, Optional, Union
213

src/nomad_simulations/schema_packages/outputs.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
from typing import TYPE_CHECKING, Optional
202

213
import numpy as np

src/nomad_simulations/schema_packages/physical_property.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
#
2-
# Copyright The NOMAD Authors.
3-
#
4-
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License");
7-
# you may not use this file except in compliance with the License.
8-
# You may obtain a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS,
14-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
# See the License for the specific language governing permissions and
16-
# limitations under the License.
17-
#
18-
191
from functools import wraps
202
from typing import TYPE_CHECKING, Any, Optional
213

0 commit comments

Comments
 (0)