Skip to content

Commit

Permalink
121 problem with dimensionality for non periodic boundary conditions …
Browse files Browse the repository at this point in the history
…in lammpsbase (aiidaplugins#122)

* (WIP) Adding override parameters for the structure dimension and boundary conditions when creating structure inputs.

* Small formatting changes to make them more consistent

* Fixing some type errors in the input generation.

* Fixing some type errors in the input generation.

Fixing a pre-commit issue

* Adding tests to check the override of structural paramters handling the boundary and dimensionality of the structure.

* Adding notes in the documentation about the possibility to override the dimension and the boundaries.

* Updating the possible dimensions so that it is compatible with the LAMMPS options.

---------

Co-authored-by: Jonathan Chico <[email protected]>
  • Loading branch information
JPchico and Jonathan Chico authored Apr 26, 2024
1 parent bd3d402 commit 6874bfc
Show file tree
Hide file tree
Showing 9 changed files with 327 additions and 89 deletions.
11 changes: 9 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
initialise a test database and profile
"""

# pylint: disable=redefined-outer-name
from __future__ import annotations

Expand All @@ -13,7 +14,7 @@

from aiida import orm
from aiida.common import AttributeDict, CalcInfo, LinkType, exceptions
from aiida.engine import CalcJob
from aiida.engine import CalcJob, Process
from aiida.engine.utils import instantiate_process
from aiida.manage.manager import get_manager
from aiida.plugins import WorkflowFactory
Expand Down Expand Up @@ -67,6 +68,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."""
Expand Down Expand Up @@ -612,7 +619,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.
Expand Down
2 changes: 2 additions & 0 deletions docs/source/topics/data/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
10 changes: 5 additions & 5 deletions src/aiida_lammps/parsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import glob
import os
import time
from typing import Union
from typing import Any, Dict, List, Union

from aiida import orm
from aiida.common import exceptions
Expand Down Expand Up @@ -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:
"""
Expand Down Expand Up @@ -247,8 +247,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
)
Expand Down
Loading

0 comments on commit 6874bfc

Please sign in to comment.