Skip to content

Commit feed7c2

Browse files
authored
Merge branch 'master' into dependabot/pip/myst-parser-approx-eq-4.0.0
2 parents 9e043b9 + 65e1bb4 commit feed7c2

File tree

10 files changed

+63
-56
lines changed

10 files changed

+63
-56
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ jobs:
3737
fail-fast: false
3838
matrix:
3939
include:
40-
- python-version: "3.9"
41-
lammps-version: "2020.12.24"
4240
- python-version: "3.9"
4341
lammps-version: "2022.06.23"
4442
- python-version: "3.10"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ pip-wheel-metadata
4545
docs/_build/
4646
docs/build
4747
docs/source/reference/api
48+
docs/source/apidocs

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
- Fixing an issue in the documentation caused by the fact that the molecular dynamics module file was called md, causing a confusion on whether it was the file extension of the actual file name. Changes the name of the file `src/aiida_lammps/workflows/md.py` for `src/aiida_lammps/workflows/molecular_dynamics.py`
4+
35
## v1.0.2 2024-04-26
46

57
- Fixing an issue in which some LAMMPS vectorial properties were not working properly.

docs/source/conf.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@
2424
VERSION = __version__
2525

2626
extensions = [
27+
"myst_parser",
2728
"sphinx.ext.mathjax",
2829
"sphinx.ext.intersphinx",
2930
"sphinx.ext.viewcode",
3031
"sphinx_copybutton",
32+
"sphinx.ext.autodoc",
3133
"sphinx_click.ext",
3234
"sphinx_design",
33-
"myst_parser",
35+
"autodoc2",
36+
"sphinx.ext.napoleon",
3437
"aiida.sphinxext",
35-
"autoapi.extension",
3638
]
3739

3840
intersphinx_mapping = {
@@ -43,7 +45,7 @@
4345
}
4446

4547

46-
# Settings for the `autoapi.extenstion` automatically generating API docs
48+
# Settings for the `autoapi.extension` automatically generating API docs
4749
filepath_docs = pathlib.Path(__file__).parent.parent
4850
filepath_src = filepath_docs.parent / "src/aiida_lammps"
4951
autoapi_type = "python"
@@ -53,6 +55,26 @@
5355
autoapi_keep_files = True
5456
autoapi_add_toctree_entry = False
5557

58+
autodoc2_packages = [
59+
{
60+
"path": "../../src/aiida_lammps",
61+
"exclude_files": ["_docs.py"],
62+
"auto_mode": True,
63+
}
64+
]
65+
autodoc2_hidden_objects = ["dunder", "private", "inherited"]
66+
autodoc2_replace_annotations = [
67+
("re.Pattern", "typing.Pattern"),
68+
("markdown_it.MarkdownIt", "markdown_it.main.MarkdownIt"),
69+
]
70+
autodoc2_replace_bases = [
71+
("sphinx.directives.SphinxDirective", "sphinx.util.docutils.SphinxDirective"),
72+
]
73+
autodoc2_docstring_parser_regexes = [
74+
("myst_parser", "myst"),
75+
(r"myst_parser\.setup", "myst"),
76+
]
77+
5678
# Settings for the `sphinx_copybutton` extension
5779
copybutton_selector = "div:not(.no-copy)>div.highlight pre"
5880
copybutton_prompt_text = (

docs/source/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ developers/index
3030
```{toctree}
3131
:hidden: true
3232
:caption: Reference
33-
reference/api/index
33+
apidocs/index
3434
```
3535

3636

docs/source/reference/api/index.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ docs = [
6060
'sphinx-autoapi~=3.0',
6161
'myst_parser~=4.0.0',
6262
"furo",
63+
"sphinx-autodoc2"
6364
]
6465

6566
pre-commit = ['pre-commit~=3.7']
@@ -79,7 +80,7 @@ pre-commit = ['pre-commit~=3.7']
7980
[project.entry-points."aiida.workflows"]
8081
"lammps.base" = "aiida_lammps.workflows.base:LammpsBaseWorkChain"
8182
"lammps.relax" = "aiida_lammps.workflows.relax:LammpsRelaxWorkChain"
82-
"lammps.md" = "aiida_lammps.workflows.md:LammpsMDWorkChain"
83+
"lammps.md" = "aiida_lammps.workflows.molecular_dynamics:LammpsMDWorkChain"
8384

8485
[tool.flit.module]
8586
name = "aiida_lammps"

src/aiida_lammps/data/potential.py

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _validate_datetime(data: Union[str, int, float, datetime.datetime]) -> int:
7272
"""
7373
Validate and transform dates into integers
7474
75-
:param data: representation of a year
75+
param data: representation of a year
7676
:type data: Union[str,int,float, datetime.datetime]
7777
:raises TypeError: raise if the data is not of type str, int, float or datetime.datetime
7878
:return: integer representing a year
@@ -87,27 +87,27 @@ def _validate_datetime(data: Union[str, int, float, datetime.datetime]) -> int:
8787
return data
8888

8989

90-
def _validate_sources(data: Union[dict, list[dict]]) -> list[dict]:
90+
def _validate_sources(
91+
data: Union[dict[str, Any], list[dict[str, Any]]],
92+
) -> list[dict[str, Any]]:
9193
"""
9294
Validate the sources for the potential.
9395
9496
This checks whether the entry is a dictionary that can be used to describe
9597
the citation for a potential.
9698
9799
:param data: citation data for a potential
98-
:type data: Union[dict, List[dict]]
100+
:type data: Union[dict, List[dict[str, Any]]]
99101
:raises TypeError: raises if the data is not a dict or list of dicts
100102
:raises TypeError: raises if not all the entries in the list are dicts
101103
:return: list of references for a potential
102-
:rtype: List[dict]
104+
:rtype: List[dict[str, Any]]
103105
"""
104106

105-
def _validate_single_source(source: dict) -> dict:
107+
def _validate_single_source(source: dict[str, Any]) -> dict[str, Any]:
106108
"""
107109
Validate a single potential citation data
108-
109110
This will check if certain keys exists and add them to the citation data
110-
111111
:param source: citation data for a potential
112112
:type source: dict
113113
:return: validated potential data
@@ -140,21 +140,12 @@ class LammpsPotentialData(orm.SinglefileData):
140140
"""
141141
Base class for the LAMMPS potentials.
142142
143-
This class allows the storage/recovering of LAMMPS potentials, it allows
144-
one to store any LAMMPS potential as a :py:class:`~aiida.orm.nodes.data.singlefile.SinglefileData` object, which can
145-
then be either written to the LAMMPS input script and/or to a file, where
146-
it can be easily read by LAMMPS. This distinction depends on the assigned
147-
``pair_style`` which require different ``pair_coeff`` entries in the input
148-
file.
149-
150-
Based on the
151-
`pseudo <https://github.com/aiidateam/aiida-pseudo/blob/master/aiida_pseudo/data/pseudo/pseudo.py>`_
152-
class written by Sebaastian Huber.
153-
154-
The potentials are also tagged by following the KIM-API
155-
`schema <https://openkim.org/doc/schema/kimspec/>`_, as to make them more easy
156-
to track and as compatible as possible to the KIM schema.
157-
""" # pylint: disable=line-too-long
143+
This class allows the storage/recovering of LAMMPS potentials, it allows one to store any LAMMPS potential as a
144+
:py:class:`~aiida.orm.nodes.data.singlefile.SinglefileData` object, which can then be either written to the LAMMPS
145+
input script and/or to a file, where it can be easily read by LAMMPS.
146+
This distinction depends on the assigned ``pair_style`` which require different ``pair_coeff`` entries in
147+
the input file.
148+
"""
158149

159150
# pylint: disable=too-many-arguments, too-many-ancestors
160151
_key_element = "element"
@@ -221,10 +212,8 @@ def get_or_create(
221212
:param extra_tags: Dictionary with extra information to tag the
222213
potential, based on the KIM schema.
223214
:type extra_tags: dict
224-
:return: instance of ``LammpsPotentialData``, stored if taken from
225-
database, unstored otherwise.
226-
:raises TypeError: if the source is not a ``str``, ``pathlib.Path``
227-
instance or binary stream.
215+
:return: instance of ``LammpsPotentialData``, stored if taken from database, unstored otherwise.
216+
:raises TypeError: if the source is not a ``str``, ``pathlib.Path`` instance or binary stream.
228217
:raises FileNotFoundError: if the source is a filepath but does not exist.
229218
"""
230219
# pylint: disable=too-many-arguments
@@ -253,9 +242,10 @@ def get_or_create(
253242
return potential
254243

255244
@classmethod
256-
def get_entry_point_name(cls):
245+
def get_entry_point_name(cls) -> str:
257246
"""Return the entry point name associated with this data class.
258247
:return: the entry point name.
248+
:rtype: str
259249
"""
260250
_, entry_point = plugins.entry_point.get_entry_point_from_class(
261251
cls.__module__,
@@ -268,8 +258,9 @@ def is_readable_byte_stream(stream) -> bool:
268258
"""Return if object is a readable filelike object in binary mode or stream of bytes.
269259
270260
:param stream: the object to analyze.
271-
:returns: True if ``stream`` appears to be a readable filelike object
261+
:return: True if ``stream`` appears to be a readable filelike object
272262
in binary mode, False otherwise.
263+
:rtype: bool
273264
"""
274265
return isinstance(stream, io.BytesIO) or (
275266
hasattr(stream, "read") and hasattr(stream, "mode") and "b" in stream.mode
@@ -285,6 +276,8 @@ def prepare_source(cls, source: Union[str, pathlib.Path, BinaryIO]) -> BinaryIO:
285276
:raises TypeError: if the source is not a ``str``, ``pathlib.Path``
286277
instance or binary stream.
287278
:raises FileNotFoundError: if the source is a filepath but does not exist.
279+
:return: byte stream with the potential information
280+
:rtype: BinaryIO
288281
"""
289282
if not isinstance(
290283
source, (str, pathlib.Path)
@@ -545,10 +538,10 @@ def pair_style(self) -> str:
545538
return self.base.attributes.get("pair_style")
546539

547540
@property
548-
def species(self) -> list:
541+
def species(self) -> list[str]:
549542
"""Return the list of species which this potential can be used for.
550543
:return: The list of chemical species which are contained in this potential.
551-
:rtype: list
544+
:rtype: list[str]
552545
"""
553546
return self.base.attributes.get("species")
554547

@@ -579,15 +572,15 @@ def content_origin(self) -> str:
579572
return self.base.attributes.get("content_origin")
580573

581574
@property
582-
def content_other_locations(self) -> Union[str, list]:
575+
def content_other_locations(self) -> Union[str, list[str]]:
583576
"""
584577
Return other locations where the potential can be found.
585578
586579
As based in the KIM schema. A description of and/or web address(es)
587580
to other location(s) where the content is available.
588581
589582
:return: other locations where the potential can be found.
590-
:rtype: Union[str, list]
583+
:rtype: Union[str, list[str]]
591584
"""
592585
return self.base.attributes.get("content_other_locations")
593586

@@ -621,7 +614,7 @@ def description(self) -> str:
621614
return self.base.attributes.get("description")
622615

623616
@property
624-
def developer(self) -> Union[str, list]:
617+
def developer(self) -> Union[str, list[str]]:
625618
"""
626619
Return the developer information of this potential.
627620
@@ -632,7 +625,7 @@ def developer(self) -> Union[str, list]:
632625
of an interatomic model or a specific parameter set for it.
633626
634627
:return: developer information of this potential
635-
:rtype: Union[str, list]
628+
:rtype: Union[str, list[str]]
636629
"""
637630
return self.base.attributes.get("developer")
638631

@@ -651,14 +644,14 @@ def disclaimer(self) -> str:
651644
return self.base.attributes.get("disclaimer")
652645

653646
@property
654-
def properties(self) -> Union[str, list]:
647+
def properties(self) -> Union[str, list[str]]:
655648
"""
656649
Return the properties for which this potential was devised.
657650
658651
As based in the KIM schema. A list of properties reported by a KIM Item.
659652
660653
:return: properties fow which this potential was devised.
661-
:rtype: Union[str, list]
654+
:rtype: Union[str, list[str]]
662655
"""
663656
return self.base.attributes.get("properties")
664657

@@ -675,15 +668,15 @@ def publication_year(self) -> Union[str, datetime.datetime, int]:
675668
return self.base.attributes.get("publication_year")
676669

677670
@property
678-
def source_citations(self) -> Union[str, list]:
671+
def source_citations(self) -> Union[str, list[str]]:
679672
"""
680673
Return the citation where the potential was originally published.
681674
682675
As based in the KIM schema. An array of BibTeX-style EDN dictionaries
683676
corresponding to primary published work(s) describing the KIM Item.
684677
685678
:return: the citation where the potential was originally published.
686-
:rtype: Union[str, list]
679+
:rtype: Union[str, list[str]]
687680
"""
688681
return self.base.attributes.get("source_citations")
689682

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Set of workflows to handle calculations using aiida-lammps"""

0 commit comments

Comments
 (0)