diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index 61e5753..3f1a268 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -12,16 +12,43 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install .[dev,tests] + pip install '.[dev]' --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple + : # we need the latest nomad version for testing + pip install --ignore-installed nomad-lab[infrastructure]@git+https://github.com/nomad-coe/nomad.git@develop + pip install coverage coveralls - name: mypy run: | python -m mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional runschema tests - name: Test with pytest - if: success() || failure() + continue-on-error: true run: | - python -m pytest -sv tests + python -m coverage run -m pytest -sv tests + - name: Submit to coveralls + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + coveralls --service=github + build-and-install: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Build the package + run: | + pip install --upgrade pip + pip install build + python -m build --sdist + - name: Install the package + run: | + pip install dist/*.tar.gz --index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple ruff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: chartboost/ruff-action@v1 + with: + args: "check" \ No newline at end of file diff --git a/.github/workflows/mkdocs-deploy.yml b/.github/workflows/mkdocs-deploy.yml new file mode 100644 index 0000000..b0bb59a --- /dev/null +++ b/.github/workflows/mkdocs-deploy.yml @@ -0,0 +1,28 @@ +name: deploy-mkdocs + +on: + push: + branches: + - develop # Triggers deployment on push to the main branch + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install mkdocs mkdocs-material==8.1.1 pymdown-extensions mkdocs-click + + - name: Build and Deploy + run: | + mkdocs gh-deploy --force --remote-branch gh-pages \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c451383 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,54 @@ +name: upload-package + +on: + release: + types: [published] + +jobs: + github-release: + name: >- + Sign the Python distribution with Sigstore + and upload them to GitHub Release + runs-on: ubuntu-latest + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v1.2.3 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' diff --git a/docs/assets/.gitignore b/docs/assets/.gitignore new file mode 100644 index 0000000..3881e38 --- /dev/null +++ b/docs/assets/.gitignore @@ -0,0 +1 @@ +nomad-oasis*.zip \ No newline at end of file diff --git a/docs/assets/favicon.png b/docs/assets/favicon.png new file mode 100644 index 0000000..f84c78f Binary files /dev/null and b/docs/assets/favicon.png differ diff --git a/docs/assets/nomad-plugin-logo.png b/docs/assets/nomad-plugin-logo.png new file mode 100644 index 0000000..149856c Binary files /dev/null and b/docs/assets/nomad-plugin-logo.png differ diff --git a/docs/explanation/explanation.md b/docs/explanation/explanation.md new file mode 100644 index 0000000..d4f6235 --- /dev/null +++ b/docs/explanation/explanation.md @@ -0,0 +1,4 @@ +# Explanation + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. diff --git a/docs/how_to/contribute_to_the_documentation.md b/docs/how_to/contribute_to_the_documentation.md new file mode 100644 index 0000000..1234cb7 --- /dev/null +++ b/docs/how_to/contribute_to_the_documentation.md @@ -0,0 +1,4 @@ +# Contribute to the documentation + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. diff --git a/docs/how_to/contribute_to_this_plugin.md b/docs/how_to/contribute_to_this_plugin.md new file mode 100644 index 0000000..4e67d7a --- /dev/null +++ b/docs/how_to/contribute_to_this_plugin.md @@ -0,0 +1,5 @@ +# Contribute to This Plugin + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. + diff --git a/docs/how_to/install_this_plugin.md b/docs/how_to/install_this_plugin.md new file mode 100644 index 0000000..7d0c2ca --- /dev/null +++ b/docs/how_to/install_this_plugin.md @@ -0,0 +1,4 @@ +# Install This Plugin + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. diff --git a/docs/how_to/use_this_plugin.md b/docs/how_to/use_this_plugin.md new file mode 100644 index 0000000..4adc378 --- /dev/null +++ b/docs/how_to/use_this_plugin.md @@ -0,0 +1,10 @@ +# How to Use This Plugin + +This plugin can be used in a NOMAD Oasis instalation.. + +## Add This Plugin to Your NOMAD instalation + +Read the [NOMAD plugin documentation](https://nomad-lab.eu/prod/v1/staging/docs/plugins/plugins.html#add-a-plugin-to-your-nomad) for all details on how to deploy the plugin on your NOMAD instance. + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..4063c5a --- /dev/null +++ b/docs/index.md @@ -0,0 +1,48 @@ +# Welcome to the `nomad-schema-plugin-run` documentation + +This is a collection of schema for the NOMAD root section `run`. + +## Introduction + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. + +
+
+ +### Tutorial + +A series of tutorials will guide you through the main functionality of `nomad-schema-plugin-run`. + +- [Tutorial](tutorial/tutorial.md) + +
+
+ +### How-to guides + +How-to guides provide step-by-step instructions for a wide range of tasks, with the overarching topics: + +- [Install this plugin](how_to/install_this_plugin.md) +- [Use this plugin](how_to/use_this_plugin.md) +- [Contribute to this plugin](how_to/contribute_to_this_plugin.md) +- [Contribute to the documentation](how_to/contribute_to_the_documentation.md) + +
+ +
+ +### Explanation + +The explanation [section](explanation/explanation.md) provides background knowledge on this plugin. + +
+
+ +### Reference + +The reference [section](reference/references.md) includes all CLI commands and arguments, all configuration options, +the possible schema annotations and their arguments, and a glossary of used terms. + +
+
diff --git a/docs/reference/references.md b/docs/reference/references.md new file mode 100644 index 0000000..7d5adf2 --- /dev/null +++ b/docs/reference/references.md @@ -0,0 +1,4 @@ +# References + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css new file mode 100644 index 0000000..321e087 --- /dev/null +++ b/docs/stylesheets/extra.css @@ -0,0 +1,69 @@ + +.md-header__button.md-logo :where(img,svg) { + width: 100%; + height: 30px; +} + +.md-header, .md-header__inner { + background-color: #fff; + color: #2A4CDF; +} + +.md-header[data-md-state=shadow] { + box-shadow: 0px 2px 4px -1px rgb(0 0 0 / 20%), 0px 4px 5px 0px rgb(0 0 0 / 14%), 0px 1px 10px 0px rgb(0 0 0 / 12%); + transition: box-shadow 200ms linear; +} + +.md-header__inner { + height: 80px; +} + +.md-header__topic { + font-size: 24px; +} + +.md-footer { + background-color: #2A4CDF; +} + +.md-search__form:hover { + background-color: rgba(0,0,0,.13); +} + +.md-typeset h1 { + color: black; + font-weight: 700; +} + +.youtube { + position: relative; + width: 100%; + height: 0; + padding-bottom: 56.25%; +} + +.youtube iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.home-grid { + display: grid; + grid-template-columns: 1fr 1fr; + grid-column-gap: 24px; + row-gap: 24px; +} + +.home-grid div { + border-radius: 4px; + padding: 24px; + background-color: #f3e9d9; +} + +.home-grid h3 { + margin-top: 0; + font-weight: 700; +} \ No newline at end of file diff --git a/docs/theme/partials/header.html b/docs/theme/partials/header.html new file mode 100644 index 0000000..5b091f3 --- /dev/null +++ b/docs/theme/partials/header.html @@ -0,0 +1,86 @@ +{#- + This file was automatically generated - do not edit +-#} +{% set class = "md-header" %} +{% if "navigation.tabs.sticky" in features %} + {% set class = class ~ " md-header--lifted" %} +{% endif %} +
+ + {% if "navigation.tabs.sticky" in features %} + {% if "navigation.tabs" in features %} + {% include "partials/tabs.html" %} + {% endif %} + {% endif %} +
\ No newline at end of file diff --git a/docs/tutorial/tutorial.md b/docs/tutorial/tutorial.md new file mode 100644 index 0000000..8dc9a99 --- /dev/null +++ b/docs/tutorial/tutorial.md @@ -0,0 +1,4 @@ +# Tutorial + +!!! note "Attention" + Please update the document with relevant information specific to your plugin. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..8cef2b1 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,57 @@ +site_name: Documentation +site_description: | + The documentation for NOMAD run schema +site_author: The NOMAD Authors +repo_url: https://github.com/nomad-coe/nomad-schema-plugin-run + +nav: + - Home: index.md + - Tutorial: tutorial/tutorial.md + - How-to guides: + - Install this Plugin: how_to/install_this_plugin.md + - Use this Plugin: how_to/use_this_plugin.md + - Contribute to this plugin: how_to/contribute_to_this_plugin.md + - Contribute to the documentation: how_to/contribute_to_the_documentation.md + - Explanation: explanation/explanation.md + - Reference: reference/references.md +plugins: + - search +theme: + name: material + palette: + primary: "#2A4CDF" + accent: "#008A67" + font: + text: "Titillium Web" + logo: assets/nomad-plugin-logo.png + favicon: assets/favicon.png + features: + - navigation.instant + custom_dir: docs/theme +markdown_extensions: + - attr_list + - md_in_html + - admonition + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + - toc: + permalink: True + - pymdownx.arithmatex: + generic: true + - attr_list + - mkdocs-click + - pymdownx.extra +extra: + generator: false + homepage: https://nomad-lab.eu +use_directory_urls: false +extra_css: + - stylesheets/extra.css +extra_javascript: + - javascript.js + - https://polyfill.io/v3/polyfill.min.js?features=es6 + - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js diff --git a/pyproject.toml b/pyproject.toml index dafc119..8d601fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,14 +3,14 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] -name = 'nomad-schema-plugin-run' -version = '1.0' -description = 'Run schema plugin for NOMAD.' +name = "runschema" +version = "1.0" +description = "Run schema plugin for NOMAD." readme = "README.md" authors = [{ name = "The NOMAD Authors" }] license = { text = "Apache-2.0" } dependencies = [ - "nomad-lab[infrastructure]@git+https://github.com/nomad-coe/nomad.git@develop" + "nomad-lab>=1.2.0" ] [project.urls] @@ -18,18 +18,15 @@ homepage = "https://github.com/nomad-coe/nomad-schema-plugin-run.git" [project.optional-dependencies] dev = [ - 'mypy==1.0.1', - 'pytest==3.10.0', - 'pytest-timeout==1.4.2', - 'pytest-cov==2.7.1', - 'ruff==0.1.4' + "mypy==1.0.1", + "pytest==3.10.0", + "pytest-timeout==1.4.2", + "pytest-cov==2.7.1", + "ruff==0.1.4" ] - -tests = [ -] - [tool.ruff] include = ["runschema/*.py", "tests/*.py"] + select = [ "E", # pycodestyle "W", # pycodestyle @@ -52,8 +49,25 @@ ignore = [ ] fixable = ["ALL"] +# Same as Black. +line-length = 88 +indent-width = 4 + +[tool.ruff.format] +# use single quotes for strings. +quote-style = "single" + +# indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + [tool.setuptools.packages.find] include = ["runschema*"] [tool.setuptools.package-data] -runschema = ['*/nomad_plugin.yaml'] +runschema = ["*/nomad_plugin.yaml"] diff --git a/runschema/__init__.py b/runschema/__init__.py index c950c84..02d9c57 100644 --- a/runschema/__init__.py +++ b/runschema/__init__.py @@ -16,7 +16,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from . import run -from . import method -from . import system -from . import calculation +from . import calculation, method, run, system diff --git a/runschema/calculation.py b/runschema/calculation.py index a30e7d1..280e300 100644 --- a/runschema/calculation.py +++ b/runschema/calculation.py @@ -17,28 +17,28 @@ # import numpy as np +from nomad.datamodel.data import ArchiveSection +from nomad.datamodel.metainfo.common import ( + FastAccess, + PropertySection, + ProvenanceTracker, +) from nomad.metainfo import ( - MSection, - MCategory, Category, + HDF5Reference, + MCategory, + MEnum, + MSection, Package, Quantity, + Reference, Section, - SubSection, SectionProxy, - Reference, - MEnum, - HDF5Reference, -) -from nomad.datamodel.metainfo.common import ( - ProvenanceTracker, - PropertySection, - FastAccess, + SubSection, ) -from .system import System, AtomsGroup -from .method import Method, HoppingMatrix -from nomad.datamodel.data import ArchiveSection +from .method import HoppingMatrix, Method +from .system import AtomsGroup, System m_package = Package() @@ -252,7 +252,7 @@ class EnergyEntry(Atomic): reference = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the reference energy to be subtracted from value to obtain a code-independent value of the energy. @@ -263,7 +263,7 @@ class EnergyEntry(Atomic): value = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the energy of the unit cell. """, @@ -272,7 +272,7 @@ class EnergyEntry(Atomic): value_per_atom = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the energy normalized by the total number of atoms in the simulation cell. @@ -282,8 +282,8 @@ class EnergyEntry(Atomic): # TODO rename this to value_atomic values_per_atom = Quantity( type=np.dtype(np.float64), - shape=["n_atoms"], - unit="joule", + shape=['n_atoms'], + unit='joule', description=""" Value of the atom-resolved energies. """, @@ -292,7 +292,7 @@ class EnergyEntry(Atomic): potential = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the potential energy. """, @@ -301,7 +301,7 @@ class EnergyEntry(Atomic): kinetic = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the kinetic energy. """, @@ -310,7 +310,7 @@ class EnergyEntry(Atomic): correction = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the correction to the energy. """, @@ -319,7 +319,7 @@ class EnergyEntry(Atomic): short_range = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the short range contributions to the energy. """, @@ -328,7 +328,7 @@ class EnergyEntry(Atomic): long_range = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the long range contributions to the energy. """, @@ -526,7 +526,7 @@ class Energy(MSection): enthalpy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the calculated enthalpy per cell i.e. energy_total + pressure * volume. """, @@ -536,7 +536,7 @@ class Energy(MSection): entropy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule / kelvin", + unit='joule / kelvin', description=""" Value of the entropy. """, @@ -545,7 +545,7 @@ class Energy(MSection): chemical_potential = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the chemical potential. """, @@ -554,7 +554,7 @@ class Energy(MSection): internal = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the internal energy. """, @@ -599,7 +599,7 @@ class Energy(MSection): change = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Stores the change of total energy with respect to the previous step. """, @@ -609,7 +609,7 @@ class Energy(MSection): fermi = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Fermi energy (separates occupied from unoccupied single-particle states) """, @@ -618,7 +618,7 @@ class Energy(MSection): highest_occupied = Quantity( type=np.dtype(np.float64), - unit="joule", + unit='joule', shape=[], description=""" The highest occupied energy. @@ -627,7 +627,7 @@ class Energy(MSection): lowest_unoccupied = Quantity( type=np.dtype(np.float64), - unit="joule", + unit='joule', shape=[], description=""" The lowest unoccupied energy. @@ -665,8 +665,8 @@ class ForcesEntry(Atomic): value = Quantity( type=np.dtype(np.float64), - shape=["n_atoms", 3], - unit="newton", + shape=['n_atoms', 3], + unit='newton', description=""" Value of the forces acting on the atoms. This is calculated as minus gradient of the corresponding energy type or contribution **including** constraints, if @@ -679,8 +679,8 @@ class ForcesEntry(Atomic): value_raw = Quantity( type=np.dtype(np.float64), - shape=["n_atoms", 3], - unit="newton", + shape=['n_atoms', 3], + unit='newton', description=""" Value of the forces acting on the atoms **not including** such as fixed atoms, distances, angles, dihedrals, etc.""", @@ -749,7 +749,7 @@ class StressEntry(Atomic): value = Quantity( type=np.dtype(np.float64), shape=[3, 3], - unit="joule/meter**3", + unit='joule/meter**3', description=""" Value of the stress on the simulation cell. It is given as the functional derivative of the corresponding energy with respect to the deformation tensor. @@ -758,8 +758,8 @@ class StressEntry(Atomic): values_per_atom = Quantity( type=np.dtype(np.float64), - shape=["number_of_atoms", 3, 3], - unit="joule/meter**3", + shape=['number_of_atoms', 3, 3], + unit='joule/meter**3', description=""" Value of the atom-resolved stresses. """, @@ -808,7 +808,7 @@ class ChargesValue(AtomicValues): value = Quantity( type=np.dtype(np.float64), shape=[], - unit="coulomb", + unit='coulomb', description=""" Value of the charge projected on atom and orbital. """, @@ -849,8 +849,8 @@ class Charges(Atomic): value = Quantity( type=np.dtype(np.float64), - shape=["n_atoms"], - unit="coulomb", + shape=['n_atoms'], + unit='coulomb', description=""" Value of the atomic charges calculated through analysis_method. """, @@ -858,7 +858,7 @@ class Charges(Atomic): n_electrons = Quantity( type=np.dtype(np.float64), - shape=["n_atoms"], + shape=['n_atoms'], description=""" Value of the number of electrons on the atoms. """, @@ -868,7 +868,7 @@ class Charges(Atomic): # renamed population spins = Quantity( type=np.dtype(np.float64), - shape=["n_atoms"], + shape=['n_atoms'], description=""" Value of the atomic spins. """, @@ -877,7 +877,7 @@ class Charges(Atomic): total = Quantity( type=np.dtype(np.float64), shape=[], - unit="coulomb", + unit='coulomb', description=""" Value of the total charge of the system. """, @@ -906,14 +906,14 @@ class BandGapDeprecated(PropertySection): value = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" The actual value of the band gap. Value of zero indicates a vanishing band gap and is distinct from sources lacking any band gap measurement or calculation.""", ) type = Quantity( - type=MEnum("direct", "indirect"), + type=MEnum('direct', 'indirect'), shape=[], description=""" Band gap type. @@ -922,7 +922,7 @@ class BandGapDeprecated(PropertySection): energy_highest_occupied = Quantity( type=np.float64, - unit="joule", + unit='joule', shape=[], description=""" The highest occupied energy. @@ -931,7 +931,7 @@ class BandGapDeprecated(PropertySection): energy_lowest_unoccupied = Quantity( type=np.float64, - unit="joule", + unit='joule', shape=[], description=""" The lowest unoccupied energy. @@ -973,7 +973,7 @@ class BandEnergies(MSection): kpoints = Quantity( type=np.dtype(np.float64), - shape=["n_kpoints", 3], + shape=['n_kpoints', 3], description=""" Fractional coordinates of the $k$ or $q$ points (in the basis of the reciprocal- lattice vectors) for which the eigenvalues are evaluated. @@ -982,7 +982,7 @@ class BandEnergies(MSection): kpoints_weights = Quantity( type=np.dtype(np.float64), - shape=["n_kpoints"], + shape=['n_kpoints'], description=""" Weights of the $k$ points in the calculation of the band energy. """, @@ -990,7 +990,7 @@ class BandEnergies(MSection): kpoints_multiplicities = Quantity( type=np.dtype(np.float64), - shape=["n_kpoints"], + shape=['n_kpoints'], description=""" Multiplicities of the $k$ point (i.e., how many distinct points per cell this expands to after applying all symmetries). This defaults to 1. If expansion is @@ -1010,7 +1010,7 @@ class BandEnergies(MSection): orbital_labels = Quantity( type=str, - shape=["n_bands"], + shape=['n_bands'], description=""" Labels corresponding to each band/orbital """, @@ -1018,7 +1018,7 @@ class BandEnergies(MSection): occupations = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], description=""" Values of the occupations of the bands. """, @@ -1026,8 +1026,8 @@ class BandEnergies(MSection): energies = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Values of the band energies. """, @@ -1035,7 +1035,7 @@ class BandEnergies(MSection): qp_linearization_prefactor = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], description=""" Values of the GW quasi particle linearization pre-factor. """, @@ -1043,8 +1043,8 @@ class BandEnergies(MSection): value_xc_potential = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the GW exchange-correlation potential. """, @@ -1052,8 +1052,8 @@ class BandEnergies(MSection): value_correlation = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the GW correlation energy. """, @@ -1061,8 +1061,8 @@ class BandEnergies(MSection): value_exchange = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the GW exchange energy. """, @@ -1070,8 +1070,8 @@ class BandEnergies(MSection): value_xc = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the GW exchange-correlation energy. """, @@ -1079,8 +1079,8 @@ class BandEnergies(MSection): value_qp = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the GW quasi-particle energy. """, @@ -1088,8 +1088,8 @@ class BandEnergies(MSection): value_ks = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the Kohn-Sham energy. """, @@ -1097,8 +1097,8 @@ class BandEnergies(MSection): value_ks_xc = Quantity( type=np.dtype(np.float64), - shape=["n_spin_channels", "n_kpoints", "n_bands"], - unit="joule", + shape=['n_spin_channels', 'n_kpoints', 'n_bands'], + unit='joule', description=""" Diagonal matrix elements of the Kohn-Sham exchange-correlation energy. """, @@ -1131,7 +1131,7 @@ class BandStructure(MSection): reciprocal_cell = Quantity( type=np.dtype(np.float64), shape=[3, 3], - unit="1 / meter", + unit='1 / meter', description=""" The reciprocal cell within which the band structure is calculated. """, @@ -1141,7 +1141,7 @@ class BandStructure(MSection): energy_fermi = Quantity( type=np.dtype(np.float64), - unit="joule", + unit='joule', shape=[], description=""" Fermi energy. @@ -1230,8 +1230,8 @@ class DosValues(AtomicValues): value = Quantity( type=np.dtype(np.float64), - shape=["n_energies"], - unit="1/joule", + shape=['n_energies'], + unit='1/joule', description=""" Values of DOS, i.e. number of states for a given energy. The set of discrete energy values is given in energies. @@ -1240,7 +1240,7 @@ class DosValues(AtomicValues): value_integrated = Quantity( type=np.dtype(np.float64), - shape=["n_energies"], + shape=['n_energies'], description=""" A cumulative DOS starting from the mimunum energy available up to the energy level specified in `energies`. """, @@ -1276,8 +1276,8 @@ class Dos(Atomic): energies = Quantity( type=np.float64, - shape=["n_energies"], - unit="joule", + shape=['n_energies'], + unit='joule', description=""" Contains the set of discrete energy values for the DOS. """, @@ -1285,7 +1285,7 @@ class Dos(Atomic): energy_fermi = Quantity( type=np.float64, - unit="joule", + unit='joule', shape=[], description=""" Fermi energy. @@ -1294,7 +1294,7 @@ class Dos(Atomic): energy_ref = Quantity( type=np.float64, - unit="joule", + unit='joule', shape=[], description=""" Energy level denoting the origin along the energy axis, used for comparison and visualization. @@ -1397,7 +1397,7 @@ class MultipolesEntry(Atomic): origin = Quantity( type=np.dtype(np.float64), shape=[3], - unit="meter", + unit='meter', description=""" Origin in cartesian space. """, @@ -1413,7 +1413,7 @@ class MultipolesEntry(Atomic): value = Quantity( type=np.dtype(np.float64), - shape=["n_atoms", "n_multipoles"], + shape=['n_atoms', 'n_multipoles'], description=""" Value of the multipoles projected unto the atoms. """, @@ -1421,7 +1421,7 @@ class MultipolesEntry(Atomic): total = Quantity( type=np.dtype(np.float64), - shape=["n_multipoles"], + shape=['n_multipoles'], description=""" Total value of the multipoles. """, @@ -1466,7 +1466,7 @@ class Thermodynamics(MSection): enthalpy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the calculated enthalpy per cell i.e. energy_total + pressure * volume. """, @@ -1475,7 +1475,7 @@ class Thermodynamics(MSection): entropy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule / kelvin", + unit='joule / kelvin', description=""" Value of the entropy. """, @@ -1484,7 +1484,7 @@ class Thermodynamics(MSection): chemical_potential = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the chemical potential. """, @@ -1493,7 +1493,7 @@ class Thermodynamics(MSection): kinetic_energy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the kinetic energy. """, @@ -1502,7 +1502,7 @@ class Thermodynamics(MSection): potential_energy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the potential energy. """, @@ -1511,7 +1511,7 @@ class Thermodynamics(MSection): internal_energy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the internal energy. """, @@ -1520,7 +1520,7 @@ class Thermodynamics(MSection): vibrational_free_energy_at_constant_volume = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the vibrational free energy per cell unit at constant volume. """, @@ -1529,7 +1529,7 @@ class Thermodynamics(MSection): pressure = Quantity( type=np.dtype(np.float64), shape=[], - unit="pascal", + unit='pascal', description=""" Value of the pressure of the system. """, @@ -1538,7 +1538,7 @@ class Thermodynamics(MSection): temperature = Quantity( type=np.dtype(np.float64), shape=[], - unit="kelvin", + unit='kelvin', description=""" Value of the temperature of the system at which the properties are calculated. """, @@ -1547,7 +1547,7 @@ class Thermodynamics(MSection): volume = Quantity( type=np.dtype(np.float64), shape=[], - unit="m ** 3", + unit='m ** 3', description=""" Value of the volume of the system at which the properties are calculated. """, @@ -1556,7 +1556,7 @@ class Thermodynamics(MSection): heat_capacity_c_v = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule / kelvin", + unit='joule / kelvin', description=""" Stores the heat capacity per cell unit at constant volume. """, @@ -1565,7 +1565,7 @@ class Thermodynamics(MSection): heat_capacity_c_p = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule / kelvin", + unit='joule / kelvin', description=""" Stores the heat capacity per cell unit at constant pressure. """, @@ -1631,7 +1631,7 @@ class Volumetric(MSection): displacements = Quantity( type=np.dtype(np.float64), shape=[3, 3], - unit="meter", + unit='meter', description=""" displacement vectors between grid points along each axis; same indexing rules as lattice_vectors. In many cases, displacements and number of points are related to @@ -1643,7 +1643,7 @@ class Volumetric(MSection): origin = Quantity( type=np.dtype(np.float64), shape=[3], - unit="meter", + unit='meter', description=""" location of the first grid point; same coordinate system as atom_positions when applicable. @@ -1652,7 +1652,7 @@ class Volumetric(MSection): value = Quantity( type=np.dtype(np.float64), - shape=["multiplicity", "n_x", "n_y", "n_z"], + shape=['multiplicity', 'n_x', 'n_y', 'n_z'], description=""" Values of the volumetric data defined by kind. """, @@ -1668,8 +1668,8 @@ class PotentialValue(Volumetric): value = Quantity( type=np.dtype(np.float64), - shape=["multiplicity", "n_x", "n_y", "n_z"], - unit="J / m ** 3", + shape=['multiplicity', 'n_x', 'n_y', 'n_z'], + unit='J / m ** 3', description=""" Values of the potential evaluated at each grid point. """, @@ -1697,8 +1697,8 @@ class Density(Volumetric): value = Quantity( type=np.dtype(np.float64), - shape=["multiplicity", "n_x", "n_y", "n_z"], - unit="1 / m ** 3", + shape=['multiplicity', 'n_x', 'n_y', 'n_z'], + unit='1 / m ** 3', description=""" Values of the potential evaluated at each grid point. """, @@ -1739,8 +1739,8 @@ class Spectra(ArchiveSection): excitation_energies = Quantity( type=np.float64, - shape=["n_energies"], - unit="joule", + shape=['n_energies'], + unit='joule', description=""" Excitation energies. """, @@ -1749,7 +1749,7 @@ class Spectra(ArchiveSection): energy_zero_ref = Quantity( type=np.float64, - unit="joule", + unit='joule', shape=[], description=""" Reference energy to set the origin of the spectra to 0 eV. @@ -1758,7 +1758,7 @@ class Spectra(ArchiveSection): intensities = Quantity( type=np.float64, - shape=["n_energies"], + shape=['n_energies'], description=""" Excitation intensities in arbitrary units. """, @@ -1774,7 +1774,7 @@ class Spectra(ArchiveSection): oscillator_strengths = Quantity( type=np.float64, - shape=["n_energies"], + shape=['n_energies'], description=""" Excited states oscillator strengths. """, @@ -1782,8 +1782,8 @@ class Spectra(ArchiveSection): transition_dipole_moments = Quantity( type=np.float64, - shape=["n_energies", 3], - unit="coulomb * meter", + shape=['n_energies', 3], + unit='coulomb * meter', description=""" Transition dipole moments. """, @@ -1802,7 +1802,7 @@ class GreensFunctions(MSection): m_def = Section(validate=False) type = Quantity( - type=MEnum("impurity", "lattice"), + type=MEnum('impurity', 'lattice'), description=""" Type of Green's function calculated from the mapping of the Hubbard-Kanamori model into the Anderson impurity model. These calculations are converged if both types of @@ -1812,7 +1812,7 @@ class GreensFunctions(MSection): matsubara_freq = Quantity( type=np.float64, - shape=["*"], + shape=['*'], description=""" Matsubara frequencies (imaginary frequencies). Can be either positives or both positives and negatives. @@ -1821,7 +1821,7 @@ class GreensFunctions(MSection): tau = Quantity( type=np.float64, - shape=["n_tau"], + shape=['n_tau'], description=""" Imaginary times. """, @@ -1829,7 +1829,7 @@ class GreensFunctions(MSection): frequencies = Quantity( type=np.float64, - shape=["n_frequencies"], + shape=['n_frequencies'], description=""" Real space frequencies. """, @@ -1837,7 +1837,7 @@ class GreensFunctions(MSection): chemical_potential = Quantity( type=np.float64, - unit="joule", + unit='joule', description=""" Chemical potential. """, @@ -1845,7 +1845,7 @@ class GreensFunctions(MSection): self_energy_iw = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "*"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', '*'], description=""" Self-energy tensor in Matsubara frequencies. """, @@ -1853,7 +1853,7 @@ class GreensFunctions(MSection): greens_function_iw = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "*"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', '*'], description=""" Green's function tensor in Matsubara frequencies. """, @@ -1861,7 +1861,7 @@ class GreensFunctions(MSection): hybridization_function_iw = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "*"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', '*'], description=""" Hybridization function tensor in Matsubara frequencies. """, @@ -1869,7 +1869,7 @@ class GreensFunctions(MSection): greens_function_tau = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "n_tau"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', 'n_tau'], description=""" Green's function tensor in tau (imaginary time). """, @@ -1877,7 +1877,7 @@ class GreensFunctions(MSection): self_energy_freq = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "n_frequencies"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', 'n_frequencies'], description=""" Self-energy tensor in real frequencies. """, @@ -1885,7 +1885,7 @@ class GreensFunctions(MSection): greens_function_freq = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "n_frequencies"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', 'n_frequencies'], description=""" Green's function tensor in real frequencies. """, @@ -1893,7 +1893,7 @@ class GreensFunctions(MSection): hybridization_function_freq = Quantity( type=np.complex128, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals", "n_frequencies"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals', 'n_frequencies'], description=""" Hybridization function tensor in real frequencies. """, @@ -1901,7 +1901,7 @@ class GreensFunctions(MSection): orbital_occupations = Quantity( type=np.float64, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals'], description=""" Orbital occupation per correlated atom in the unit cell and per spin. """, @@ -1909,7 +1909,7 @@ class GreensFunctions(MSection): quasiparticle_weights = Quantity( type=np.float64, - shape=["n_atoms_per_unit_cell", 2, "n_correlated_orbitals"], + shape=['n_atoms_per_unit_cell', 2, 'n_correlated_orbitals'], description=""" Quasiparticle weights of each orbital per site and spin. Calculated from: Z = inv(1.0 - d [Re Sigma] / dw at w=0) @@ -1951,7 +1951,7 @@ class VibrationalFrequenciesValues(MSection): activity = Quantity( type=str, - shape=["n_vibrations"], + shape=['n_vibrations'], description=""" Describes the activity corresponding to each of the value of the vibration spectrum. @@ -1960,7 +1960,7 @@ class VibrationalFrequenciesValues(MSection): intensity = Quantity( type=np.dtype(np.float64), - shape=["n_vibrations"], + shape=['n_vibrations'], description=""" Intensity of the vibration. """, @@ -1984,8 +1984,8 @@ class VibrationalFrequencies(MSection): value = Quantity( type=np.dtype(np.float64), - shape=["n_frequencies"], - unit="1 / meter", + shape=['n_frequencies'], + unit='1 / meter', description=""" Values of vibrational frequencies (m-1) """, @@ -2009,7 +2009,7 @@ class RadiusOfGyrationValues(AtomicGroupValues): value = Quantity( type=np.dtype(np.float64), shape=[], - unit="m", + unit='m', description=""" Value of Rg. """, @@ -2045,8 +2045,8 @@ class MagneticShielding(MSection): value = Quantity( type=np.float64, - shape=["n_atoms", 3, 3], - unit="dimensionless", + shape=['n_atoms', 3, 3], + unit='dimensionless', description=""" Value of the magnetic shielding tensor per atom. The first index runs for all the atoms in the unit cell, while 3x3 refers to each axis direction. This quantity @@ -2058,8 +2058,8 @@ class MagneticShielding(MSection): isotropic_value = Quantity( type=np.float64, - shape=["n_atoms"], - unit="dimensionless", + shape=['n_atoms'], + unit='dimensionless', description=""" Value of the isotropic part of the magnetic shielding tensor per atom. The first index runs for all the atoms in the unit cell. This quantity relates with magnetic @@ -2091,7 +2091,7 @@ class ElectricFieldGradient(MSection): m_def = Section(validate=False) contribution = Quantity( - type=MEnum("total", "local", "non_local"), + type=MEnum('total', 'local', 'non_local'), description=""" Type of contribution to the electric field gradient (EFG). The total EFG is composed of `local` and `non_local` contributions. @@ -2100,8 +2100,8 @@ class ElectricFieldGradient(MSection): value = Quantity( type=np.float64, - shape=["n_atoms", 3, 3], - unit="volt / meter ** 2", + shape=['n_atoms', 3, 3], + unit='volt / meter ** 2', description=""" Value of the electric field gradient (EFG) for each `contribution` per unit area. The first index runs for all the atoms in the unit cell, while 3x3 refers to each @@ -2111,7 +2111,7 @@ class ElectricFieldGradient(MSection): quadrupolar_coupling_constant = Quantity( type=np.float64, - shape=["n_atoms"], + shape=['n_atoms'], description=""" Quadrupolar coupling constant for each atom in the unit cell. It is computed from the eigenvalues of the EFG tensor as: @@ -2124,7 +2124,7 @@ class ElectricFieldGradient(MSection): asymmetry_parameter = Quantity( type=np.float64, - shape=["n_atoms"], + shape=['n_atoms'], description=""" Asymmetry parameter for each atom in the unit cell. It is computed from the eigenvalues of the EFG tensor as: @@ -2153,12 +2153,12 @@ class SpinSpinCoupling(MSection): contribution = Quantity( type=MEnum( - "total", - "direct_dipolar", - "fermi_contact", - "orbital_diamagnetic", - "orbital_paramagnetic", - "spin_dipolar", + 'total', + 'direct_dipolar', + 'fermi_contact', + 'orbital_diamagnetic', + 'orbital_paramagnetic', + 'spin_dipolar', ), description=""" Type of contribution to the indirect spin-spin coupling. The total indirect spin-spin @@ -2178,8 +2178,8 @@ class SpinSpinCoupling(MSection): value = Quantity( type=np.float64, - shape=["n_atoms", "n_atoms", 3, 3], - unit="joule", + shape=['n_atoms', 'n_atoms', 3, 3], + unit='joule', description=""" Value of the indirect spin-spin couplings for each contribution. The first and second indices run for all the combinations of pairs of atoms in the unit cell, while @@ -2189,8 +2189,8 @@ class SpinSpinCoupling(MSection): reduced_value = Quantity( type=np.float64, - shape=["n_atoms", "n_atoms", 3, 3], - unit="kelvin**2 / joule", + shape=['n_atoms', 'n_atoms', 3, 3], + unit='kelvin**2 / joule', description=""" Reduced value of the indirect spin-spin couplings for each contribution. The first and second indices run for all the combinations of pairs of atoms in the unit cell, while @@ -2214,7 +2214,7 @@ class MagneticSusceptibility(MSection): m_def = Section(validate=False) scale_dimension = Quantity( - type=MEnum("microscopic", "macroscopic"), + type=MEnum('microscopic', 'macroscopic'), description=""" Identifier of the scale dimension of the magnetic susceptibility tensor. """, @@ -2261,7 +2261,7 @@ class BaseCalculation(ArchiveSection): ) starting_calculation_ref = Quantity( - type=Reference(SectionProxy("Calculation")), + type=Reference(SectionProxy('Calculation')), shape=[], description=""" Links the current section calculation to the starting calculation. @@ -2278,8 +2278,8 @@ class BaseCalculation(ArchiveSection): ) calculations_ref = Quantity( - type=Reference(SectionProxy("Calculation")), - shape=["n_references"], + type=Reference(SectionProxy('Calculation')), + shape=['n_references'], description=""" Links the current section calculation to other section calculations. Such a link is necessary for example if the referenced calculation is a self-consistent @@ -2291,7 +2291,7 @@ class BaseCalculation(ArchiveSection): calculations_path = Quantity( type=str, - shape=["n_references"], + shape=['n_references'], description=""" Links the current section calculation to other section calculations. Such a link is necessary for example if the referenced calculation is a self-consistent @@ -2310,7 +2310,7 @@ class BaseCalculation(ArchiveSection): hessian_matrix = Quantity( type=np.dtype(np.float64), - shape=["number_of_atoms", "number_of_atoms", 3, 3], + shape=['number_of_atoms', 'number_of_atoms', 3, 3], description=""" The matrix with the second derivative of the energy with respect to atom displacements. @@ -2330,7 +2330,7 @@ class BaseCalculation(ArchiveSection): time_calculation = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the wall-clock time needed to complete the calculation i.e. the real time that has elapsed from start to end of calculation. @@ -2341,7 +2341,7 @@ class BaseCalculation(ArchiveSection): time_physical = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" The elapsed real time at the end of the calculation with respect to the start of the simulation. @@ -2405,7 +2405,7 @@ class BaseCalculation(ArchiveSection): volume = Quantity( type=np.dtype(np.float64), shape=[], - unit="m ** 3", + unit='m ** 3', description=""" Value of the volume of the system. """, @@ -2414,7 +2414,7 @@ class BaseCalculation(ArchiveSection): density = Quantity( type=np.dtype(np.float64), shape=[], - unit="kg / m ** 3", + unit='kg / m ** 3', description=""" Value of the density of the system. """, @@ -2423,7 +2423,7 @@ class BaseCalculation(ArchiveSection): pressure = Quantity( type=np.float64, shape=[], - unit="pascal", + unit='pascal', description=""" Value of the pressure of the system. """, @@ -2432,7 +2432,7 @@ class BaseCalculation(ArchiveSection): pressure_tensor = Quantity( type=np.float64, shape=[3, 3], - unit="pascal", + unit='pascal', description=""" Value of the pressure in terms of the x, y, z components of the simulation cell. Typically calculated as the difference between the kinetic energy and the virial. @@ -2442,7 +2442,7 @@ class BaseCalculation(ArchiveSection): virial_tensor = Quantity( type=np.dtype(np.float64), shape=[3, 3], - unit="joule", + unit='joule', description=""" Value of the virial in terms of the x, y, z components of the simulation cell. Typically calculated as the cross product between positions and forces. @@ -2452,7 +2452,7 @@ class BaseCalculation(ArchiveSection): enthalpy = Quantity( type=np.dtype(np.float64), shape=[], - unit="joule", + unit='joule', description=""" Value of the calculated enthalpy per cell i.e. energy_total + pressure * volume. """, @@ -2461,7 +2461,7 @@ class BaseCalculation(ArchiveSection): temperature = Quantity( type=np.dtype(np.float64), shape=[], - unit="kelvin", + unit='kelvin', description=""" Value of the temperature of the system. """, @@ -2478,7 +2478,7 @@ class BaseCalculation(ArchiveSection): time = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" The elapsed simulated physical time since the start of the simulation. """, diff --git a/runschema/method.py b/runschema/method.py index 8e0e941..25e78ef 100644 --- a/runschema/method.py +++ b/runschema/method.py @@ -16,39 +16,38 @@ # limitations under the License. # -from logging import Logger -import numpy as np import typing +from logging import Logger +import numpy as np from nomad.datamodel.data import ArchiveSection +from nomad.datamodel.metainfo.common import FastAccess from nomad.metainfo import ( + MEnum, MSection, Package, Quantity, + Reference, Section, - SubSection, SectionProxy, - Reference, - MEnum, + SubSection, ) -from nomad.datamodel.metainfo.common import FastAccess from nomad.quantum_states import RussellSaundersState - m_package = Package() -unavailable = "unavailable" -not_processed = "not processed" +unavailable = 'unavailable' +not_processed = 'not processed' orbitals = { - -1: dict(zip(range(4), ("s", "p", "d", "f"))), - 0: {0: ""}, - 1: dict(zip(range(-1, 2), ("x", "z", "y"))), - 2: dict(zip(range(-2, 3), ("xy", "xz", "z^2", "yz", "x^2-y^2"))), + -1: dict(zip(range(4), ('s', 'p', 'd', 'f'))), + 0: {0: ''}, + 1: dict(zip(range(-1, 2), ('x', 'z', 'y'))), + 2: dict(zip(range(-2, 3), ('xy', 'xz', 'z^2', 'yz', 'x^2-y^2'))), 3: dict( zip( range(-3, 4), - ("x(x^2-3y^2)", "xyz", "xz^2", "z^3", "yz^2", "z(x^2-y^2)", "y(3x^2-y^2)"), + ('x(x^2-3y^2)', 'xyz', 'xz^2', 'z^3', 'yz^2', 'z(x^2-y^2)', 'y(3x^2-y^2)'), ) ), } @@ -81,17 +80,17 @@ class Mesh(MSection): sampling_method = Quantity( type=MEnum( - "Gamma-centered", - "Monkhorst-Pack", - "Gamma-offcenter", - "Line-path", - "Equidistant", - "Logarithmic", - "Tan", - "Gauss-Legendre", - "Gauss-Laguerre" "Clenshaw-Curtis", - "Newton-Cotes", - "Gauss-Hermite", + 'Gamma-centered', + 'Monkhorst-Pack', + 'Gamma-offcenter', + 'Line-path', + 'Equidistant', + 'Logarithmic', + 'Tan', + 'Gauss-Legendre', + 'Gauss-Laguerre' 'Clenshaw-Curtis', + 'Newton-Cotes', + 'Gauss-Hermite', ), shape=[], description=""" @@ -135,7 +134,7 @@ class Mesh(MSection): grid = Quantity( type=np.int32, - shape=["dimensionality"], + shape=['dimensionality'], description=""" Amount of mesh point sampling along each axis, i.e. [nx, ny, nz]. """, @@ -143,7 +142,7 @@ class Mesh(MSection): points = Quantity( type=np.complex128, - shape=["*", "dimensionality"], + shape=['*', 'dimensionality'], description=""" List of all the points in the mesh. """, @@ -151,7 +150,7 @@ class Mesh(MSection): multiplicities = Quantity( type=np.float64, - shape=["*"], + shape=['*'], description=""" The amount of times the same point reappears. These are accounted for in `n_points`. A value larger than 1, typically indicates a symmtery operation that was applied to the mesh. @@ -160,7 +159,7 @@ class Mesh(MSection): weights = Quantity( type=np.float64, - shape=["*"], + shape=['*'], description=""" The frequency of times the same point reappears. A value larger than 1, typically indicates a symmtery operation that was applied to the mesh. @@ -201,7 +200,7 @@ class LinePathSegment(MSection): points = Quantity( type=np.float64, - shape=["*", 3], + shape=['*', 3], description=""" List of all the points in the line path segment. """, @@ -227,7 +226,7 @@ class KMesh(Mesh): all_points = Quantity( type=np.float64, - shape=["*", 3], + shape=['*', 3], description=""" Full list of the mesh points without any symmetry operations. """, @@ -235,7 +234,7 @@ class KMesh(Mesh): high_symmetry_points = Quantity( type=str, - shape=["*"], + shape=['*'], description=""" Named high symmetry points in the mesh. """, @@ -253,8 +252,8 @@ class FrequencyMesh(Mesh): points = Quantity( type=np.complex128, - shape=["n_points", "dimensionality"], - unit="joule", + shape=['n_points', 'dimensionality'], + unit='joule', description=""" List of all the points in the mesh in joules. """, @@ -316,7 +315,7 @@ class Scf(MSection): threshold_energy_change = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Specifies the threshold for the total energy change between two subsequent self-consistent field (SCF) iterations. The SCF is considered converged when the @@ -372,7 +371,7 @@ class HubbardKanamoriModel(MSection): u = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Value of the (intraorbital) Hubbard interaction """, @@ -381,7 +380,7 @@ class HubbardKanamoriModel(MSection): jh = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Value of the (interorbital) Hund's coupling. """, @@ -390,7 +389,7 @@ class HubbardKanamoriModel(MSection): up = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Value of the (interorbital) Coulomb interaction. In rotational invariant systems, up = u - 2 * jh. @@ -400,7 +399,7 @@ class HubbardKanamoriModel(MSection): j = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Value of the exchange interaction. In rotational invariant systems, j = jh. """, @@ -409,7 +408,7 @@ class HubbardKanamoriModel(MSection): u_effective = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Value of the effective U parameter (u - j). """, @@ -418,7 +417,7 @@ class HubbardKanamoriModel(MSection): slater_integrals = Quantity( type=np.float64, shape=[3], - unit="joule", + unit='joule', description=""" Value of the Slater integrals (F0, F2, F4) in spherical harmonics used to derive the local Hubbard interactions: @@ -436,8 +435,8 @@ class HubbardKanamoriModel(MSection): umn = Quantity( type=np.float64, - shape=["n_orbital", "n_orbital"], - unit="joule", + shape=['n_orbital', 'n_orbital'], + unit='joule', description=""" Value of the local Coulomb interaction matrix. """, @@ -466,7 +465,7 @@ class Pseudopotential(MSection): ) type = Quantity( - type=MEnum("US V", "US MBK", "PAW"), + type=MEnum('US V', 'US MBK', 'PAW'), shape=[], description=""" Pseudopotential classification. @@ -490,7 +489,7 @@ class Pseudopotential(MSection): cutoff = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Minimum recommended spherical cutoff energy for any plane-wave basis set using the pseudopotential. @@ -499,7 +498,7 @@ class Pseudopotential(MSection): xc_functional_name = Quantity( type=str, - shape=["*"], + shape=['*'], description=""" Name of the exchange-correlation functional used to generate the pseudopotential. Follows the libxc naming convention. @@ -529,14 +528,14 @@ class SingleElectronState(MSection): # inherit from AtomicOrbitalState? """ quantities: list[str] = [ - "n_quantum_number", - "l_quantum_number", - "ml_quantum_number", - "ms_quantum_bool", - "j_quantum_number", - "mj_quantum_number", - "occupation", - "degeneracy", + 'n_quantum_number', + 'l_quantum_number', + 'ml_quantum_number', + 'ms_quantum_bool', + 'j_quantum_number', + 'mj_quantum_number', + 'occupation', + 'degeneracy', ] s_quantum_number = 0.5 nominal_occuption = 1.0 @@ -547,30 +546,30 @@ class SingleElectronState(MSection): # inherit from AtomicOrbitalState? ml_quantum_numbers = {k: invert_dict(v) for k, v in ml_quantum_symbols.items()} ms_quantum_map = (True, False) - ms_quantum_symbols = dict(zip(ms_quantum_map, ("up", "down"))) + ms_quantum_symbols = dict(zip(ms_quantum_map, ('up', 'down'))) ms_quantum_values = dict(zip(ms_quantum_map, (s_quantum_number, -s_quantum_number))) def __setattr__(self, name, value): - if name == "l_quantum_number": + if name == 'l_quantum_number': try: value = abs(value) except TypeError: return if self.n_quantum_number is not None: if value > self.n_quantum_number - 1: - raise ValueError(f"Invalid value for {name}: {value}") - elif name == "j_quantum_number": + raise ValueError(f'Invalid value for {name}: {value}') + elif name == 'j_quantum_number': try: value = [abs(x) for x in value] except TypeError: return - elif name == "ml_quantum_number": + elif name == 'ml_quantum_number': if isinstance(value, int): if value not in self.ml_quantum_symbols[self.l_quantum_number]: - raise ValueError(f"Invalid value for {name}: {value}") - elif name == "s_quantum_number": + raise ValueError(f'Invalid value for {name}: {value}') + elif name == 's_quantum_number': raise AttributeError( - "Cannot alter the spin quantum number $s$ of a single-electron state." + 'Cannot alter the spin quantum number $s$ of a single-electron state.' ) super().__setattr__(name, value) @@ -615,7 +614,7 @@ def get_l_degeneracy(self) -> int: 2 * self.l_quantum_number + 1 ) # TODO: replace with RussellSaundersState.multiplicity except TypeError: - raise ValueError("Cannot get $l$ degeneracy without $l$.") + raise ValueError('Cannot get $l$ degeneracy without $l$.') def set_degeneracy(self) -> int: """Set the degeneracy based on how specifically determined the quantum state is. @@ -672,7 +671,7 @@ def set_degeneracy(self) -> int: ) j_quantum_number = Quantity( type=np.float64, - shape=["1..2"], + shape=['1..2'], description=""" Total angular momentum quantum number $j = |l-s| ... l+s$. **Necessary with strong L-S coupling or non-collinear spin systems.** @@ -680,7 +679,7 @@ def set_degeneracy(self) -> int: ) mj_quantum_number = Quantity( type=np.float64, - shape=["*"], + shape=['*'], description=""" Azimuthal projection of the $j$ vector. **Necessary with strong L-S coupling or non-collinear spin systems.** @@ -713,16 +712,16 @@ class CoreHole(SingleElectronState): Any missing quantum numbers indicate some level of arbitrariness in the choice of the core hole, represented in the degeneracy. """ - quantities: list[str] = SingleElectronState.quantities + ["n_electrons_excited"] + quantities: list[str] = SingleElectronState.quantities + ['n_electrons_excited'] def __setattr__(self, name, value): - if name == "n_electrons_excited": + if name == 'n_electrons_excited': if value < 0.0: - raise ValueError("Number of excited electrons must be positive.") + raise ValueError('Number of excited electrons must be positive.') if value > 1.0: - raise ValueError("Number of excited electrons must be less than 1.") - elif name == "dscf_state": - if value == "initial": + raise ValueError('Number of excited electrons must be less than 1.') + elif name == 'dscf_state': + if value == 'initial': self.n_electrons_excited = 0.0 self.degeneracy = 1 super().__setattr__(name, value) @@ -738,7 +737,7 @@ def set_occupation(self) -> float: self.occupation = self.set_degeneracy() - self.n_electrons_excited except TypeError: raise AttributeError( - "Cannot set occupation without `n_electrons_excited`." + 'Cannot set occupation without `n_electrons_excited`.' ) return self.occupation @@ -759,7 +758,7 @@ def set_occupation(self) -> float: """, ) dscf_state = Quantity( - type=MEnum("initial", "final"), + type=MEnum('initial', 'final'), shape=[], description=""" The $\\Delta$-SCF state tag, used to identify the role in the workflow of the same name. @@ -827,7 +826,7 @@ class AtomParameters(MSection): mass = Quantity( type=np.float64, shape=[], - unit="kg", + unit='kg', description=""" Mass of the atom. """, @@ -855,7 +854,7 @@ class AtomParameters(MSection): orbitals = Quantity( type=str, - shape=["n_orbitals"], + shape=['n_orbitals'], description=""" Label of the active orbitals of the atoms. """, @@ -863,8 +862,8 @@ class AtomParameters(MSection): onsite_energies = Quantity( type=np.float64, - shape=["n_orbitals"], - unit="joule", + shape=['n_orbitals'], + unit='joule', description=""" Values of the atomic onsite energy corresponding to each orbital. """, @@ -873,7 +872,7 @@ class AtomParameters(MSection): charge = Quantity( type=np.float64, shape=[], - unit="coulomb", + unit='coulomb', description=""" Total charge of the atom. """, @@ -881,8 +880,8 @@ class AtomParameters(MSection): charges = Quantity( type=np.float64, - shape=["n_orbitals"], - unit="coulomb", + shape=['n_orbitals'], + unit='coulomb', description=""" Values of the charge corresponding to each orbital. """, @@ -943,7 +942,7 @@ class Photon(MSection): energy = Quantity( type=np.float64, - unit="joule", + unit='joule', description=""" Photon energy. """, @@ -997,7 +996,7 @@ class GaussianBasisGroup(MSection): contractions = Quantity( type=np.float64, - shape=["n_contractions", "n_exponents"], + shape=['n_contractions', 'n_exponents'], description=""" contraction coefficients $c_{i j}$ defining the contracted basis functions with respect to *normalized* primitive Gaussian functions. They define the Gaussian @@ -1007,8 +1006,8 @@ class GaussianBasisGroup(MSection): exponents = Quantity( type=np.float64, - shape=["n_exponents"], - unit="1 / meter ** 2", + shape=['n_exponents'], + unit='1 / meter ** 2', description=""" Exponents $\\alpha_j$ of the Gaussian functions defining this basis set $exp(-\\alpha_j r^2)$. One should be careful about the units of the coefficients. @@ -1017,7 +1016,7 @@ class GaussianBasisGroup(MSection): ls = Quantity( type=np.float64, - shape=["n_contractions"], + shape=['n_contractions'], description=""" Azimuthal quantum number ($l$) values (of the angular part given by the spherical harmonic $Y_{l m}$ of the various contracted basis functions). @@ -1082,7 +1081,7 @@ class OrbitalAPW(MSection): m_def = Section(validate=False) type = Quantity( - type=MEnum("APW", "LAPW", "LO", "spherical Dirac"), + type=MEnum('APW', 'LAPW', 'LO', 'spherical Dirac'), shape=[], description=""" State @@ -1141,8 +1140,8 @@ class OrbitalAPW(MSection): energy_parameter = Quantity( type=np.float64, - shape=["*"], - unit="joule", + shape=['*'], + unit='joule', description=""" Reference energy parameter for the augmented plane wave (APW) basis set. Is used to set the energy parameter for each state. @@ -1197,7 +1196,7 @@ class BasisSetMesh(MSection): m_def = Section(validate=False) shape = Quantity( - type=MEnum("cubic", "rectangular", "spherical", "ellipsoidal", "cylindrical"), + type=MEnum('cubic', 'rectangular', 'spherical', 'ellipsoidal', 'cylindrical'), shape=[], description=""" Geometry of the basis set mesh. @@ -1207,7 +1206,7 @@ class BasisSetMesh(MSection): box_lengths = Quantity( type=np.float64, shape=[3], - unit="meter", + unit='meter', description=""" Dimensions of the box containing the basis set mesh. """, @@ -1216,7 +1215,7 @@ class BasisSetMesh(MSection): radius = Quantity( type=np.float64, shape=[], - unit="meter", + unit='meter', description=""" Radius of the sphere. """, @@ -1224,8 +1223,8 @@ class BasisSetMesh(MSection): grid_spacing = Quantity( type=np.float64, - shape=["*"], - unit="meter", + shape=['*'], + unit='meter', description=""" Grid spacing of a Cartesian mesh. """, @@ -1234,7 +1233,7 @@ class BasisSetMesh(MSection): radius_lin_spacing = Quantity( type=np.float64, shape=[], - unit="meter", + unit='meter', description=""" The equidistant spacing of the radial grid. """, @@ -1283,14 +1282,14 @@ class BasisSet(BasisSetMesh): type = Quantity( type=MEnum( - "numeric AOs", - "gaussians", - "plane waves", - "psinc functions", - "real-space grid", - "pbeVaspFit2015", - "Koga", - "Bunge", + 'numeric AOs', + 'gaussians', + 'plane waves', + 'psinc functions', + 'real-space grid', + 'pbeVaspFit2015', + 'Koga', + 'Bunge', ), shape=[], description=""" @@ -1311,7 +1310,7 @@ class BasisSet(BasisSetMesh): scope = Quantity( type=str, - shape=["*"], + shape=['*'], description=""" The extent of the electronic structure that the basis set encodes. The partitions could be energetic (e.g. `core`, `valence`) in nature, @@ -1324,7 +1323,7 @@ class BasisSet(BasisSetMesh): cutoff = Quantity( type=np.float64, shape=[], - unit="joule", + unit='joule', description=""" Spherical cutoff in reciprocal space for a plane-wave basis set. It is the energy of the highest plane-wave ($\\frac{\\hbar^2|k+G|^2}{2m_e}$) included in the basis @@ -1361,7 +1360,7 @@ class BasisSet(BasisSetMesh): ) atom_parameters = Quantity( - type=Reference(SectionProxy("AtomParameters")), + type=Reference(SectionProxy('AtomParameters')), shape=[], description=""" Reference to a particular atom parameter setup further specifying the basis set. @@ -1391,17 +1390,17 @@ class BasisSetContainer(MSection): ) basis_sets = [ - "atom-centered orbitals", - "APW", - "LAPW", - "APW+lo", - "LAPW+lo", - "(L)APW", - "(L)APW+lo", - "plane waves", - "gaussians + plane waves", - "real-space grid", - "support functions", + 'atom-centered orbitals', + 'APW', + 'LAPW', + 'APW+lo', + 'LAPW+lo', + '(L)APW', + '(L)APW+lo', + 'plane waves', + 'gaussians + plane waves', + 'real-space grid', + 'support functions', unavailable, not_processed, ] @@ -1474,7 +1473,7 @@ class Interaction(MSection): atom_labels = Quantity( type=np.dtype(str), - shape=["n_interactions", "n_atoms"], + shape=['n_interactions', 'n_atoms'], description=""" Labels of the atoms described by the interaction. Can be a list of lists for interaction groupings. """, @@ -1512,7 +1511,7 @@ class Interaction(MSection): """, ) - contributions = SubSection(sub_section=SectionProxy("Interaction"), repeats=True) + contributions = SubSection(sub_section=SectionProxy('Interaction'), repeats=True) class Model(MSection): @@ -1610,8 +1609,8 @@ class XCFunctional(Model): def normalize_hybrid(self): for hyb in self.hybrid: - if "exact_exchange_mixing_factor" in hyb.parameters.keys() and not hyb.name: - hyb.name += "+alpha" + if 'exact_exchange_mixing_factor' in hyb.parameters.keys() and not hyb.name: + hyb.name += '+alpha' class DFT(MSection): @@ -1947,7 +1946,7 @@ class Wannier(MSection): energy_window_outer = Quantity( type=np.float64, - unit="electron_volt", + unit='electron_volt', shape=[2], description=""" Bottom and top of the outer energy window used for the projection. @@ -1956,7 +1955,7 @@ class Wannier(MSection): energy_window_inner = Quantity( type=np.float64, - unit="electron_volt", + unit='electron_volt', shape=[2], description=""" Bottom and top of the inner energy window used for the projection. @@ -2002,7 +2001,7 @@ class HoppingMatrix(MSection): degeneracy_factors = Quantity( type=np.int32, - shape=["n_wigner_seitz_points"], + shape=['n_wigner_seitz_points'], description=""" Degeneracy of each Wigner-Seitz grid point. """, @@ -2010,7 +2009,7 @@ class HoppingMatrix(MSection): value = Quantity( type=np.float64, - shape=["n_wigner_seitz_points", "n_orbitals * n_orbitals", 7], + shape=['n_wigner_seitz_points', 'n_orbitals * n_orbitals', 7], description=""" Real space hopping matrix for each Wigner-Seitz grid point. The elements are defined as follows: @@ -2051,7 +2050,7 @@ class LatticeModelHamiltonian(MSection): t_parameters = Quantity( type=np.complex128, - shape=["n_neighbors"], + shape=['n_neighbors'], description=""" Hopping parameters for simple models, with [t, t`, t``, etc]. """, @@ -2081,25 +2080,25 @@ class CoreHoleSpectra(MSection): edge = Quantity( type=MEnum( - "K", - "L1", - "L2", - "L3", - "L23", - "M1", - "M2", - "M3", - "M23", - "M4", - "M5", - "M45", - "N1", - "N2", - "N3", - "N23", - "N4", - "N5", - "N45", + 'K', + 'L1', + 'L2', + 'L3', + 'L23', + 'M1', + 'M2', + 'M3', + 'M23', + 'M4', + 'M5', + 'M45', + 'N1', + 'N2', + 'N3', + 'N23', + 'N4', + 'N5', + 'N45', ), description=""" Edge to be calculated for the core-hole spectra. @@ -2107,7 +2106,7 @@ class CoreHoleSpectra(MSection): ) mode = Quantity( - type=MEnum("absorption", "emission"), + type=MEnum('absorption', 'emission'), description=""" Type of spectra to be calculated: absorption or emission. """, @@ -2115,7 +2114,7 @@ class CoreHoleSpectra(MSection): broadening = Quantity( type=np.float64, - unit="joule", + unit='joule', description=""" Core-hole lifetime broadening applied to the edge spectra in full-width at half maximum. """, @@ -2158,7 +2157,7 @@ class ExcitedStateMethodology(MSection): broadening = Quantity( type=np.float64, - unit="joule", + unit='joule', description=""" Lifetime broadening applied to the spectra in full-width at half maximum. """, @@ -2198,14 +2197,14 @@ class GW(ExcitedStateMethodology): type = Quantity( type=MEnum( - "G0W0", - "scGW", - "scGW0", - "scG0W", - "ev-scGW0", - "ev-scGW", - "qp-scGW0", - "qp-scGW", + 'G0W0', + 'scGW', + 'scGW0', + 'scG0W', + 'ev-scGW0', + 'ev-scGW', + 'qp-scGW0', + 'qp-scGW', ), shape=[], description=""" @@ -2235,13 +2234,13 @@ class GW(ExcitedStateMethodology): analytical_continuation = Quantity( type=MEnum( - "pade", - "contour_deformation", - "ppm_GodbyNeeds", - "ppm_HybertsenLouie", - "ppm_vonderLindenHorsh", - "ppm_FaridEngel", - "multi_pole", + 'pade', + 'contour_deformation', + 'ppm_GodbyNeeds', + 'ppm_HybertsenLouie', + 'ppm_vonderLindenHorsh', + 'ppm_FaridEngel', + 'multi_pole', ), shape=[], description=""" @@ -2287,7 +2286,7 @@ class BSE(ExcitedStateMethodology): m_def = Section(validate=False) type = Quantity( - type=MEnum("Singlet", "Triplet", "IP", "RPA"), + type=MEnum('Singlet', 'Triplet', 'IP', 'RPA'), shape=[], description=""" Type of BSE hamiltonian solved: @@ -2317,7 +2316,7 @@ class BSE(ExcitedStateMethodology): ) solver = Quantity( - type=MEnum("Full-diagonalization", "Lanczos-Haydock", "GMRES", "SLEPc", "TDA"), + type=MEnum('Full-diagonalization', 'Lanczos-Haydock', 'GMRES', 'SLEPc', 'TDA'), shape=[], description=""" Solver algotithm used to diagonalize the BSE Hamiltonian. @@ -2360,7 +2359,7 @@ class DMFT(MSection): n_correlated_orbitals = Quantity( type=np.int32, - shape=["n_impurities"], + shape=['n_impurities'], description=""" Number of correlated orbitals per impurity. """, @@ -2368,7 +2367,7 @@ class DMFT(MSection): n_electrons = Quantity( type=np.float64, - shape=["n_impurities"], + shape=['n_impurities'], description=""" Initial number of valence electrons per impurity. """, @@ -2376,7 +2375,7 @@ class DMFT(MSection): inverse_temperature = Quantity( type=np.float64, - unit="1/joule", + unit='1/joule', shape=[], description=""" Inverse temperature = 1/(kB*T). @@ -2384,7 +2383,7 @@ class DMFT(MSection): ) magnetic_state = Quantity( - type=MEnum("paramagnetic", "ferromagnetic", "antiferromagnetic"), + type=MEnum('paramagnetic', 'ferromagnetic', 'antiferromagnetic'), shape=[], description=""" Magnetic state in which the DMFT calculation is done: @@ -2403,17 +2402,17 @@ class DMFT(MSection): impurity_solver = Quantity( type=MEnum( - "CT-INT", - "CT-HYB", - "CT-AUX", - "ED", - "NRG", - "MPS", - "IPT", - "NCA", - "OCA", - "slave_bosons", - "hubbard_I", + 'CT-INT', + 'CT-HYB', + 'CT-AUX', + 'ED', + 'NRG', + 'MPS', + 'IPT', + 'NCA', + 'OCA', + 'slave_bosons', + 'hubbard_I', ), shape=[], description=""" @@ -2466,7 +2465,7 @@ class NeighborSearching(MSection): neighbor_update_cutoff = Quantity( type=np.float64, shape=[], - unit="m", + unit='m', description=""" The distance cutoff for determining the neighbor list. """, @@ -2484,7 +2483,7 @@ class ForceCalculations(MSection): vdw_cutoff = Quantity( type=np.float64, shape=[], - unit="m", + unit='m', description=""" Cutoff for calculating VDW forces. """, @@ -2492,12 +2491,12 @@ class ForceCalculations(MSection): coulomb_type = Quantity( type=MEnum( - "cutoff", - "ewald", - "multilevel_summation", - "particle_mesh_ewald", - "particle_particle_particle_mesh", - "reaction_field", + 'cutoff', + 'ewald', + 'multilevel_summation', + 'particle_mesh_ewald', + 'particle_particle_particle_mesh', + 'reaction_field', ), shape=[], description=""" @@ -2532,7 +2531,7 @@ class ForceCalculations(MSection): coulomb_cutoff = Quantity( type=np.float64, shape=[], - unit="m", + unit='m', description=""" Cutoff for calculating short-ranged Coulomb forces. """, @@ -2622,7 +2621,7 @@ class Electronic(MSection): charge = Quantity( type=np.float64, shape=[], - unit="coulomb", + unit='coulomb', description=""" Stores the total charge of the system. """, @@ -2666,9 +2665,9 @@ class Electronic(MSection): relativity_method = Quantity( type=MEnum( [ - "scalar_relativistic", - "pseudo_scalar_relativistic", - "scalar_relativistic_atomic_ZORA", + 'scalar_relativistic', + 'pseudo_scalar_relativistic', + 'scalar_relativistic_atomic_ZORA', ] ), shape=[], @@ -2729,7 +2728,7 @@ class Method(ArchiveSection): m_def = Section(validate=False) label = Quantity( - type=MEnum("DFT", "TB", "GW", "DMFT", "BSE", "kMC", "NMR"), + type=MEnum('DFT', 'TB', 'GW', 'DMFT', 'BSE', 'kMC', 'NMR'), description=""" Label to identify the method applied in the simulation. Allowed values are: @@ -2769,7 +2768,7 @@ class Method(ArchiveSection): ) starting_method_ref = Quantity( - type=Reference(SectionProxy("Method")), + type=Reference(SectionProxy('Method')), shape=[], description=""" Links the current section method to a section method containing the starting @@ -2779,7 +2778,7 @@ class Method(ArchiveSection): ) core_method_ref = Quantity( - type=Reference(SectionProxy("Method")), + type=Reference(SectionProxy('Method')), shape=[], description=""" Links the current section method to a section method containing the core settings. @@ -2796,8 +2795,8 @@ class Method(ArchiveSection): ) methods_ref = Quantity( - type=Reference(SectionProxy("Method")), - shape=["n_references"], + type=Reference(SectionProxy('Method')), + shape=['n_references'], description=""" Links the section method to other method sections. For instance, one calculation is a perturbation performed using a self-consistent field (SCF) calculation as @@ -2837,15 +2836,15 @@ class Method(ArchiveSection): scf = SubSection(sub_section=Scf.m_def) atom_parameters = SubSection( - sub_section=AtomParameters.m_def, repeats=True, label_quantity="label" + sub_section=AtomParameters.m_def, repeats=True, label_quantity='label' ) molecule_parameters = SubSection( - sub_section=MoleculeParameters.m_def, repeats=True, label_quantity="label" + sub_section=MoleculeParameters.m_def, repeats=True, label_quantity='label' ) electrons_representation = SubSection( - sub_section=BasisSetContainer.m_def, repeats=True, label_quantity="type" + sub_section=BasisSetContainer.m_def, repeats=True, label_quantity='type' ) photon = SubSection(sub_section=Photon.m_def, repeats=True) diff --git a/runschema/run.py b/runschema/run.py index 633bf98..e47dd1d 100644 --- a/runschema/run.py +++ b/runschema/run.py @@ -17,24 +17,23 @@ # import numpy as np - +from nomad.datamodel.data import ArchiveSection +from nomad.datamodel.metainfo.common import FastAccess from nomad.metainfo import ( - MSection, - MCategory, Category, + MCategory, + MSection, Package, Quantity, + Reference, Section, - SubSection, SectionProxy, - Reference, + SubSection, ) + +from .calculation import Calculation from .method import Method from .system import System -from .calculation import Calculation -from nomad.datamodel.metainfo.common import FastAccess -from nomad.datamodel.data import ArchiveSection - m_package = Package() @@ -95,7 +94,7 @@ class Program(MSection): compilation_datetime = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Contains the program compilation date and time from *Unix epoch* (00:00:00 UTC on 1 January 1970) in seconds. For date and times without a timezone, the default @@ -124,7 +123,7 @@ class TimeRun(MSection): date_end = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the end date of the run as time since the *Unix epoch* (00:00:00 UTC on 1 January 1970) in seconds. For date and times without a timezone, the default @@ -135,7 +134,7 @@ class TimeRun(MSection): date_start = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the start date of the run as time since the *Unix epoch* (00:00:00 UTC on 1 January 1970) in seconds. For date and times without a timezone, the default @@ -146,7 +145,7 @@ class TimeRun(MSection): cpu1_end = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the end time of the run on CPU 1. """, @@ -155,7 +154,7 @@ class TimeRun(MSection): cpu1_start = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the start time of the run on CPU 1. """, @@ -164,7 +163,7 @@ class TimeRun(MSection): wall_end = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the internal wall-clock time at the end of the run. """, @@ -173,7 +172,7 @@ class TimeRun(MSection): wall_start = Quantity( type=np.dtype(np.float64), shape=[], - unit="second", + unit='second', description=""" Stores the internal wall-clock time from the start of the run. """, @@ -238,7 +237,7 @@ class Run(ArchiveSection): ) starting_run_ref = Quantity( - type=Reference(SectionProxy("Run")), + type=Reference(SectionProxy('Run')), shape=[], description=""" Links the current section run to a section run containing the calculations from @@ -256,8 +255,8 @@ class Run(ArchiveSection): ) runs_ref = Quantity( - type=Reference(SectionProxy("Run")), - shape=["n_references"], + type=Reference(SectionProxy('Run')), + shape=['n_references'], description=""" Links the the current section to other run sections. Such a link is necessary for example for workflows that may contain a series of runs. diff --git a/runschema/system.py b/runschema/system.py index 90ad204..7f07b98 100644 --- a/runschema/system.py +++ b/runschema/system.py @@ -16,22 +16,22 @@ # limitations under the License. # -import numpy as np import typing + +import numpy as np +from nomad.datamodel.data import ArchiveSection +from nomad.datamodel.metainfo.common import FastAccess from nomad.metainfo import ( MSection, Package, Quantity, + Reference, Section, - SubSection, SectionProxy, - Reference, + SubSection, ) -from nomad.datamodel.data import ArchiveSection -from nomad.datamodel.metainfo.common import FastAccess from nomad.units import ureg - m_package = Package() @@ -87,7 +87,7 @@ class AtomsGroup(MSection): atom_indices = Quantity( type=np.dtype(np.int32), - shape=["n_atoms"], + shape=['n_atoms'], description=""" Indices of the atoms in the group with respect to the system. """, @@ -111,7 +111,7 @@ class AtomsGroup(MSection): """, ) - atoms_group = SubSection(sub_section=SectionProxy("AtomsGroup"), repeats=True) + atoms_group = SubSection(sub_section=SectionProxy('AtomsGroup'), repeats=True) class Atoms(MSection): @@ -132,7 +132,7 @@ class Atoms(MSection): atomic_numbers = Quantity( type=np.dtype(np.int32), - shape=["n_atoms"], + shape=['n_atoms'], description=""" List of atomic numbers Z of the atoms identified in labels. If a species cannot be assigned Z, a negative value can also be used to distinguish it. @@ -141,7 +141,7 @@ class Atoms(MSection): equivalent_atoms = Quantity( type=np.dtype(np.int32), - shape=["n_atoms"], + shape=['n_atoms'], description=""" Gives a mapping table of atoms to symmetrically independent atoms in the standardized cell. This is used to find symmetrically equivalent atoms. @@ -150,7 +150,7 @@ class Atoms(MSection): wyckoff_letters = Quantity( type=str, - shape=["n_atoms"], + shape=['n_atoms'], description=""" Wyckoff letters corresponding to each atom. """, @@ -158,7 +158,7 @@ class Atoms(MSection): concentrations = Quantity( type=np.dtype(np.float64), - shape=["n_atoms"], + shape=['n_atoms'], description=""" Concentrations of the species defined by labels which can be assigned for systems with variable compositions. @@ -167,7 +167,7 @@ class Atoms(MSection): species = Quantity( type=np.dtype(np.int32), - shape=["n_atoms"], + shape=['n_atoms'], description=""" Species of the atom (normally the atomic number Z, 0 or negative for unidentifed species or particles that are not atoms. @@ -176,7 +176,7 @@ class Atoms(MSection): labels = Quantity( type=str, - shape=["n_atoms"], + shape=['n_atoms'], description=""" List containing the labels of the atoms. In the usual case, these correspond to the chemical symbols of the atoms. One can also append an index if there is a @@ -191,8 +191,8 @@ class Atoms(MSection): positions = Quantity( type=np.dtype(np.float64), - shape=["n_atoms", 3], - unit="meter", + shape=['n_atoms', 3], + unit='meter', description=""" Positions of all the species, in cartesian coordinates. This metadata defines a configuration and is therefore required. For alloys where concentrations of @@ -203,8 +203,8 @@ class Atoms(MSection): velocities = Quantity( type=np.dtype(np.float64), - shape=["n_atoms", 3], - unit="meter / second", + shape=['n_atoms', 3], + unit='meter / second', description=""" Velocities of the nuclei, defined as the change in cartesian coordinates of the nuclei with respect to time. @@ -214,7 +214,7 @@ class Atoms(MSection): lattice_vectors = Quantity( type=np.dtype(np.float64), shape=[3, 3], - unit="meter", + unit='meter', description=""" Lattice vectors of the simulation cell in cartesian coordinates. The last (fastest) index runs over the $x,y,z$ Cartesian coordinates, and the first @@ -225,7 +225,7 @@ class Atoms(MSection): lattice_vectors_reciprocal = Quantity( type=np.dtype(np.float64), shape=[3, 3], - unit="1/meter", + unit='1/meter', description=""" Reciprocal lattice vectors of the simulation cell, in cartesian coordinates and with the 2 $pi$ pre-factor. The first index runs over the $x,y,z$ Cartesian coordinates, and the second index runs @@ -235,7 +235,7 @@ class Atoms(MSection): local_rotations = Quantity( type=np.dtype(np.float64), - shape=["n_atoms", 3, 3], + shape=['n_atoms', 3, 3], description=""" A rotation matrix defining the orientation of each atom. If the rotation matrix cannot be specified for an atom, the remaining atoms should set it to @@ -510,7 +510,7 @@ class SpringerMaterial(MSection): compound_class = Quantity( type=str, - shape=["N"], + shape=['N'], description=""" Name of a class of the current compound, as defined in by Springer Materials. This is a property of the chemical formula of the compound @@ -519,7 +519,7 @@ class SpringerMaterial(MSection): classification = Quantity( type=str, - shape=["N"], + shape=['N'], description=""" Contains the classification name of the current material according to Springer Materials @@ -564,7 +564,7 @@ class Constraint(MSection): atom_indices = Quantity( type=np.dtype(np.int32), - shape=["n_constraints", "n_atoms"], + shape=['n_constraints', 'n_atoms'], description=""" List of the indexes involved in this constraint. """, @@ -588,8 +588,8 @@ class MACE(MSection): ) system_descriptor = Quantity( - type=np.dtype("float64"), - shape=["*"], + type=np.dtype('float64'), + shape=['*'], description=""" MACE descriptors computed using the MACE-MP-0 foundation model and averaged across all atoms in the system. """, @@ -615,13 +615,13 @@ class SOAP(MSection): """, ) r_cut = Quantity( - type=np.dtype("float64"), + type=np.dtype('float64'), description=""" Cutoff distance defining each local environment. """, ) atom_sigma = Quantity( - type=np.dtype("float64"), + type=np.dtype('float64'), description=""" Width of Gaussians used in density expansion """, @@ -670,8 +670,8 @@ class SOAP(MSection): ) structural_soap = Quantity( - type=np.dtype("float64"), - shape=["*"], + type=np.dtype('float64'), + shape=['*'], description=""" 1. Structure scaled so that the average nearest neighbour distance is 1.54 AA. Atoms in the initial structure without a neighbour within 10 AA do not count towards the scaling factor and structures with no neighbours within 10 AA are not scaled at all. @@ -749,7 +749,7 @@ class System(ArchiveSection): ) sub_system_ref = Quantity( - type=Reference(SectionProxy("System")), + type=Reference(SectionProxy('System')), shape=[], description=""" Links the current section system to a sub system. @@ -758,8 +758,8 @@ class System(ArchiveSection): ) systems_ref = Quantity( - type=Reference(SectionProxy("System")), - shape=["n_references"], + type=Reference(SectionProxy('System')), + shape=['n_references'], description=""" Links the current section system to other section systems. Such a link is necessary for example between the supercell and the reference unit cell in a phonon diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..c21ea4c --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,18 @@ +# +# 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. +# diff --git a/tests/test_runschema.py b/tests/test_runschema.py index da244bb..c6106d7 100644 --- a/tests/test_runschema.py +++ b/tests/test_runschema.py @@ -16,7 +16,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import runschema def test_schema(): - pass + run = runschema.run.Run() + assert run.m_def.definition_id == 'fc17fdfdcba5aef2c02835a81ed65f95f314b687' + run.calculation.append(runschema.calculation.Calculation()) + run.method.append(runschema.method.Method()) + run.system.append(runschema.system.System())