diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bac67ab..16f5b59f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - uses: pre-commit/action@v3.0.0 + - uses: actions/checkout@v3.3.0 + - name: Set up Python + uses: actions/setup-python@v4.5.0 + with: + python-version: "3.9" + - name: Make sure virtualevn>20 is installed, which will yield newer pip and possibility to pin pip version. + run: pip install "virtualenv>20" + - name: Install Tox + run: pip install tox + - name: Run pre-commit in Tox + run: tox -e pre-commit + tests: @@ -31,16 +37,14 @@ jobs: fail-fast: false matrix: include: - - python-version: "3.8" - lammps-version: "2020.03.03" - - python-version: "3.8" - lammps-version: "2020.12.24" - python-version: "3.9" lammps-version: "2020.12.24" - python-version: "3.9" - lammps-version: "2020.03.03" + lammps-version: "2022.06.23" - python-version: "3.10" - lammps-version: "2021.09.29" + lammps-version: "2022.06.23" + - python-version: "3.11" + lammps-version: "2022.06.23" runs-on: ubuntu-latest @@ -87,10 +91,10 @@ jobs: - name: Run pytest run: | - tox -e ${{ matrix.python-version }}-aiida_lammps -- tests/ --cov=./aiida_lammps --cov-append --cov-report=xml --cov-report=term-missing + tox -e ${{ matrix.python-version }}-aiida_lammps -- tests/ --cov=aiida_lammps --cov-append --cov-report=xml --cov-report=term-missing - name: Upload to Codecov - if: matrix.python-version == 3.8 + if: matrix.python-version == 3.10 uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/conftest.py b/conftest.py index 39c17402..be0bfd28 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,7 @@ """ initialise a test database and profile """ + # pylint: disable=redefined-outer-name from __future__ import annotations @@ -14,18 +15,18 @@ from aiida import orm from aiida.common import AttributeDict, CalcInfo, LinkType, exceptions -from aiida.engine import CalcJob +from aiida.engine import Process from aiida.engine.utils import instantiate_process from aiida.manage.manager import get_manager from aiida.plugins import WorkflowFactory from aiida.plugins.entry_point import format_entry_point_string +from aiida_lammps.calculations.base import LammpsBaseCalculation +from aiida_lammps.data.potential import LammpsPotentialData +from aiida_lammps.data.trajectory import LammpsTrajectory import numpy as np import pytest import yaml -from aiida_lammps.calculations.base import LammpsBaseCalculation -from aiida_lammps.data.potential import LammpsPotentialData -from aiida_lammps.data.trajectory import LammpsTrajectory from tests.utils import TEST_DIR, AiidaTestApp pytest_plugins = ["aiida.manage.tests.pytest_fixtures"] @@ -68,6 +69,12 @@ def pytest_report_header(config): ] +@pytest.fixture +def structure_parameters() -> AttributeDict: + parameteters = AttributeDict({"dimension": 2, "boundary": ["p", "p", "f"]}) + return parameteters + + @pytest.fixture def filepath_tests() -> pathlib.Path: """Return the path to the tests folder.""" @@ -119,6 +126,15 @@ def parameters_minimize() -> AttributeDict: "ke/atom": [{"type": [{"keyword": " ", "value": " "}], "group": "all"}], "stress/atom": [{"type": ["NULL"], "group": "all"}], "pressure": [{"type": ["thermo_temp"], "group": "all"}], + "property/atom": [ + { + "type": [ + {"keyword": " ", "value": "fx"}, + {"keyword": " ", "value": "fy"}, + ], + "group": "all", + } + ], } parameters.minimize = { @@ -171,6 +187,15 @@ def parameters_minimize_groups() -> AttributeDict: "stress/atom": [{"type": ["NULL"], "group": "all"}], "pressure": [{"type": ["thermo_temp"], "group": "all"}], "ke": [{"type": [{"keyword": " ", "value": " "}], "group": "test"}], + "property/atom": [ + { + "type": [ + {"keyword": " ", "value": "fx"}, + {"keyword": " ", "value": "fy"}, + ], + "group": "all", + } + ], } parameters.minimize = { @@ -218,6 +243,15 @@ def parameters_md_nve() -> AttributeDict: "ke/atom": [{"type": [{"keyword": " ", "value": " "}], "group": "all"}], "stress/atom": [{"type": ["NULL"], "group": "all"}], "pressure": [{"type": ["thermo_temp"], "group": "all"}], + "property/atom": [ + { + "type": [ + {"keyword": " ", "value": "fx"}, + {"keyword": " ", "value": "fy"}, + ], + "group": "all", + } + ], } parameters.md = { "integration": { @@ -262,6 +296,15 @@ def parameters_md_nvt() -> AttributeDict: "ke/atom": [{"type": [{"keyword": " ", "value": " "}], "group": "all"}], "stress/atom": [{"type": ["NULL"], "group": "all"}], "pressure": [{"type": ["thermo_temp"], "group": "all"}], + "property/atom": [ + { + "type": [ + {"keyword": " ", "value": "fx"}, + {"keyword": " ", "value": "fy"}, + ], + "group": "all", + } + ], } parameters.md = { "integration": { @@ -309,6 +352,15 @@ def parameters_md_npt() -> AttributeDict: "ke/atom": [{"type": [{"keyword": " ", "value": " "}], "group": "all"}], "stress/atom": [{"type": ["NULL"], "group": "all"}], "pressure": [{"type": ["thermo_temp"], "group": "all"}], + "property/atom": [ + { + "type": [ + {"keyword": " ", "value": "fx"}, + {"keyword": " ", "value": "fy"}, + ], + "group": "all", + } + ], } parameters.md = { "integration": { @@ -565,7 +617,7 @@ def factory( entry_point_name: str, inputs: dict[str, Any] | None = None, return_process: bool = False, - ) -> tuple[pathlib.Path, CalcInfo] | CalcJob: + ) -> tuple[pathlib.Path, CalcInfo] | Process: """Create a :class:`aiida.engine.CalcJob` instance with the given inputs. :param entry_point_name: The entry point name of the calculation job plugin to run. diff --git a/docs/source/conf.py b/docs/source/conf.py index 1e21a00e..3057090c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,11 +4,11 @@ `tox -e docs-clean` and `tox -e docs-update`, or directly: `sphinx-build -n -W --keep-going docs/source docs/_build` """ + import pathlib import time -from aiida.manage.configuration import load_documentation_profile - +from aiida.manage.configuration import Profile, load_profile from aiida_lammps import __version__ # -- AiiDA-related setup -------------------------------------------------- @@ -16,7 +16,7 @@ # Load the dummy profile even if we are running locally, this way the # documentation will succeed even if the current # default profile of the AiiDA installation does not use a Django backend. -load_documentation_profile() +load_profile(Profile("docs", {"process_control": {}, "storage": {}})) project = "AiiDA LAMMPS" copyright = f"2021-{time.localtime().tm_year}, AiiDA Team. All rights reserved" @@ -45,7 +45,7 @@ # Settings for the `autoapi.extenstion` automatically generating API docs filepath_docs = pathlib.Path(__file__).parent.parent -filepath_src = filepath_docs.parent / "aiida_lammps" +filepath_src = filepath_docs.parent / "src/aiida_lammps" autoapi_type = "python" autoapi_dirs = [filepath_src] autoapi_ignore = [filepath_src / "*cli*"] diff --git a/docs/source/developers/index.md b/docs/source/developers/index.md index cf625086..9f05edd1 100644 --- a/docs/source/developers/index.md +++ b/docs/source/developers/index.md @@ -32,7 +32,7 @@ The test suite can be run in an isolated, virtual environment using `tox` (see ` ```console pip install tox -tox -e 3.8-aiida_lammps +tox -e 3.9-aiida_lammps ``` or directly: @@ -57,7 +57,7 @@ conda install lammps==2019.06.05 You can specify a different executable name for LAMMPS with: ```console -tox -e 3.8-aiida_lammps -- --lammps-exec lmp_exec +tox -e 3.9-aiida_lammps -- --lammps-exec lmp_exec ``` To output the results of calcjob executions to a specific directory: diff --git a/docs/source/topics/data/parameters.md b/docs/source/topics/data/parameters.md index 8b538a86..9c32174f 100644 --- a/docs/source/topics/data/parameters.md +++ b/docs/source/topics/data/parameters.md @@ -58,6 +58,8 @@ The dictionary is separated into several nested dictionaries that control differ * ``box_tilt``: determines how [skewed the cell](https://docs.lammps.org/box.html) is, of great importance for triclinic systems (default: ``small``). * ``groups``: list with the names of the groups to be added. The names of the possible groups are generated by the list of possible kind names generated by the structure (default: skip parameter). * ``atom_style``: how the [atoms](https://docs.lammps.org/atom_style.html) are treated by the ``LAMMPS`` simulation. + * ``boundary``: allows to override the [boundary](https://docs.lammps.org/boundary.html) conditions as set by the AiiDA structure as they can be incompatible with what ``LAMMPS`` expects. + * ``dimension``: allows to override the [dimension](https://docs.lammps.org/dimension.html) as determined by the AiiDA structure as it is determined by the boundary conditions and this is not what ``LAMMPS`` expects. - ``potential``: parameters related to the potential describing the system: * ``potential_style_options``: extra parameters related to each of the possible pair styles (default: skip parameter). * ``neighbor``: sets the parameters affecting the construction of the [neighbor list](https://docs.lammps.org/neighbor.html) (default: skip parameter). diff --git a/docs/source/tutorials/include/scripts/run_md_basic.py b/docs/source/tutorials/include/scripts/run_md_basic.py index 34f01794..d52d99c8 100755 --- a/docs/source/tutorials/include/scripts/run_md_basic.py +++ b/docs/source/tutorials/include/scripts/run_md_basic.py @@ -3,11 +3,10 @@ from aiida.engine import run from aiida.orm import Dict, StructureData, load_code +from aiida_lammps.data.potential import LammpsPotentialData from ase.build import bulk import requests -from aiida_lammps.data.potential import LammpsPotentialData - # Load the code configured for ``lmp``. Make sure to replace # this string with the label used in the code setup. code = load_code("lammps@localhost") diff --git a/docs/source/tutorials/include/scripts/run_minimization_basic.py b/docs/source/tutorials/include/scripts/run_minimization_basic.py index 79a3b0ae..c5d4fffd 100755 --- a/docs/source/tutorials/include/scripts/run_minimization_basic.py +++ b/docs/source/tutorials/include/scripts/run_minimization_basic.py @@ -3,11 +3,10 @@ from aiida.engine import run from aiida.orm import Dict, StructureData, load_code +from aiida_lammps.data.potential import LammpsPotentialData from ase.build import bulk import requests -from aiida_lammps.data.potential import LammpsPotentialData - # Load the code configured for ``lmp``. Make sure to replace # this string with the label used in the code setup. code = load_code("lammps@localhost") diff --git a/examples/calculations/launch_lammps_md.py b/examples/calculations/launch_lammps_md.py index 8b9bdefd..c09562e2 100644 --- a/examples/calculations/launch_lammps_md.py +++ b/examples/calculations/launch_lammps_md.py @@ -5,9 +5,8 @@ from aiida.common.extendeddicts import AttributeDict from aiida.engine import run_get_node from aiida.plugins import CalculationFactory -import numpy as np - from aiida_lammps.data.potential import LammpsPotentialData +import numpy as np def generate_structure() -> orm.StructureData: diff --git a/examples/calculations/launch_lammps_minimize.py b/examples/calculations/launch_lammps_minimize.py index 5da8bf8f..e4914f3a 100644 --- a/examples/calculations/launch_lammps_minimize.py +++ b/examples/calculations/launch_lammps_minimize.py @@ -5,9 +5,8 @@ from aiida.common.extendeddicts import AttributeDict from aiida.engine import run_get_node from aiida.plugins import CalculationFactory -import numpy as np - from aiida_lammps.data.potential import LammpsPotentialData +import numpy as np def generate_structure() -> orm.StructureData: diff --git a/examples/launch_lammps_base_restart_file.py b/examples/launch_lammps_base_restart_file.py index 6676b9eb..182897ba 100644 --- a/examples/launch_lammps_base_restart_file.py +++ b/examples/launch_lammps_base_restart_file.py @@ -5,9 +5,8 @@ from aiida.common.extendeddicts import AttributeDict from aiida.engine import run_get_node from aiida.plugins import CalculationFactory -import numpy as np - from aiida_lammps.data.potential import LammpsPotentialData +import numpy as np def generate_structure() -> orm.StructureData: diff --git a/examples/launch_lammps_base_restart_folder.py b/examples/launch_lammps_base_restart_folder.py index 6676b9eb..182897ba 100644 --- a/examples/launch_lammps_base_restart_folder.py +++ b/examples/launch_lammps_base_restart_folder.py @@ -5,9 +5,8 @@ from aiida.common.extendeddicts import AttributeDict from aiida.engine import run_get_node from aiida.plugins import CalculationFactory -import numpy as np - from aiida_lammps.data.potential import LammpsPotentialData +import numpy as np def generate_structure() -> orm.StructureData: diff --git a/pyproject.toml b/pyproject.toml index d10f684b..1b87f46b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,30 +5,34 @@ build-backend = "flit_core.buildapi" [project] name = "aiida-lammps" dynamic = ["version", "description"] -authors = [{name = "Chris Sewell", email = "chrisj_sewell@hotmail.com"}, {name = "Jonathan Chico", email = "jonathan.chico@sandvik.com"}] +authors = [ + { name = "Chris Sewell", email = "chrisj_sewell@hotmail.com" }, + { name = "Jonathan Chico", email = "jonathan.chico@sandvik.com" }, +] readme = "README.md" -license = {file = "LICENSE"} +license = { file = "LICENSE" } classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Chemistry", "Topic :: Scientific/Engineering :: Physics", - "Framework :: AiiDA" + "Framework :: AiiDA", ] keywords = ["aiida", "workflows", "lammps"] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ - "aiida-core[atomic_tools]>=2.0.0,<3.0.0", + "aiida-core[atomic_tools]~=2.3", "importlib_resources", - "jsonschema", + "jsonschema~=3.2.0", "numpy", "packaging", - "python-dateutil" + "python-dateutil", ] [project.urls] @@ -43,7 +47,7 @@ tests = [ "pytest-cov", "coverage", "pytest-timeout", - "pytest-regressions" + "pytest-regressions", ] docs = [ @@ -55,7 +59,7 @@ docs = [ 'sphinxcontrib-details-directive~=0.1.0', 'sphinx-autoapi~=3.0', 'myst_parser~=2.0.0', - "furo" + "furo", ] [project.entry-points."aiida.calculations"] @@ -79,15 +83,13 @@ docs = [ name = "aiida_lammps" [tool.flit.sdist] -exclude = [ - "docs/", - "tests/", -] +exclude = ["docs/", "tests/"] [tool.coverage.run] # Configuration of [coverage.py](https://coverage.readthedocs.io) # reporting which lines of your plugin are covered by tests -source=["aiida_lammps"] +source = ["src"] + [tool.ruff] extend-select = ["B0", "C4", "I", "ICN", "ISC", "N", "RUF", "SIM", "UP"] @@ -99,7 +101,7 @@ force-sort-within-sections = true [tool.tox] legacy_tox_ini = """ [tox] -envlist = pre-commit,{3.8,3.9,3.10}-aiida_lammps +envlist = pre-commit,{3.9,3.10,3.11}-aiida_lammps requires = virtualenv >= 20 isolated_build = True diff --git a/aiida_lammps/__init__.py b/src/aiida_lammps/__init__.py similarity index 62% rename from aiida_lammps/__init__.py rename to src/aiida_lammps/__init__.py index 1d655740..19e9d350 100644 --- a/aiida_lammps/__init__.py +++ b/src/aiida_lammps/__init__.py @@ -1,2 +1,3 @@ """AiiDA plugin for the LAMMPS code""" -__version__ = "1.0.1" + +__version__ = "1.0.2" diff --git a/aiida_lammps/calculations/__init__.py b/src/aiida_lammps/calculations/__init__.py similarity index 100% rename from aiida_lammps/calculations/__init__.py rename to src/aiida_lammps/calculations/__init__.py diff --git a/aiida_lammps/calculations/base.py b/src/aiida_lammps/calculations/base.py similarity index 99% rename from aiida_lammps/calculations/base.py rename to src/aiida_lammps/calculations/base.py index e146bb41..f70ede32 100644 --- a/aiida_lammps/calculations/base.py +++ b/src/aiida_lammps/calculations/base.py @@ -7,7 +7,7 @@ the input structure and whether or not a restart file is provided. """ import os -from typing import ClassVar, Dict, Union +from typing import ClassVar, Union from aiida import orm from aiida.common import datastructures @@ -30,7 +30,7 @@ class LammpsBaseCalculation(CalcJob): the input structure and whether or not a restart file is provided. """ - _DEFAULT_VARIABLES: ClassVar[Dict[str, str]] = { + _DEFAULT_VARIABLES: ClassVar[dict[str, str]] = { "input_filename": "input.in", "structure_filename": "structure.dat", "output_filename": "lammps.out", diff --git a/aiida_lammps/calculations/raw.py b/src/aiida_lammps/calculations/raw.py similarity index 100% rename from aiida_lammps/calculations/raw.py rename to src/aiida_lammps/calculations/raw.py diff --git a/aiida_lammps/data/__init__.py b/src/aiida_lammps/data/__init__.py similarity index 100% rename from aiida_lammps/data/__init__.py rename to src/aiida_lammps/data/__init__.py diff --git a/aiida_lammps/data/lammps_potentials.json b/src/aiida_lammps/data/lammps_potentials.json similarity index 100% rename from aiida_lammps/data/lammps_potentials.json rename to src/aiida_lammps/data/lammps_potentials.json diff --git a/aiida_lammps/data/potential.py b/src/aiida_lammps/data/potential.py similarity index 99% rename from aiida_lammps/data/potential.py rename to src/aiida_lammps/data/potential.py index 3a9ab683..65e2607c 100644 --- a/aiida_lammps/data/potential.py +++ b/src/aiida_lammps/data/potential.py @@ -23,7 +23,7 @@ class written by Sebastiaan Huber. import json import os import pathlib -from typing import Any, BinaryIO, ClassVar, Dict, List, Optional, Union +from typing import Any, BinaryIO, ClassVar, Optional, Union import warnings from aiida import orm, plugins @@ -47,7 +47,7 @@ def _validate_string(data: str) -> str: return data -def _validate_string_list(data: Union[str, List[str]]) -> List[str]: +def _validate_string_list(data: Union[str, list[str]]) -> list[str]: """ Validate the a list of strings @@ -86,7 +86,7 @@ def _validate_datetime(data: Union[str, int, float, datetime.datetime]) -> int: return data -def _validate_sources(data: Union[dict, List[dict]]) -> List[dict]: +def _validate_sources(data: Union[dict, list[dict]]) -> list[dict]: """ Validate the sources for the potential. @@ -164,7 +164,7 @@ class written by Sebaastian Huber. "lammps_potentials.json", ) - _extra_keys: ClassVar[Dict[str, Any]] = { + _extra_keys: ClassVar[dict[str, Any]] = { "title": {"validator": _validate_string}, "developer": {"validator": _validate_string_list}, "publication_year": {"validator": _validate_datetime}, diff --git a/aiida_lammps/data/trajectory.py b/src/aiida_lammps/data/trajectory.py similarity index 100% rename from aiida_lammps/data/trajectory.py rename to src/aiida_lammps/data/trajectory.py diff --git a/aiida_lammps/parsers/__init__.py b/src/aiida_lammps/parsers/__init__.py similarity index 100% rename from aiida_lammps/parsers/__init__.py rename to src/aiida_lammps/parsers/__init__.py diff --git a/aiida_lammps/parsers/base.py b/src/aiida_lammps/parsers/base.py similarity index 97% rename from aiida_lammps/parsers/base.py rename to src/aiida_lammps/parsers/base.py index a6ef2be5..916ba9f1 100644 --- a/aiida_lammps/parsers/base.py +++ b/src/aiida_lammps/parsers/base.py @@ -7,7 +7,7 @@ import glob import os import time -from typing import Union +from typing import Any, Union from aiida import orm from aiida.common import exceptions @@ -178,8 +178,8 @@ def parse(self, **kwargs): def parse_restartfile( self, - parameters: dict, - list_of_files: list, + parameters: dict[str, Any], + list_of_files: list[str], temp_folder: Union[os.PathLike, str, None], ) -> str: """ @@ -249,8 +249,8 @@ def parse_restartfile( self.out("restartfile", restart_file) return restart_filename - def check_convergence(self, global_data: dict): - """Check for the convergence of the calculaiton in the case of a minimization run""" + def check_convergence(self, global_data: dict[str, Any]): + """Check for the convergence of the calculation in the case of a minimization run""" _etol = global_data.get("minimization", {}).get( "energy_relative_difference", None ) diff --git a/aiida_lammps/parsers/inputfile.py b/src/aiida_lammps/parsers/inputfile.py similarity index 89% rename from aiida_lammps/parsers/inputfile.py rename to src/aiida_lammps/parsers/inputfile.py index 43cd89f6..9f40e354 100644 --- a/aiida_lammps/parsers/inputfile.py +++ b/src/aiida_lammps/parsers/inputfile.py @@ -10,11 +10,12 @@ fixes block is never called, on the other hand the control block is always called since it is necessary for the functioning of LAMMPS. """ + from builtins import ValueError import json import os import re -from typing import Optional, Union +from typing import Any, Optional, Union from aiida import orm import numpy as np @@ -24,7 +25,7 @@ def generate_input_file( - parameters: dict, + parameters: dict[str, Any], potential: LammpsPotentialData, structure: orm.StructureData, trajectory_filename: str = "aiida_lammps.trajectory.dump", @@ -173,7 +174,7 @@ def generate_input_file( return input_file -def write_control_block(parameters_control: dict) -> str: +def write_control_block(parameters_control: dict[str, Any]) -> str: """ Generate the input block with global control options. @@ -214,7 +215,7 @@ def write_control_block(parameters_control: dict) -> str: def write_potential_block( potential: LammpsPotentialData, structure: orm.StructureData, - parameters_potential: dict, + parameters_potential: dict[str, Any], potential_file: str, ) -> str: """ @@ -271,10 +272,10 @@ def write_potential_block( def write_structure_block( - parameters_structure: dict, + parameters_structure: dict[str, Any], structure: orm.StructureData, structure_filename: str, -) -> Union[str, list]: +) -> tuple[str, list[str]]: """ Generate the input block with the structure options. @@ -285,19 +286,19 @@ def write_structure_block( :param parameters_structure: set of user defined parameters relating to the structure. - :type parameters_structure: dict + :type parameters_structure: Dict[str, Any] :param structure: structure that will be studied :type structure: orm.StructureData :param structure_filename: name of the file where the structure will be written so that LAMMPS can read it :type structure_filename: str :return: block with the structural information and list of groups present - :rtype: Union[str, list] + :rtype: Tuple[str, List[str]] """ - group_names = [] + group_names: list[str] = [] - kind_name_id_map = {} + kind_name_id_map: dict[str, int] = {} for site in structure.sites: if site.kind_name not in kind_name_id_map: kind_name_id_map[site.kind_name] = len(kind_name_id_map) + 1 @@ -305,12 +306,21 @@ def write_structure_block( structure_block = generate_header("Start of the Structure information") structure_block += f'box tilt {parameters_structure.get("box_tilt", "small")}\n' - structure_block += f'dimension {structure.get_dimensionality()["dim"]}\n' - structure_block += "boundary " - for _bound in ["pbc1", "pbc2", "pbc3"]: - structure_block += f'{"p" if structure.base.attributes.all[_bound] else "f"} ' - structure_block += "\n" + # Set the dimensions of the structure + if "dimension" in parameters_structure: + structure_block += f"dimension {parameters_structure['dimension']}\n" + else: + structure_block += f"dimension {structure.get_dimensionality()['dim']}\n" + + # Set the boundary conditions of the structure + if "boundary" in parameters_structure: + structure_block += f"boundary {' '.join(parameters_structure['boundary'])} \n" + else: + structure_block += f"boundary {' '.join(['p' if entry else 'f' for entry in structure.pbc])} \n" + + # Set the atom style for the structure structure_block += f'atom_style {parameters_structure["atom_style"]}\n' + # Write the command to read the structure from a file structure_block += f"read_data {structure_filename}\n" # Set the groups which will be used for the calculations if "groups" in parameters_structure: @@ -331,7 +341,7 @@ def write_structure_block( return structure_block, group_names -def write_minimize_block(parameters_minimize: dict) -> str: +def write_minimize_block(parameters_minimize: dict[str, Union[str, float, int]]) -> str: """ Generate the input block with the minimization options. @@ -357,7 +367,7 @@ def write_minimize_block(parameters_minimize: dict) -> str: return minimize_block -def write_md_block(parameters_md: dict) -> str: +def write_md_block(parameters_md: dict[str, Any]) -> str: """ Generate the input block with the MD options. @@ -406,7 +416,7 @@ def write_md_block(parameters_md: dict) -> str: def write_final_variables_block( - fixed_thermo: list, + fixed_thermo: list[str], final_file: str = "aiida_lammps.yaml", ) -> str: """ @@ -445,7 +455,7 @@ def write_final_variables_block( return variables_block -def generate_velocity_string(parameters_velocity: dict) -> str: +def generate_velocity_string(parameters_velocity: list[dict[str, Any]]) -> str: """ Generate the velocity string for the MD block. @@ -464,7 +474,7 @@ def generate_velocity_string(parameters_velocity: dict) -> str: options += f'velocity {entry.get("group", "all")} create' options += f' {entry["create"].get("temp")}' options += ( - f' {entry["create"].get("seed", np.random.randint(1e4))} {_options}\n' + f' {entry["create"].get("seed", np.random.randint(10000))} {_options}\n' ) if "set" in entry: options += f'velocity {entry.get("group", "all")} set' @@ -487,7 +497,7 @@ def generate_velocity_string(parameters_velocity: dict) -> str: return options -def generate_velocity_options(options_velocity: dict) -> str: +def generate_velocity_options(options_velocity: dict[str, Any]) -> str: """ Generate the options string for every velocity. @@ -510,7 +520,7 @@ def generate_velocity_options(options_velocity: dict) -> str: def generate_integration_options( style: str, - integration_parameters: dict, + integration_parameters: dict[str, Any], ) -> str: """ Create a string with the integration options. @@ -601,22 +611,25 @@ def generate_integration_options( for _option in temperature_options: if _option in integration_parameters: _value = integration_parameters.get(_option) - _value = [str(val) for val in _value] - options += f' {_option} {" ".join(_value) if isinstance(_value, list) else _value} ' + if _value: + _value = [str(val) for val in _value] + options += f' {_option} {" ".join(_value) if isinstance(_value, list) else _value} ' # Set the options that depend on the pressure if style in pressure_dependent: for _option in pressure_options: if _option in integration_parameters: _value = integration_parameters.get(_option) - _value = [str(val) for val in _value] - options += f' {_option} {" ".join(_value) if isinstance(_value, list) else _value} ' + if _value: + _value = [str(val) for val in _value] + options += f' {_option} {" ".join(_value) if isinstance(_value, list) else _value} ' # Set the options that depend on the 'uef' parameters if style in uef_dependent: for _option in uef_options: if _option in integration_parameters: _value = integration_parameters.get(_option) - _value = [str(val) for val in _value] - options += f' {_option} {" ".join(_value) if isinstance(_value, list) else _value} ' + if _value: + _value = [str(val) for val in _value] + options += f' {_option} {" ".join(_value) if isinstance(_value, list) else _value} ' # Set the options that depend on the 'nve/limit' parameters if style in ["nve/limit"]: options += f' {integration_parameters.get("xmax", 0.1)} ' @@ -629,8 +642,8 @@ def generate_integration_options( def write_fix_block( - parameters_fix: dict, - group_names: Optional[list] = None, + parameters_fix: dict[str, Any], + group_names: Optional[list[str]] = None, ) -> str: """ Generate the input block with the fix options. @@ -673,8 +686,8 @@ def write_fix_block( def write_compute_block( - parameters_compute: dict, - group_names: Optional[list] = None, + parameters_compute: dict[str, Any], + group_names: Optional[list[str]] = None, ) -> str: """ Generate the input block with the compute options. @@ -709,11 +722,11 @@ def write_compute_block( def write_dump_block( - parameters_dump: dict, + parameters_dump: dict[str, Any], trajectory_filename: str, atom_style: str, - parameters_compute: Optional[dict] = None, - kind_symbols: Optional[list] = None, + kind_symbols: list[str], + parameters_compute: Optional[dict[str, Any]] = None, ) -> str: """Generate the block with dumps commands. @@ -742,19 +755,20 @@ def write_dump_block( computes_list = [] - for key, value in parameters_compute.items(): - for entry in value: - _locality = _compute_variables[key]["locality"] - _printable = _compute_variables[key]["printable"] - - if _locality == "local" and _printable: - computes_list.append( - generate_printing_string( - name=key, - group=entry["group"], - calculation_type="compute", + if parameters_compute: + for key, value in parameters_compute.items(): + for entry in value: + _locality = _compute_variables[key]["locality"] + _printable = _compute_variables[key]["printable"] + + if _locality == "local" and _printable: + computes_list.append( + generate_printing_string( + name=key, + group=entry["group"], + calculation_type="compute", + ) ) - ) num_double = len(list(flatten([compute.split() for compute in computes_list]))) num_double += 3 @@ -767,17 +781,17 @@ def write_dump_block( dump_block += f'{" ".join(computes_list)}\n' dump_block += "dump_modify aiida sort id\n" dump_block += f'dump_modify aiida element {" ".join(kind_symbols)}\n' - dump_block += "dump_modify aiida format line " - dump_block += f'"%6d %4d %4s {" ".join(["%16.10f"]*num_double)}"\n' + dump_block += "dump_modify aiida format int ' %d ' \n" + dump_block += "dump_modify aiida format float ' %16.10e ' \n" dump_block += generate_header("End of the Dump information") return dump_block def write_thermo_block( - parameters_thermo: dict, - parameters_compute: Optional[dict] = None, -) -> Union[str, list]: + parameters_thermo: dict[str, Any], + parameters_compute: Optional[dict[str, Any]] = None, +) -> tuple[str, list[str]]: """Generate the block with the thermo command. This will take all the global computes which were generated during the calculation @@ -804,19 +818,20 @@ def write_thermo_block( computes_list = [] - for key, value in parameters_compute.items(): - for entry in value: - _locality = _compute_variables[key]["locality"] - _printable = _compute_variables[key]["printable"] - - if _locality == "global" and _printable: - computes_list.append( - generate_printing_string( - name=key, - group=entry["group"], - calculation_type="compute", + if parameters_compute: + for key, value in parameters_compute.items(): + for entry in value: + _locality = _compute_variables[key]["locality"] + _printable = _compute_variables[key]["printable"] + + if _locality == "global" and _printable: + computes_list.append( + generate_printing_string( + name=key, + group=entry["group"], + calculation_type="compute", + ) ) - ) computes_printing = parameters_thermo.get("thermo_printing", None) @@ -848,8 +863,8 @@ def write_thermo_block( def write_restart_block( - parameters_restart: dict, restart_filename: str, max_number_steps: int -) -> dict: + parameters_restart: dict[str, Any], restart_filename: str, max_number_steps: int +) -> dict[str, Any]: """Generate the block to write the restart file. :param parameters_restart: set of parameters controlling the printing of the restartfile @@ -966,7 +981,7 @@ def generate_printing_string( return " ".join(_string) -def generate_id_tag(name: Optional[str] = None, group: Optional[str] = None) -> str: +def generate_id_tag(name: str, group: str) -> str: """Generate an id tag for fixes and/or computes. To standardize the naming of computes and/or fixes and to ensure that one @@ -986,7 +1001,7 @@ def generate_id_tag(name: Optional[str] = None, group: Optional[str] = None) -> return f"{name.replace('/','_')}_{group}_aiida" -def join_keywords(value: list) -> str: +def join_keywords(value: list[Any]) -> str: """ Generate a string for the compute/fix options. @@ -1005,9 +1020,11 @@ def join_keywords(value: list) -> str: return " ".join( [ - f"{entry['keyword']} {entry['value']}" - if isinstance(entry, dict) - else f"{entry}" + ( + f"{entry['keyword']} {entry['value']}" + if isinstance(entry, dict) + else f"{entry}" + ) for entry in value ] ) diff --git a/aiida_lammps/parsers/parse_raw/__init__.py b/src/aiida_lammps/parsers/parse_raw/__init__.py similarity index 100% rename from aiida_lammps/parsers/parse_raw/__init__.py rename to src/aiida_lammps/parsers/parse_raw/__init__.py diff --git a/aiida_lammps/parsers/parse_raw/final_data.py b/src/aiida_lammps/parsers/parse_raw/final_data.py similarity index 100% rename from aiida_lammps/parsers/parse_raw/final_data.py rename to src/aiida_lammps/parsers/parse_raw/final_data.py diff --git a/aiida_lammps/parsers/parse_raw/lammps_output.py b/src/aiida_lammps/parsers/parse_raw/lammps_output.py similarity index 100% rename from aiida_lammps/parsers/parse_raw/lammps_output.py rename to src/aiida_lammps/parsers/parse_raw/lammps_output.py diff --git a/aiida_lammps/parsers/parse_raw/trajectory.py b/src/aiida_lammps/parsers/parse_raw/trajectory.py similarity index 100% rename from aiida_lammps/parsers/parse_raw/trajectory.py rename to src/aiida_lammps/parsers/parse_raw/trajectory.py diff --git a/aiida_lammps/parsers/raw.py b/src/aiida_lammps/parsers/raw.py similarity index 100% rename from aiida_lammps/parsers/raw.py rename to src/aiida_lammps/parsers/raw.py diff --git a/aiida_lammps/parsers/utils.py b/src/aiida_lammps/parsers/utils.py similarity index 96% rename from aiida_lammps/parsers/utils.py rename to src/aiida_lammps/parsers/utils.py index d3c64977..b9ca0d9b 100644 --- a/aiida_lammps/parsers/utils.py +++ b/src/aiida_lammps/parsers/utils.py @@ -1,7 +1,9 @@ """Utility functions for the handling of the input files""" + from collections.abc import Iterable from typing import Optional, Union +from aiida import orm import numpy as np @@ -34,9 +36,9 @@ def _transform_cell(cell) -> Union[np.array, np.array]: def generate_lammps_structure( - structure, + structure: orm.StructureData, atom_style: str = "atomic", - charge_dict: Optional[dict] = None, + charge_dict: Optional[dict[str, float]] = None, round_dp: Optional[float] = None, docstring: str = "generated by aiida_lammps", ) -> Union[str, np.array]: @@ -154,7 +156,7 @@ def flatten(full_list: list) -> list: yield element -def convert_to_str(value): +def convert_to_str(value) -> str: """convert True/False to yes/no and all values to strings""" if isinstance(value, bool): if value: @@ -163,13 +165,13 @@ def convert_to_str(value): return str(value) -def _convert_values(value): +def _convert_values(value) -> str: if isinstance(value, (tuple, list)): return " ".join([convert_to_str(v) for v in value]) return convert_to_str(value) -def join_keywords(dct, ignore=None): +def join_keywords(dct, ignore=None) -> str: """join a dict of {keyword: value, ...} into a string 'keyword value ...' value can be a single value or a list/tuple of values diff --git a/aiida_lammps/parsers/variables_types.json b/src/aiida_lammps/parsers/variables_types.json similarity index 97% rename from aiida_lammps/parsers/variables_types.json rename to src/aiida_lammps/parsers/variables_types.json index 05bd6888..3f96b0dc 100644 --- a/aiida_lammps/parsers/variables_types.json +++ b/src/aiida_lammps/parsers/variables_types.json @@ -79,9 +79,9 @@ "pressure": {"type": "mixed", "size": 6, "locality": "global", "printable": true}, "pressure/cylinder": {"type": "array", "size": 0, "locality": "global", "printable": true}, "pressure/uef": {"type": "scalar", "size": 0, "locality": "global", "printable": true}, - "property/atom": {"type": "array", "size": 0, "locality": "local", "printable": true}, - "property/chunk": {"type": "array", "size": 0, "locality": "global", "printable": false}, - "property/local": {"type": "array", "size": 0, "locality": "global", "printable": true}, + "property/atom": {"type": "vector", "size": 0, "locality": "local", "printable": true}, + "property/chunk": {"type": "vector", "size": 0, "locality": "global", "printable": false}, + "property/local": {"type": "vector", "size": 0, "locality": "global", "printable": true}, "ptm/atom": {"type": "scalar", "size": 0, "locality": "local", "printable": true}, "rdf": {"type": "array", "size": 0, "locality": "global", "printable": false}, "reduce": {"type": "mixed", "size": 0, "locality": "global", "printable": true}, diff --git a/aiida_lammps/utils.py b/src/aiida_lammps/utils.py similarity index 100% rename from aiida_lammps/utils.py rename to src/aiida_lammps/utils.py diff --git a/aiida_lammps/validation/__init__.py b/src/aiida_lammps/validation/__init__.py similarity index 100% rename from aiida_lammps/validation/__init__.py rename to src/aiida_lammps/validation/__init__.py diff --git a/aiida_lammps/validation/schemas/__init__.py b/src/aiida_lammps/validation/schemas/__init__.py similarity index 100% rename from aiida_lammps/validation/schemas/__init__.py rename to src/aiida_lammps/validation/schemas/__init__.py diff --git a/aiida_lammps/validation/schemas/lammps_schema.json b/src/aiida_lammps/validation/schemas/lammps_schema.json similarity index 96% rename from aiida_lammps/validation/schemas/lammps_schema.json rename to src/aiida_lammps/validation/schemas/lammps_schema.json index 49c20f80..fc584011 100644 --- a/aiida_lammps/validation/schemas/lammps_schema.json +++ b/src/aiida_lammps/validation/schemas/lammps_schema.json @@ -122,6 +122,53 @@ "large" ] } + }, + "dimension":{ + "type": "integer", + "propertyNames":{ + "enum": [2,3] + } + }, + "boundary":{ + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": [ + { + "description": "boundary conditions along the a-direction", + "type": "string", + "enum": [ + "p", + "f", + "s", + "m", + "pp", + "pf", + "ps", + "pm", + "fp", + "ff", + "fs", + "fm", + "sp", + "sf", + "ss", + "sm", + "mp", + "mf", + "ms", + "mm" + ] + }, + { + "description": "boundary conditions along the b-direction", + "type": "string" + }, + { + "description": "boundary conditions along the c-direction", + "type": "string" + } + ] } } }, diff --git a/aiida_lammps/validation/utils.py b/src/aiida_lammps/validation/utils.py similarity index 100% rename from aiida_lammps/validation/utils.py rename to src/aiida_lammps/validation/utils.py diff --git a/aiida_lammps/workflows/__init__.py b/src/aiida_lammps/workflows/__init__.py similarity index 100% rename from aiida_lammps/workflows/__init__.py rename to src/aiida_lammps/workflows/__init__.py diff --git a/aiida_lammps/workflows/base.py b/src/aiida_lammps/workflows/base.py similarity index 100% rename from aiida_lammps/workflows/base.py rename to src/aiida_lammps/workflows/base.py diff --git a/aiida_lammps/workflows/md.py b/src/aiida_lammps/workflows/md.py similarity index 100% rename from aiida_lammps/workflows/md.py rename to src/aiida_lammps/workflows/md.py diff --git a/aiida_lammps/workflows/relax.py b/src/aiida_lammps/workflows/relax.py similarity index 100% rename from aiida_lammps/workflows/relax.py rename to src/aiida_lammps/workflows/relax.py diff --git a/tests/calculations/test_raw.py b/tests/calculations/test_raw.py index 2458c64a..6db26353 100644 --- a/tests/calculations/test_raw.py +++ b/tests/calculations/test_raw.py @@ -3,9 +3,8 @@ import textwrap from aiida import orm -import pytest - from aiida_lammps.calculations.raw import LammpsRawCalculation +import pytest def test_script(generate_calc_job, aiida_local_code_factory): diff --git a/tests/test_calculations/test_lammps_base_parameters_md_npt_.yml b/tests/test_calculations/test_lammps_base_parameters_md_npt_.yml index f5059b90..dca86fed 100644 --- a/tests/test_calculations/test_lammps_base_parameters_md_npt_.yml +++ b/tests/test_calculations/test_lammps_base_parameters_md_npt_.yml @@ -37,6 +37,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -57,29 +59,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0193890217' - - '0.0193890217' + - '1.9389021750e-02' + - '1.9389021750e-02' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4702462298e-15' + - '2.2204460493e-15' + c_property_atom_all_aiida__2__: + - '-2.5257573810e-15' + - '2.4702462298e-15' c_stress_atom_all_aiida__1__: - - '-176432.6941248970' - - '-176432.6941248970' + - '-1.7643269412e+05' + - '-1.7643269412e+05' c_stress_atom_all_aiida__2__: - - '-171780.7093367400' - - '-171780.7093367400' + - '-1.7178070934e+05' + - '-1.7178070934e+05' c_stress_atom_all_aiida__3__: - - '-183748.4690960771' - - '-183748.4690960772' + - '-1.8374846910e+05' + - '-1.8374846910e+05' c_stress_atom_all_aiida__4__: - - '-17340.5298153769' - - '-17340.5298153769' + - '-1.7340529815e+04' + - '-1.7340529815e+04' c_stress_atom_all_aiida__5__: - - '23193.0341510636' - - '23193.0341510635' + - '2.3193034151e+04' + - '2.3193034151e+04' c_stress_atom_all_aiida__6__: - - '20289.7295051404' - - '20289.7295051403' + - '2.0289729505e+04' + - '2.0289729505e+04' element: - Fe - Fe @@ -90,39 +98,45 @@ trajectories_steps: - '1' - '2' x: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' y: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' z: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0146989239' - - '0.0146989239' + - '1.4698923851e-02' + - '1.4698923851e-02' c_pe_atom_all_aiida: - - '-4.1173741089' - - '-4.1173741089' + - '-4.1173741089e+00' + - '-4.1173741089e+00' + c_property_atom_all_aiida__1__: + - '2.1240294832e-01' + - '-2.1240294832e-01' + c_property_atom_all_aiida__2__: + - '1.8558317861e-01' + - '-1.8558317861e-01' c_stress_atom_all_aiida__1__: - - '-163012.4689086530' - - '-163012.4689086528' + - '-1.6301246891e+05' + - '-1.6301246891e+05' c_stress_atom_all_aiida__2__: - - '-162034.8046205898' - - '-162034.8046205863' + - '-1.6203480462e+05' + - '-1.6203480462e+05' c_stress_atom_all_aiida__3__: - - '-164532.6472018179' - - '-164532.6472018145' + - '-1.6453264720e+05' + - '-1.6453264720e+05' c_stress_atom_all_aiida__4__: - - '-10954.1858877006' - - '-10954.1858877007' + - '-1.0954185888e+04' + - '-1.0954185888e+04' c_stress_atom_all_aiida__5__: - - '13888.3137895588' - - '13888.3137895589' + - '1.3888313790e+04' + - '1.3888313790e+04' c_stress_atom_all_aiida__6__: - - '12436.1415196177' - - '12436.1415196178' + - '1.2436141520e+04' + - '1.2436141520e+04' element: - Fe - Fe @@ -133,39 +147,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0139834953' - - '1.4380414952' + - '-1.3983495345e-02' + - '1.4380414952e+00' y: - - '-0.0122330718' - - '1.4362910717' + - '-1.2233071824e-02' + - '1.4362910717e+00' z: - - '0.0163617121' - - '1.4076962878' + - '1.6361712068e-02' + - '1.4076962878e+00' 2: c_ke_atom_all_aiida: - - '0.0054019037' - - '0.0054019037' + - '5.4019037480e-03' + - '5.4019037480e-03' c_pe_atom_all_aiida: - - '-4.1080770882' - - '-4.1080770882' + - '-4.1080770882e+00' + - '-4.1080770882e+00' + c_property_atom_all_aiida__1__: + - '3.5332608521e-01' + - '-3.5332608521e-01' + c_property_atom_all_aiida__2__: + - '3.0710754911e-01' + - '-3.0710754911e-01' c_stress_atom_all_aiida__1__: - - '-155762.0910992224' - - '-155762.0910992223' + - '-1.5576209110e+05' + - '-1.5576209110e+05' c_stress_atom_all_aiida__2__: - - '-162236.2672378211' - - '-162236.2672378211' + - '-1.6223626724e+05' + - '-1.6223626724e+05' c_stress_atom_all_aiida__3__: - - '-145505.0112761190' - - '-145505.0112761190' + - '-1.4550501128e+05' + - '-1.4550501128e+05' c_stress_atom_all_aiida__4__: - - '-18536.5000749405' - - '-18536.5000749404' + - '-1.8536500075e+04' + - '-1.8536500075e+04' c_stress_atom_all_aiida__5__: - - '15909.8450395797' - - '15909.8450395796' + - '1.5909845040e+04' + - '1.5909845040e+04' c_stress_atom_all_aiida__6__: - - '17056.1686183048' - - '17056.1686183048' + - '1.7056168618e+04' + - '1.7056168618e+04' element: - Fe - Fe @@ -176,39 +196,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0244120864' - - '1.4484700858' + - '-2.4412086370e-02' + - '1.4484700858e+00' y: - - '-0.0213640946' - - '1.4454220940' + - '-2.1364094641e-02' + - '1.4454220940e+00' z: - - '0.0285533927' - - '1.3955046067' + - '2.8553392733e-02' + - '1.3955046067e+00' 3: c_ke_atom_all_aiida: - - '0.0000892262' - - '0.0000892262' + - '8.9226220394e-05' + - '8.9226220394e-05' c_pe_atom_all_aiida: - - '-4.1027644104' - - '-4.1027644104' + - '-4.1027644104e+00' + - '-4.1027644104e+00' + c_property_atom_all_aiida__1__: + - '4.0909429787e-01' + - '-4.0909429787e-01' + c_property_atom_all_aiida__2__: + - '3.5666456950e-01' + - '-3.5666456950e-01' c_stress_atom_all_aiida__1__: - - '-159630.6290393222' - - '-159630.6290393251' + - '-1.5963062904e+05' + - '-1.5963062904e+05' c_stress_atom_all_aiida__2__: - - '-170176.2164816650' - - '-170176.2164816680' + - '-1.7017621648e+05' + - '-1.7017621648e+05' c_stress_atom_all_aiida__3__: - - '-142824.2750162462' - - '-142824.2750162430' + - '-1.4282427502e+05' + - '-1.4282427502e+05' c_stress_atom_all_aiida__4__: - - '-29235.3968232888' - - '-29235.3968232889' + - '-2.9235396823e+04' + - '-2.9235396823e+04' c_stress_atom_all_aiida__5__: - - '25404.2062641248' - - '25404.2062641247' + - '2.5404206264e+04' + - '2.5404206264e+04' c_stress_atom_all_aiida__6__: - - '26293.8975930101' - - '26293.8975930100' + - '2.6293897593e+04' + - '2.6293897593e+04' element: - Fe - Fe @@ -219,39 +245,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0288589662' - - '1.4529169648' + - '-2.8858966153e-02' + - '1.4529169648e+00' y: - - '-0.0252909452' - - '1.4493489439' + - '-2.5290945208e-02' + - '1.4493489439e+00' z: - - '0.0336964834' - - '1.3903615153' + - '3.3696483384e-02' + - '1.3903615153e+00' 4: c_ke_atom_all_aiida: - - '0.0032105226' - - '0.0032105226' + - '3.2105226094e-03' + - '3.2105226094e-03' c_pe_atom_all_aiida: - - '-4.1058857072' - - '-4.1058857072' + - '-4.1058857072e+00' + - '-4.1058857072e+00' + c_property_atom_all_aiida__1__: + - '3.7817349331e-01' + - '-3.7817349331e-01' + c_property_atom_all_aiida__2__: + - '3.3023600679e-01' + - '-3.3023600679e-01' c_stress_atom_all_aiida__1__: - - '-156654.1369546566' - - '-156654.1369546547' + - '-1.5665413695e+05' + - '-1.5665413695e+05' c_stress_atom_all_aiida__2__: - - '-164572.0957843236' - - '-164572.0957843236' + - '-1.6457209578e+05' + - '-1.6457209578e+05' c_stress_atom_all_aiida__3__: - - '-144384.9306911923' - - '-144384.9306911923' + - '-1.4438493069e+05' + - '-1.4438493069e+05' c_stress_atom_all_aiida__4__: - - '-22511.3620179983' - - '-22511.3620179982' + - '-2.2511362018e+04' + - '-2.2511362018e+04' c_stress_atom_all_aiida__5__: - - '19404.5879233499' - - '19404.5879233502' + - '1.9404587923e+04' + - '1.9404587923e+04' c_stress_atom_all_aiida__6__: - - '20491.8769465691' - - '20491.8769465690' + - '2.0491876947e+04' + - '2.0491876947e+04' element: - Fe - Fe @@ -262,39 +294,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0263627583' - - '1.4504207559' + - '-2.6362758279e-02' + - '1.4504207559e+00' y: - - '-0.0231654618' - - '1.4472234595' + - '-2.3165461800e-02' + - '1.4472234595e+00' z: - - '0.0306549869' - - '1.3934030108' + - '3.0654986882e-02' + - '1.3934030108e+00' 5: c_ke_atom_all_aiida: - - '0.0121776543' - - '0.0121776543' + - '1.2177654322e-02' + - '1.2177654322e-02' c_pe_atom_all_aiida: - - '-4.1148528392' - - '-4.1148528392' + - '-4.1148528392e+00' + - '-4.1148528392e+00' + c_property_atom_all_aiida__1__: + - '2.6136772158e-01' + - '-2.6136772158e-01' + c_property_atom_all_aiida__2__: + - '2.3049848624e-01' + - '-2.3049848624e-01' c_stress_atom_all_aiida__1__: - - '-158983.7746656051' - - '-158983.7746656021' + - '-1.5898377467e+05' + - '-1.5898377467e+05' c_stress_atom_all_aiida__2__: - - '-159667.9396941405' - - '-159667.9396941400' + - '-1.5966793969e+05' + - '-1.5966793969e+05' c_stress_atom_all_aiida__3__: - - '-158295.4121547013' - - '-158295.4121547007' + - '-1.5829541215e+05' + - '-1.5829541215e+05' c_stress_atom_all_aiida__4__: - - '-10855.4252327056' - - '-10855.4252327055' + - '-1.0855425233e+04' + - '-1.0855425233e+04' c_stress_atom_all_aiida__5__: - - '12569.1159032878' - - '12569.1159032880' + - '1.2569115903e+04' + - '1.2569115903e+04' c_stress_atom_all_aiida__6__: - - '11734.9708443221' - - '11734.9708443222' + - '1.1734970844e+04' + - '1.1734970844e+04' element: - Fe - Fe @@ -305,11 +343,11 @@ trajectories_steps: - '1' - '2' x: - - '-0.0174570710' - - '1.4415150674' + - '-1.7457071031e-02' + - '1.4415150674e+00' y: - - '-0.0154402036' - - '1.4394982000' + - '-1.5440203611e-02' + - '1.4394982000e+00' z: - - '0.0200997384' - - '1.4039582580' + - '2.0099738352e-02' + - '1.4039582580e+00' diff --git a/tests/test_calculations/test_lammps_base_parameters_md_nve_.yml b/tests/test_calculations/test_lammps_base_parameters_md_nve_.yml index 3dfaaaa3..7c80c7a2 100644 --- a/tests/test_calculations/test_lammps_base_parameters_md_nve_.yml +++ b/tests/test_calculations/test_lammps_base_parameters_md_nve_.yml @@ -37,6 +37,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -57,29 +59,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4702462298e-15' + - '2.2204460493e-15' + c_property_atom_all_aiida__2__: + - '-2.5257573810e-15' + - '2.4702462298e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000009' + - '9.7832528190e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '8.9946170271e-10' element: - Fe - Fe @@ -90,39 +98,45 @@ trajectories_steps: - '1' - '2' x: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' y: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' z: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '1.3524621261e-31' + - '1.4448173042e-31' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4147350786e-15' + - '2.1094237468e-15' + c_property_atom_all_aiida__2__: + - '-2.4147350786e-15' + - '2.4424906542e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153456' - - '-156610.8675153455' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000010' + - '9.7832528190e-10' + - '9.5609061640e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '9.2134895156e-10' element: - Fe - Fe @@ -133,39 +147,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-2.0860586159e-17' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-2.0861065702e-17' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-1.7263536510e-17' + - '1.4240580000e+00' 2: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '5.4097790254e-31' + - '5.7792652223e-31' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4147350786e-15' + - '2.1094237468e-15' + c_property_atom_all_aiida__2__: + - '-2.4147350786e-15' + - '2.4424906542e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153456' - - '-156610.8675153455' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000010' + - '9.7832528190e-10' + - '9.5609061640e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '9.2134895156e-10' element: - Fe - Fe @@ -176,39 +196,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-8.3441385550e-17' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-8.3442344636e-17' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-6.9054146040e-17' + - '1.4240580000e+00' 3: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '1.1279664027e-30' + - '1.2444454763e-30' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-7.4940054162e-16' + - '6.1062266354e-16' + c_property_atom_all_aiida__2__: + - '-7.4940054162e-16' + - '6.9388939039e-16' c_stress_atom_all_aiida__1__: - - '-156610.8675153458' - - '-156610.8675153457' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153457' - - '-156610.8675153455' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153459' - - '-156610.8675153459' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000010' - - '0.0000000011' + - '1.0450292784e-09' + - '1.0894986094e-09' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000010' + - '9.7832528190e-10' + - '9.5609061640e-10' c_stress_atom_all_aiida__6__: - - '0.0000000009' - - '0.0000000009' + - '8.6784678771e-10' + - '8.7826928716e-10' element: - Fe - Fe @@ -219,39 +245,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-1.8082343169e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-1.8082487032e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-1.6435179087e-16' + - '1.4240580000e+00' 4: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '1.4123397362e-30' + - '1.6085046880e-30' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-8.3266726847e-17' + - '-5.5511151231e-17' + c_property_atom_all_aiida__2__: + - '-5.5511151231e-17' + - '0.0000000000e+00' c_stress_atom_all_aiida__1__: - - '-156610.8675153517' - - '-156610.8675153517' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153518' - - '-156610.8675153517' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153514' - - '-156610.8675153512' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '-0.0000000000' - - '-0.0000000000' + - '-2.2234665498e-11' + - '-2.2234665498e-11' c_stress_atom_all_aiida__5__: - - '-0.0000000000' - - '-0.0000000000' + - '-1.6020643331e-24' + - '-2.2234665498e-11' c_stress_atom_all_aiida__6__: - - '0.0000000001' - - '-0.0000000001' + - '8.8938661991e-11' + - '-5.5586663744e-11' element: - Fe - Fe @@ -262,39 +294,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-2.9014157618e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-2.9006199751e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-3.1635203735e-16' + - '1.4240580000e+00' 5: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '7.5771470446e-31' + - '9.5582263448e-31' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '2.4424906542e-15' + - '-2.6090241079e-15' + c_property_atom_all_aiida__2__: + - '2.3592239273e-15' + - '-2.3314683517e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153462' - - '-156610.8675153460' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153462' - - '-156610.8675153460' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153462' - - '-156610.8675153462' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000010' - - '0.0000000010' + - '1.0450292784e-09' + - '9.5609061640e-10' c_stress_atom_all_aiida__5__: - - '0.0000000011' - - '0.0000000011' + - '1.0672639439e-09' + - '1.0894986094e-09' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '1.0214049463e-09' + - '9.4948970008e-10' element: - Fe - Fe @@ -305,11 +343,11 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-3.9317134705e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-3.9313161454e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-4.4920064968e-16' + - '1.4240580000e+00' diff --git a/tests/test_calculations/test_lammps_base_parameters_md_nvt_.yml b/tests/test_calculations/test_lammps_base_parameters_md_nvt_.yml index 3dfaaaa3..d02fe4ff 100644 --- a/tests/test_calculations/test_lammps_base_parameters_md_nvt_.yml +++ b/tests/test_calculations/test_lammps_base_parameters_md_nvt_.yml @@ -37,6 +37,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -57,29 +59,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4702462298e-15' + - '2.2204460493e-15' + c_property_atom_all_aiida__2__: + - '-2.5257573810e-15' + - '2.4702462298e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000009' + - '9.7832528190e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '8.9946170271e-10' element: - Fe - Fe @@ -90,39 +98,45 @@ trajectories_steps: - '1' - '2' x: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' y: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' z: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '1.3524621351e-31' + - '1.4448173139e-31' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4147350786e-15' + - '2.1094237468e-15' + c_property_atom_all_aiida__2__: + - '-2.4147350786e-15' + - '2.4424906542e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153456' - - '-156610.8675153455' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000010' + - '9.7832528190e-10' + - '9.5609061640e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '9.2134895156e-10' element: - Fe - Fe @@ -133,39 +147,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-2.0860586194e-17' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-2.0861065736e-17' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-1.7263536539e-17' + - '1.4240580000e+00' 2: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '5.4097791696e-31' + - '5.7792653764e-31' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4147350786e-15' + - '2.1094237468e-15' + c_property_atom_all_aiida__2__: + - '-2.4147350786e-15' + - '2.4424906542e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153456' - - '-156610.8675153455' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000010' + - '9.7832528190e-10' + - '9.5609061640e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '9.2134895156e-10' element: - Fe - Fe @@ -176,39 +196,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-8.3441386107e-17' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-8.3442345192e-17' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-6.9054146500e-17' + - '1.4240580000e+00' 3: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '1.1279664713e-30' + - '1.2444455513e-30' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-7.4940054162e-16' + - '6.1062266354e-16' + c_property_atom_all_aiida__2__: + - '-7.4940054162e-16' + - '6.9388939039e-16' c_stress_atom_all_aiida__1__: - - '-156610.8675153458' - - '-156610.8675153457' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153457' - - '-156610.8675153455' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153459' - - '-156610.8675153459' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000010' - - '0.0000000011' + - '1.0450292784e-09' + - '1.0894986094e-09' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000010' + - '9.7832528190e-10' + - '9.5609061640e-10' c_stress_atom_all_aiida__6__: - - '0.0000000009' - - '0.0000000009' + - '8.6784678771e-10' + - '8.7826928716e-10' element: - Fe - Fe @@ -219,39 +245,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-1.8082343447e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-1.8082487310e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-1.6435179325e-16' + - '1.4240580000e+00' 4: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '1.4123399093e-30' + - '1.6085048821e-30' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-8.3266726847e-17' + - '-5.5511151231e-17' + c_property_atom_all_aiida__2__: + - '-5.5511151231e-17' + - '0.0000000000e+00' c_stress_atom_all_aiida__1__: - - '-156610.8675153517' - - '-156610.8675153517' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153518' - - '-156610.8675153517' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153514' - - '-156610.8675153512' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '-0.0000000000' - - '-0.0000000000' + - '-2.2234665498e-11' + - '-2.2234665498e-11' c_stress_atom_all_aiida__5__: - - '-0.0000000000' - - '-0.0000000000' + - '-1.6020645294e-24' + - '-2.2234665498e-11' c_stress_atom_all_aiida__6__: - - '0.0000000001' - - '-0.0000000001' + - '8.8938661991e-11' + - '-5.5586663744e-11' element: - Fe - Fe @@ -262,39 +294,45 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-2.9014158432e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-2.9006200565e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-3.1635204557e-16' + - '1.4240580000e+00' 5: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '7.5771491433e-31' + - '9.5582288454e-31' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '2.4424906542e-15' + - '-2.6090241079e-15' + c_property_atom_all_aiida__2__: + - '2.3592239273e-15' + - '-2.3314683517e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153462' - - '-156610.8675153460' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153462' - - '-156610.8675153460' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153462' - - '-156610.8675153462' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000010' - - '0.0000000010' + - '1.0450292784e-09' + - '9.5609061640e-10' c_stress_atom_all_aiida__5__: - - '0.0000000011' - - '0.0000000011' + - '1.0672639439e-09' + - '1.0894986094e-09' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '1.0214049463e-09' + - '9.4948970008e-10' element: - Fe - Fe @@ -305,11 +343,11 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-3.9317136492e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-3.9313163240e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-4.4920066965e-16' + - '1.4240580000e+00' diff --git a/tests/test_calculations/test_lammps_base_parameters_minimize_.yml b/tests/test_calculations/test_lammps_base_parameters_minimize_.yml index e8652941..6f743ca5 100644 --- a/tests/test_calculations/test_lammps_base_parameters_minimize_.yml +++ b/tests/test_calculations/test_lammps_base_parameters_minimize_.yml @@ -43,6 +43,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -63,29 +65,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4702462298e-15' + - '2.2204460493e-15' + c_property_atom_all_aiida__2__: + - '-2.5257573810e-15' + - '2.4702462298e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000009' + - '9.7832528190e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '8.9946170271e-10' element: - Fe - Fe @@ -96,39 +104,45 @@ trajectories_steps: - '1' - '2' x: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' y: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' z: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1224351021' - - '-4.1224351021' + - '-4.1224351021e+00' + - '-4.1224351021e+00' + c_property_atom_all_aiida__1__: + - '-2.1371793224e-15' + - '1.9984014443e-15' + c_property_atom_all_aiida__2__: + - '-2.1371793224e-15' + - '2.0886070651e-15' c_stress_atom_all_aiida__1__: - - '-0.5512166433' - - '-0.5512166399' + - '-5.5121664335e-01' + - '-5.5121663994e-01' c_stress_atom_all_aiida__2__: - - '-0.5512166430' - - '-0.5512166398' + - '-5.5121664297e-01' + - '-5.5121663981e-01' c_stress_atom_all_aiida__3__: - - '-0.5512166427' - - '-0.5512166393' + - '-5.5121664270e-01' + - '-5.5121663932e-01' c_stress_atom_all_aiida__4__: - - '-0.0000000010' - - '-0.0000000008' + - '-9.5609061640e-10' + - '-8.4491728891e-10' c_stress_atom_all_aiida__5__: - - '-0.0000000008' - - '-0.0000000008' + - '-8.0044795792e-10' + - '-7.5597862692e-10' c_stress_atom_all_aiida__6__: - - '-0.0000000007' - - '-0.0000000008' + - '-7.3374396142e-10' + - '-7.6501145978e-10' element: - Fe - Fe @@ -139,11 +153,11 @@ trajectories_steps: - '1' - '2' x: - - '-0.0036044178' - - '1.4240580000' + - '-3.6044177584e-03' + - '1.4240580000e+00' y: - - '-0.0036044178' - - '1.4240580000' + - '-3.6044177584e-03' + - '1.4240580000e+00' z: - - '-0.0036044178' - - '1.4240580000' + - '-3.6044177584e-03' + - '1.4240580000e+00' diff --git a/tests/test_calculations/test_lammps_base_parameters_minimize_groups_.yml b/tests/test_calculations/test_lammps_base_parameters_minimize_groups_.yml index 724a23ca..85c9545b 100644 --- a/tests/test_calculations/test_lammps_base_parameters_minimize_groups_.yml +++ b/tests/test_calculations/test_lammps_base_parameters_minimize_groups_.yml @@ -43,6 +43,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -63,29 +65,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4702462298e-15' + - '2.2204460493e-15' + c_property_atom_all_aiida__2__: + - '-2.5257573810e-15' + - '2.4702462298e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000009' + - '9.7832528190e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '8.9946170271e-10' element: - Fe - Fe @@ -96,39 +104,45 @@ trajectories_steps: - '1' - '2' x: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' y: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' z: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '2.5812685323e-15' + - '-2.5535129566e-15' + c_property_atom_all_aiida__2__: + - '2.4980018054e-15' + - '-2.5257573810e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153434' - - '-156610.8675153464' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153432' - - '-156610.8675153462' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153435' - - '-156610.8675153466' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '-0.0000000012' - - '-0.0000000012' + - '-1.2451412679e-09' + - '-1.2229066024e-09' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000008' + - '9.7832528190e-10' + - '8.2268262341e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5470094981e-10' + - '9.0224103590e-10' element: - Fe - Fe @@ -139,11 +153,11 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-1.5961825279e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-1.6320517982e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-1.2912937305e-16' + - '1.4240580000e+00' diff --git a/tests/test_generate_inputs.py b/tests/test_generate_inputs.py index 528219a7..da92be4c 100644 --- a/tests/test_generate_inputs.py +++ b/tests/test_generate_inputs.py @@ -1,38 +1,44 @@ """Functions to tests the input file generation""" -import os -import pytest +import os from aiida_lammps.data.potential import LammpsPotentialData from aiida_lammps.parsers import inputfile from aiida_lammps.validation.utils import validate_against_schema +import pytest def validate_input_parameters(parameters: dict): _file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", - "aiida_lammps/validation/schemas/lammps_schema.json", + "src/aiida_lammps/validation/schemas/lammps_schema.json", ) validate_against_schema(data=parameters, filename=_file) @pytest.mark.parametrize( - "potential_type", - ["eam_alloy"], + "potential_type,override_parameters", + [("eam_alloy", True), ("eam_alloy", False)], ) def test_input_generate_minimize( db_test_app, # pylint: disable=unused-argument parameters_minimize, get_lammps_potential_data, + structure_parameters, potential_type, + override_parameters, file_regression, ): """Test the generation of the input file for minimize calculations""" # pylint: disable=too-many-locals - - validate_input_parameters(parameters_minimize) + if override_parameters: + _parameters = parameters_minimize + _parameters["structure"].update(structure_parameters) + else: + _parameters = parameters_minimize + validate_input_parameters(_parameters) # Generate the potential potential_information = get_lammps_potential_data(potential_type) potential = LammpsPotentialData.get_or_create( @@ -40,11 +46,12 @@ def test_input_generate_minimize( filename=potential_information["filename"], **potential_information["parameters"], ) + # Generating the structure structure = potential_information["structure"] # Generating the input file input_file = inputfile.generate_input_file( - parameters=parameters_minimize, + parameters=_parameters, potential=potential, structure=structure, trajectory_filename="temp.dump", diff --git a/tests/test_generate_inputs/test_input_generate_md_eam_alloy_None_.txt b/tests/test_generate_inputs/test_input_generate_md_eam_alloy_None_.txt index 6fc858c3..81c8a338 100644 --- a/tests/test_generate_inputs/test_input_generate_md_eam_alloy_None_.txt +++ b/tests/test_generate_inputs/test_input_generate_md_eam_alloy_None_.txt @@ -20,16 +20,18 @@ compute pe_atom_all_aiida all pe/atom compute ke_atom_all_aiida all ke/atom compute stress_atom_all_aiida all stress/atom NULL compute pressure_all_aiida all pressure thermo_temp +compute property_atom_all_aiida all property/atom fx fy #-------------------------End of the Compute information-------------------------# #------------------------Start of the Thermo information-------------------------# thermo_style custom step pe ke press pxx pyy pzz etotal c_pressure_all_aiida c_pressure_all_aiida[1] c_pressure_all_aiida[2] c_pressure_all_aiida[3] c_pressure_all_aiida[4] c_pressure_all_aiida[5] c_pressure_all_aiida[6] thermo 1000 #-------------------------End of the Thermo information--------------------------# #-------------------------Start of the Dump information--------------------------# -dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] +dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] c_property_atom_all_aiida[*] dump_modify aiida sort id dump_modify aiida element Fe Fe -dump_modify aiida format line "%6d %4d %4s %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f" +dump_modify aiida format int ' %d ' +dump_modify aiida format float ' %16.10e ' #--------------------------End of the Dump information---------------------------# #--------------------------Start of the MD information---------------------------# fix npt_all_aiida all npt temp 400 400 100 iso 0.0 0.0 1000.0 diff --git a/tests/test_generate_inputs/test_input_generate_md_eam_alloy_input_aiida_lammps_restart_.txt b/tests/test_generate_inputs/test_input_generate_md_eam_alloy_input_aiida_lammps_restart_.txt index 6da0b9f9..494488a9 100644 --- a/tests/test_generate_inputs/test_input_generate_md_eam_alloy_input_aiida_lammps_restart_.txt +++ b/tests/test_generate_inputs/test_input_generate_md_eam_alloy_input_aiida_lammps_restart_.txt @@ -16,16 +16,18 @@ compute pe_atom_all_aiida all pe/atom compute ke_atom_all_aiida all ke/atom compute stress_atom_all_aiida all stress/atom NULL compute pressure_all_aiida all pressure thermo_temp +compute property_atom_all_aiida all property/atom fx fy #-------------------------End of the Compute information-------------------------# #------------------------Start of the Thermo information-------------------------# thermo_style custom step pe ke press pxx pyy pzz etotal c_pressure_all_aiida c_pressure_all_aiida[1] c_pressure_all_aiida[2] c_pressure_all_aiida[3] c_pressure_all_aiida[4] c_pressure_all_aiida[5] c_pressure_all_aiida[6] thermo 1000 #-------------------------End of the Thermo information--------------------------# #-------------------------Start of the Dump information--------------------------# -dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] +dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] c_property_atom_all_aiida[*] dump_modify aiida sort id dump_modify aiida element Fe Fe -dump_modify aiida format line "%6d %4d %4s %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f" +dump_modify aiida format int ' %d ' +dump_modify aiida format float ' %16.10e ' #--------------------------End of the Dump information---------------------------# #--------------------------Start of the MD information---------------------------# fix npt_all_aiida all npt temp 400 400 100 iso 0.0 0.0 1000.0 diff --git a/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_.txt b/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_.txt index 3cd1efdf..0e6d8e65 100644 --- a/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_.txt +++ b/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_.txt @@ -23,16 +23,18 @@ compute pe_atom_all_aiida all pe/atom compute ke_atom_all_aiida all ke/atom compute stress_atom_all_aiida all stress/atom NULL compute pressure_all_aiida all pressure thermo_temp +compute property_atom_all_aiida all property/atom fx fy #-------------------------End of the Compute information-------------------------# #------------------------Start of the Thermo information-------------------------# thermo_style custom step pe ke press pxx pyy pzz etotal c_pressure_all_aiida c_pressure_all_aiida[1] c_pressure_all_aiida[2] c_pressure_all_aiida[3] c_pressure_all_aiida[4] c_pressure_all_aiida[5] c_pressure_all_aiida[6] thermo 100 #-------------------------End of the Thermo information--------------------------# #-------------------------Start of the Dump information--------------------------# -dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] +dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] c_property_atom_all_aiida[*] dump_modify aiida sort id dump_modify aiida element Fe Fe -dump_modify aiida format line "%6d %4d %4s %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f %16.10f" +dump_modify aiida format int ' %d ' +dump_modify aiida format float ' %16.10e ' #--------------------------End of the Dump information---------------------------# #---------------------Start of the Minimization information----------------------# min_style cg diff --git a/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_False_.txt b/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_False_.txt new file mode 100644 index 00000000..0e6d8e65 --- /dev/null +++ b/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_False_.txt @@ -0,0 +1,80 @@ +#------------------------Start of the Control information------------------------# +clear +units metal +newton on +timestep 1e-05 +#-------------------------End of the Control information-------------------------# +#-----------------------Start of the Structure information-----------------------# +box tilt small +dimension 3 +boundary p p p +atom_style atomic +read_data structure.dat +#------------------------End of the Structure information------------------------# +#-------------------------Start of Potential information-------------------------# +pair_style eam/alloy +pair_coeff * * potential.dat Fe Fe +#--------------------------End of Potential information--------------------------# +#--------------------------Start of the Fix information--------------------------# +fix box_relax_all_aiida all box/relax iso 0.0 vmax 0.001 +#---------------------------End of the Fix information---------------------------# +#------------------------Start of the Compute information------------------------# +compute pe_atom_all_aiida all pe/atom +compute ke_atom_all_aiida all ke/atom +compute stress_atom_all_aiida all stress/atom NULL +compute pressure_all_aiida all pressure thermo_temp +compute property_atom_all_aiida all property/atom fx fy +#-------------------------End of the Compute information-------------------------# +#------------------------Start of the Thermo information-------------------------# +thermo_style custom step pe ke press pxx pyy pzz etotal c_pressure_all_aiida c_pressure_all_aiida[1] c_pressure_all_aiida[2] c_pressure_all_aiida[3] c_pressure_all_aiida[4] c_pressure_all_aiida[5] c_pressure_all_aiida[6] +thermo 100 +#-------------------------End of the Thermo information--------------------------# +#-------------------------Start of the Dump information--------------------------# +dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] c_property_atom_all_aiida[*] +dump_modify aiida sort id +dump_modify aiida element Fe Fe +dump_modify aiida format int ' %d ' +dump_modify aiida format float ' %16.10e ' +#--------------------------End of the Dump information---------------------------# +#---------------------Start of the Minimization information----------------------# +min_style cg +minimize 1e-05 1e-05 5000 5000 +#----------------------End of the Minimization information-----------------------# +#--------------------Start of the Final Variables information--------------------# +variable final_step equal step +variable final_pe equal pe +variable final_ke equal ke +variable final_press equal press +variable final_pxx equal pxx +variable final_pyy equal pyy +variable final_pzz equal pzz +variable final_etotal equal etotal +variable final_c_pressure_all_aiida equal c_pressure_all_aiida +variable final_c_pressure_all_aiida__1__ equal c_pressure_all_aiida[1] +variable final_c_pressure_all_aiida__2__ equal c_pressure_all_aiida[2] +variable final_c_pressure_all_aiida__3__ equal c_pressure_all_aiida[3] +variable final_c_pressure_all_aiida__4__ equal c_pressure_all_aiida[4] +variable final_c_pressure_all_aiida__5__ equal c_pressure_all_aiida[5] +variable final_c_pressure_all_aiida__6__ equal c_pressure_all_aiida[6] +#---------------------End of the Final Variables information---------------------# +#---------------Start of the Printing Final Variables information----------------# +print "#Final results" file aiida_lammps.yaml +print "final_step: ${final_step}" append aiida_lammps.yaml +print "final_pe: ${final_pe}" append aiida_lammps.yaml +print "final_ke: ${final_ke}" append aiida_lammps.yaml +print "final_press: ${final_press}" append aiida_lammps.yaml +print "final_pxx: ${final_pxx}" append aiida_lammps.yaml +print "final_pyy: ${final_pyy}" append aiida_lammps.yaml +print "final_pzz: ${final_pzz}" append aiida_lammps.yaml +print "final_etotal: ${final_etotal}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida: ${final_c_pressure_all_aiida}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__1__: ${final_c_pressure_all_aiida__1__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__2__: ${final_c_pressure_all_aiida__2__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__3__: ${final_c_pressure_all_aiida__3__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__4__: ${final_c_pressure_all_aiida__4__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__5__: ${final_c_pressure_all_aiida__5__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__6__: ${final_c_pressure_all_aiida__6__}" append aiida_lammps.yaml +#----------------End of the Printing Final Variables information-----------------# +#---------------------Start of the write restart information---------------------# +write_restart restart.aiida +#----------------------End of the write restart information----------------------# diff --git a/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_True_.txt b/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_True_.txt new file mode 100644 index 00000000..40e5ed8b --- /dev/null +++ b/tests/test_generate_inputs/test_input_generate_minimize_eam_alloy_True_.txt @@ -0,0 +1,80 @@ +#------------------------Start of the Control information------------------------# +clear +units metal +newton on +timestep 1e-05 +#-------------------------End of the Control information-------------------------# +#-----------------------Start of the Structure information-----------------------# +box tilt small +dimension 2 +boundary p p f +atom_style atomic +read_data structure.dat +#------------------------End of the Structure information------------------------# +#-------------------------Start of Potential information-------------------------# +pair_style eam/alloy +pair_coeff * * potential.dat Fe Fe +#--------------------------End of Potential information--------------------------# +#--------------------------Start of the Fix information--------------------------# +fix box_relax_all_aiida all box/relax iso 0.0 vmax 0.001 +#---------------------------End of the Fix information---------------------------# +#------------------------Start of the Compute information------------------------# +compute pe_atom_all_aiida all pe/atom +compute ke_atom_all_aiida all ke/atom +compute stress_atom_all_aiida all stress/atom NULL +compute pressure_all_aiida all pressure thermo_temp +compute property_atom_all_aiida all property/atom fx fy +#-------------------------End of the Compute information-------------------------# +#------------------------Start of the Thermo information-------------------------# +thermo_style custom step pe ke press pxx pyy pzz etotal c_pressure_all_aiida c_pressure_all_aiida[1] c_pressure_all_aiida[2] c_pressure_all_aiida[3] c_pressure_all_aiida[4] c_pressure_all_aiida[5] c_pressure_all_aiida[6] +thermo 100 +#-------------------------End of the Thermo information--------------------------# +#-------------------------Start of the Dump information--------------------------# +dump aiida all custom 1000 temp.dump id type element x y z c_pe_atom_all_aiida c_ke_atom_all_aiida c_stress_atom_all_aiida[1] c_stress_atom_all_aiida[2] c_stress_atom_all_aiida[3] c_stress_atom_all_aiida[4] c_stress_atom_all_aiida[5] c_stress_atom_all_aiida[6] c_property_atom_all_aiida[*] +dump_modify aiida sort id +dump_modify aiida element Fe Fe +dump_modify aiida format int ' %d ' +dump_modify aiida format float ' %16.10e ' +#--------------------------End of the Dump information---------------------------# +#---------------------Start of the Minimization information----------------------# +min_style cg +minimize 1e-05 1e-05 5000 5000 +#----------------------End of the Minimization information-----------------------# +#--------------------Start of the Final Variables information--------------------# +variable final_step equal step +variable final_pe equal pe +variable final_ke equal ke +variable final_press equal press +variable final_pxx equal pxx +variable final_pyy equal pyy +variable final_pzz equal pzz +variable final_etotal equal etotal +variable final_c_pressure_all_aiida equal c_pressure_all_aiida +variable final_c_pressure_all_aiida__1__ equal c_pressure_all_aiida[1] +variable final_c_pressure_all_aiida__2__ equal c_pressure_all_aiida[2] +variable final_c_pressure_all_aiida__3__ equal c_pressure_all_aiida[3] +variable final_c_pressure_all_aiida__4__ equal c_pressure_all_aiida[4] +variable final_c_pressure_all_aiida__5__ equal c_pressure_all_aiida[5] +variable final_c_pressure_all_aiida__6__ equal c_pressure_all_aiida[6] +#---------------------End of the Final Variables information---------------------# +#---------------Start of the Printing Final Variables information----------------# +print "#Final results" file aiida_lammps.yaml +print "final_step: ${final_step}" append aiida_lammps.yaml +print "final_pe: ${final_pe}" append aiida_lammps.yaml +print "final_ke: ${final_ke}" append aiida_lammps.yaml +print "final_press: ${final_press}" append aiida_lammps.yaml +print "final_pxx: ${final_pxx}" append aiida_lammps.yaml +print "final_pyy: ${final_pyy}" append aiida_lammps.yaml +print "final_pzz: ${final_pzz}" append aiida_lammps.yaml +print "final_etotal: ${final_etotal}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida: ${final_c_pressure_all_aiida}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__1__: ${final_c_pressure_all_aiida__1__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__2__: ${final_c_pressure_all_aiida__2__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__3__: ${final_c_pressure_all_aiida__3__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__4__: ${final_c_pressure_all_aiida__4__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__5__: ${final_c_pressure_all_aiida__5__}" append aiida_lammps.yaml +print "final_c_pressure_all_aiida__6__: ${final_c_pressure_all_aiida__6__}" append aiida_lammps.yaml +#----------------End of the Printing Final Variables information-----------------# +#---------------------Start of the write restart information---------------------# +write_restart restart.aiida +#----------------------End of the write restart information----------------------# diff --git a/tests/test_generate_structure.py b/tests/test_generate_structure.py index 669f8930..f60aefad 100644 --- a/tests/test_generate_structure.py +++ b/tests/test_generate_structure.py @@ -1,7 +1,6 @@ """Test the structure generation in aiida-lammps""" -import pytest - from aiida_lammps.parsers.utils import generate_lammps_structure +import pytest @pytest.mark.parametrize( diff --git a/tests/test_parsers.py b/tests/test_parsers.py index d227dfcf..15ce0c3a 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -4,7 +4,6 @@ import os from aiida.plugins import ParserFactory - from aiida_lammps.parsers.parse_raw import parse_final_data, parse_outputfile from .utils import TEST_DIR diff --git a/tests/test_potential_data.py b/tests/test_potential_data.py index dc26c212..d13c5fcc 100644 --- a/tests/test_potential_data.py +++ b/tests/test_potential_data.py @@ -1,11 +1,10 @@ """Test the functionality of the lammps potential data object""" import os -import pytest -import yaml - from aiida_lammps.data.potential import LammpsPotentialData from aiida_lammps.parsers import inputfile +import pytest +import yaml from .utils import TEST_DIR diff --git a/tests/test_workflows.py b/tests/test_workflows.py index a9cdd6d6..6862f2f8 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -4,11 +4,10 @@ from aiida.common import AttributeDict, LinkType from aiida.engine import ProcessHandlerReport, run_get_node from aiida.plugins import WorkflowFactory -from plumpy import ProcessState -import pytest - from aiida_lammps.calculations.base import LammpsBaseCalculation from aiida_lammps.workflows.base import LammpsBaseWorkChain +from plumpy import ProcessState +import pytest from .utils import get_default_metadata, recursive_round diff --git a/tests/test_workflows/test_relax_workchain_parameters_relax0_.yml b/tests/test_workflows/test_relax_workchain_parameters_relax0_.yml index c50ad4b0..7f813e2e 100644 --- a/tests/test_workflows/test_relax_workchain_parameters_relax0_.yml +++ b/tests/test_workflows/test_relax_workchain_parameters_relax0_.yml @@ -43,6 +43,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -63,29 +65,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220929519' - - '-4.1220929519' + - '-4.1220929519e+00' + - '-4.1220929519e+00' + c_property_atom_all_aiida__1__: + - '1.9428902931e-15' + - '-1.8596235662e-15' + c_property_atom_all_aiida__2__: + - '1.9359513992e-15' + - '-1.7694179455e-15' c_stress_atom_all_aiida__1__: - - '-150430.9585047998' - - '-150430.9585047990' + - '-1.5043095850e+05' + - '-1.5043095850e+05' c_stress_atom_all_aiida__2__: - - '-150430.9585047997' - - '-150430.9585047991' + - '-1.5043095850e+05' + - '-1.5043095850e+05' c_stress_atom_all_aiida__3__: - - '-150430.9585047995' - - '-150430.9585047988' + - '-1.5043095850e+05' + - '-1.5043095850e+05' c_stress_atom_all_aiida__4__: - - '0.0000000001' - - '0.0000000001' + - '6.6703996493e-11' + - '8.8938661991e-11' c_stress_atom_all_aiida__5__: - - '0.0000000002' - - '0.0000000000' + - '1.5564265848e-10' + - '4.4469330995e-11' c_stress_atom_all_aiida__6__: - - '0.0000000001' - - '0.0000000000' + - '9.7624078201e-11' + - '4.5164164292e-11' element: - Fe - Fe @@ -96,39 +104,45 @@ trajectories_steps: - '1' - '1' x: - - '2.8482584058' - - '1.4240580000' + - '2.8482584058e+00' + - '1.4240580000e+00' y: - - '2.8482584058' - - '1.4240580000' + - '2.8482584058e+00' + - '1.4240580000e+00' z: - - '2.8482584058' - - '1.4240580000' + - '2.8482584058e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1221205389' - - '-4.1221205389' + - '-4.1221205389e+00' + - '-4.1221205389e+00' + c_property_atom_all_aiida__1__: + - '-1.6653345369e-16' + - '5.5511151231e-17' + c_property_atom_all_aiida__2__: + - '-4.8572257327e-17' + - '1.0408340856e-16' c_stress_atom_all_aiida__1__: - - '-144245.3932050727' - - '-144245.3932050756' + - '-1.4424539321e+05' + - '-1.4424539321e+05' c_stress_atom_all_aiida__2__: - - '-144245.3932050726' - - '-144245.3932050756' + - '-1.4424539321e+05' + - '-1.4424539321e+05' c_stress_atom_all_aiida__3__: - - '-144245.3932050728' - - '-144245.3932050758' + - '-1.4424539321e+05' + - '-1.4424539321e+05' c_stress_atom_all_aiida__4__: - - '0.0000000003' - - '0.0000000001' + - '2.6681598597e-10' + - '1.1117332749e-10' c_stress_atom_all_aiida__5__: - - '-0.0000000001' - - '-0.0000000001' + - '-6.6703996493e-11' + - '-1.3340799299e-10' c_stress_atom_all_aiida__6__: - - '-0.0000000000' - - '-0.0000000002' + - '-3.8910664621e-11' + - '-2.4701323701e-10' element: - Fe - Fe @@ -139,11 +153,11 @@ trajectories_steps: - '1' - '1' x: - - '2.8484008116' - - '1.4240579858' + - '2.8484008116e+00' + - '1.4240579858e+00' y: - - '2.8484008116' - - '1.4240579858' + - '2.8484008116e+00' + - '1.4240579858e+00' z: - - '2.8484008116' - - '1.4240579858' + - '2.8484008116e+00' + - '1.4240579858e+00' diff --git a/tests/test_workflows/test_relax_workchain_parameters_relax1_.yml b/tests/test_workflows/test_relax_workchain_parameters_relax1_.yml index ae982fb0..e1e5e8ed 100644 --- a/tests/test_workflows/test_relax_workchain_parameters_relax1_.yml +++ b/tests/test_workflows/test_relax_workchain_parameters_relax1_.yml @@ -43,6 +43,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -63,29 +65,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220929519' - - '-4.1220929519' + - '-4.1220929519e+00' + - '-4.1220929519e+00' + c_property_atom_all_aiida__1__: + - '1.9428902931e-15' + - '-1.8596235662e-15' + c_property_atom_all_aiida__2__: + - '1.9359513992e-15' + - '-1.7694179455e-15' c_stress_atom_all_aiida__1__: - - '-150430.9585047998' - - '-150430.9585047990' + - '-1.5043095850e+05' + - '-1.5043095850e+05' c_stress_atom_all_aiida__2__: - - '-150430.9585047997' - - '-150430.9585047991' + - '-1.5043095850e+05' + - '-1.5043095850e+05' c_stress_atom_all_aiida__3__: - - '-150430.9585047995' - - '-150430.9585047988' + - '-1.5043095850e+05' + - '-1.5043095850e+05' c_stress_atom_all_aiida__4__: - - '0.0000000001' - - '0.0000000001' + - '6.6703996493e-11' + - '8.8938661991e-11' c_stress_atom_all_aiida__5__: - - '0.0000000002' - - '0.0000000000' + - '1.5564265848e-10' + - '4.4469330995e-11' c_stress_atom_all_aiida__6__: - - '0.0000000001' - - '0.0000000000' + - '9.7624078201e-11' + - '4.5164164292e-11' element: - Fe - Fe @@ -96,39 +104,45 @@ trajectories_steps: - '1' - '1' x: - - '2.8482584058' - - '1.4240580000' + - '2.8482584058e+00' + - '1.4240580000e+00' y: - - '2.8482584058' - - '1.4240580000' + - '2.8482584058e+00' + - '1.4240580000e+00' z: - - '2.8482584058' - - '1.4240580000' + - '2.8482584058e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1221205389' - - '-4.1221205389' + - '-4.1221205389e+00' + - '-4.1221205389e+00' + c_property_atom_all_aiida__1__: + - '-1.6653345369e-16' + - '5.5511151231e-17' + c_property_atom_all_aiida__2__: + - '-4.8572257327e-17' + - '1.0408340856e-16' c_stress_atom_all_aiida__1__: - - '-144245.3932050727' - - '-144245.3932050756' + - '-1.4424539321e+05' + - '-1.4424539321e+05' c_stress_atom_all_aiida__2__: - - '-144245.3932050726' - - '-144245.3932050756' + - '-1.4424539321e+05' + - '-1.4424539321e+05' c_stress_atom_all_aiida__3__: - - '-144245.3932050728' - - '-144245.3932050758' + - '-1.4424539321e+05' + - '-1.4424539321e+05' c_stress_atom_all_aiida__4__: - - '0.0000000003' - - '0.0000000001' + - '2.6681598597e-10' + - '1.1117332749e-10' c_stress_atom_all_aiida__5__: - - '-0.0000000001' - - '-0.0000000001' + - '-6.6703996493e-11' + - '-1.3340799299e-10' c_stress_atom_all_aiida__6__: - - '-0.0000000000' - - '-0.0000000002' + - '-3.8910664621e-11' + - '-2.4701323701e-10' element: - Fe - Fe @@ -139,11 +153,11 @@ trajectories_steps: - '1' - '1' x: - - '2.8484008116' - - '1.4240579858' + - '2.8484008116e+00' + - '1.4240579858e+00' y: - - '2.8484008116' - - '1.4240579858' + - '2.8484008116e+00' + - '1.4240579858e+00' z: - - '2.8484008116' - - '1.4240579858' + - '2.8484008116e+00' + - '1.4240579858e+00' diff --git a/tests/test_workflows/test_relax_workchain_parameters_relax2_.yml b/tests/test_workflows/test_relax_workchain_parameters_relax2_.yml index b0666eae..4f255636 100644 --- a/tests/test_workflows/test_relax_workchain_parameters_relax2_.yml +++ b/tests/test_workflows/test_relax_workchain_parameters_relax2_.yml @@ -42,6 +42,8 @@ trajectories_attributes: field_names: - c_ke_atom_all_aiida - c_pe_atom_all_aiida + - c_property_atom_all_aiida__1__ + - c_property_atom_all_aiida__2__ - c_stress_atom_all_aiida__1__ - c_stress_atom_all_aiida__2__ - c_stress_atom_all_aiida__3__ @@ -62,29 +64,35 @@ trajectories_attributes: trajectories_steps: 0: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '-2.4702462298e-15' + - '2.2204460493e-15' + c_property_atom_all_aiida__2__: + - '-2.5257573810e-15' + - '2.4702462298e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153454' - - '-156610.8675153454' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153455' - - '-156610.8675153456' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '0.0000000009' - - '0.0000000009' + - '8.6715195441e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000009' + - '9.7832528190e-10' + - '9.1162128540e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5782769964e-10' + - '8.9946170271e-10' element: - Fe - Fe @@ -95,39 +103,45 @@ trajectories_steps: - '1' - '2' x: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' y: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' z: - - '0.0000000000' - - '1.4240580000' + - '0.0000000000e+00' + - '1.4240580000e+00' 1: c_ke_atom_all_aiida: - - '0.0000000000' - - '0.0000000000' + - '0.0000000000e+00' + - '0.0000000000e+00' c_pe_atom_all_aiida: - - '-4.1220642071' - - '-4.1220642071' + - '-4.1220642071e+00' + - '-4.1220642071e+00' + c_property_atom_all_aiida__1__: + - '2.5812685323e-15' + - '-2.5535129566e-15' + c_property_atom_all_aiida__2__: + - '2.4980018054e-15' + - '-2.5257573810e-15' c_stress_atom_all_aiida__1__: - - '-156610.8675153434' - - '-156610.8675153464' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__2__: - - '-156610.8675153432' - - '-156610.8675153462' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__3__: - - '-156610.8675153435' - - '-156610.8675153466' + - '-1.5661086752e+05' + - '-1.5661086752e+05' c_stress_atom_all_aiida__4__: - - '-0.0000000012' - - '-0.0000000012' + - '-1.2451412679e-09' + - '-1.2229066024e-09' c_stress_atom_all_aiida__5__: - - '0.0000000010' - - '0.0000000008' + - '9.7832528190e-10' + - '8.2268262341e-10' c_stress_atom_all_aiida__6__: - - '0.0000000010' - - '0.0000000009' + - '9.5470094981e-10' + - '9.0224103590e-10' element: - Fe - Fe @@ -138,11 +152,11 @@ trajectories_steps: - '1' - '2' x: - - '-0.0000000000' - - '1.4240580000' + - '-1.5961825279e-16' + - '1.4240580000e+00' y: - - '-0.0000000000' - - '1.4240580000' + - '-1.6320517982e-16' + - '1.4240580000e+00' z: - - '-0.0000000000' - - '1.4240580000' + - '-1.2912937305e-16' + - '1.4240580000e+00'