Skip to content

Commit

Permalink
(WIP) documentation improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Chico committed Nov 23, 2023
1 parent 5dbe245 commit fc2b9f8
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ conda install lammps==2019.06.05
You can specify a different executable name for LAMMPS with:

```shell
tox -e py37 -- --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:
Expand Down
Binary file removed docs/source/_static/logo.pptx
Binary file not shown.
51 changes: 30 additions & 21 deletions docs/source/developers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,40 @@ This is a guide for internal development of `aiida-lammps`

The code is formatted and linted using [pre-commit](https://pre-commit.com/), which runs in an isolated, virtual environment:

```shell
$ pip install pre-commit
$ pre-commit run --all
```console
pip install pre-commit
pre-commit run --all
```

or to automate runs, triggered before each commit:

```shell
$ pre-commit install
```console
pre-commit install
```

To avoid problems arising from different configurations in virtual environments, one can also use [tox](https://tox.wiki/en/latest/index.html) to run the pre-commit command inside a clean virtual environment. This can be done in the following manner

```console
pip install tox
pip install -e .[pre-commit]
tox -e pre-commit
```


## Testing

The test suite can be run in an isolated, virtual environment using `tox` (see `tox.ini` in the repo):
The test suite can be run in an isolated, virtual environment using `tox` (see `[tool.tox]` in `pyproject.toml`):

```shell
$ pip install tox
$ tox -e py37
```console
pip install tox
tox -e 3.8-aiida_lammps
```

or directly:

```shell
$ pip install .[tests]
$ pytest -v
```console
pip install .[tests]
pytest -v
```

The tests require that both PostgreSQL and RabbitMQ are running.
Expand All @@ -40,33 +49,33 @@ Some tests require that a `lammps` executable be present.

The easiest way to achieve this is to use Conda:

```shell
$ conda install lammps==2019.06.05
```console
conda install lammps==2019.06.05
# this will install lmp_serial and lmp_mpi
```

You can specify a different executable name for LAMMPS with:

```shell
$ tox -e py37 -- --lammps-exec lmp_exec
```console
tox -e 3.8-aiida_lammps -- --lammps-exec lmp_exec
```

To output the results of calcjob executions to a specific directory:

```shell
$ pytest --lammps-workdir "test_workdir"
```console
pytest --lammps-workdir "test_workdir"
```

## Documentation

To run a full docs build:

```shell
$ tox -e docs-clean
```console
tox -e docs-clean
```

or to re-build from the current documentation:

```shell
```console
$ tox -e docs-update
```
4 changes: 2 additions & 2 deletions docs/source/getting_started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The package can be installed either from the Python Package Index {{ PyPI }} or
:::{tab-item} PyPI
Installing via {{ PyPI }} can be done making use of the Python package manager {{ pip }}:

```shell
```console
pip install aiida-lammps
```

Expand All @@ -39,7 +39,7 @@ This will install the latest release version available in {{ PyPI }}. Other rele
:::{tab-item} Source
To install from source one needs to clone the repository and then install the package making use of {{ pip }}:

```shell
```console
git clone https://github.com/aiidaplugins/aiida-lammps.git
pip install -e aiida-lammps
```
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ reference/api/index

# AiiDA LAMMPS Plugin

{{ aiida_lammps }} is a Python package that allows the workflow management and data provenance tracking framework [AiiDA](http://aiida-core.readthedocs.io/) run {{ LAMMPS }} calculations.
{{ aiida_lammps }} is a Python package that allows the workflow management and data provenance tracking framework [AiiDA](http://aiida-core.readthedocs.io/) to run {{ LAMMPS }} calculations.

{{ LAMMPS }} is a classical molecular dynamics (MD) code with a focus on materials modeling, it is used broadly inside the MD community due to its flexibility, and in-built capability to generate complex workflows in its input script.

Expand Down Expand Up @@ -109,6 +109,6 @@ The same basic types of calculations than were previously supported (optimizatio

{{ aiida_lammps }} has been designed in such a way that the base ``Calculation`` method can run a single-phase LAMMPS calculation with as much flexibility as possible, with multi-stage runs being handled by specially designed ``WorkChains`` instead.

### What does this implies?
### What does this imply?

Instead of relying on the internal {{ LAMMPS }} scripting language to treat loops, multiple phases, definition of custom variables, etc., those tasks are off loaded to the AiiDA workchains, allowing one to make use of the provenance tracking, automated data storage and caching capabilities of AiiDA.
2 changes: 1 addition & 1 deletion docs/source/topics/data/potential.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `LammpsPotentialData`
# ``LammpsPotentialData``

The potential is one of the most important pieces of data in a MD simulation, since it controls how the atoms interact with each other.
In ``aiida-lammps`` the potential file is stored in the `LammpsPotentialData` data type, which will store the entire potential file in the database, and add certain attributes so that the data node is easily queryable for later usage. These attributes have been chosen so that they resemble the [OpenKIM](https://openkim.org/doc/schema/kimspec/) standard as much as possible.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/first_md.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import requests
import io

# Download the potential from the repository and store it as a BytesIO object
_stream = io.BytesIO(requests.get('https://openkim.org/files/MO_546673549085_000/Fe_2.eam.fs').text.encode('ascii'))
_stream = io.BytesIO(requests.get('https://openkim.org/files/MO_546673549085_000/Fe_2.eam.fs', timeout=20).text.encode('utf-8'))

# Set the metadata for the potential
potential_parameters = {
Expand Down
11 changes: 2 additions & 9 deletions docs/source/tutorials/first_raw.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,8 @@ As one can notice the script wants to read a file named `data.rhodo` via the [`r

```python
import requests
data = SinglefileData(
io.StringIO(
textwrap.dedent(
requests.get(
"https://raw.githubusercontent.com/lammps/lammps/develop/bench/data.rhodo"
).text
)
)
)
request = requests.get("https://raw.githubusercontent.com/lammps/lammps/develop/bench/data.rhodo")
data = SinglefileData(io.StringIO(request.text))
builder.files = {"data": data}
builder.filenames = {"data": "data.rhodo"}
```
Expand Down
13 changes: 4 additions & 9 deletions docs/source/tutorials/include/scripts/run_raw_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@
)
)
)
data = SinglefileData(
io.StringIO(
textwrap.dedent(
requests.get(
"https://raw.githubusercontent.com/lammps/lammps/develop/bench/data.rhodo",
timeout=20,
).text
)
)
request = requests.get(
"https://raw.githubusercontent.com/lammps/lammps/develop/bench/data.rhodo",
timeout=20,
)
data = SinglefileData(io.StringIO(request.text))

builder = CalculationFactory("lammps.raw").get_builder()
builder.code = load_code("lammps@localhost")
Expand Down
13 changes: 4 additions & 9 deletions examples/launch_lammps_raw_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,11 @@
)
)
)
data = orm.SinglefileData(
io.StringIO(
textwrap.dedent(
requests.get(
"https://raw.githubusercontent.com/lammps/lammps/develop/bench/data.rhodo",
timeout=20,
).text
)
)
request = requests.get(
"https://raw.githubusercontent.com/lammps/lammps/develop/bench/data.rhodo",
timeout=20,
)
data = SinglefileData(io.StringIO(request.text))

builder = plugins.CalculationFactory("lammps.raw").get_builder()
builder.code = orm.load_code("lammps-23.06.2022@localhost")
Expand Down

0 comments on commit fc2b9f8

Please sign in to comment.