Skip to content

Commit

Permalink
(WIP) Documentation improvements related to aiidaplugins#77
Browse files Browse the repository at this point in the history
Changing the theme of the documentation to make it more similar to the qe theme.

Adding a tutorial for the minimization calculation.

General improvements to the documentation.
  • Loading branch information
Jonathan Chico committed Nov 17, 2023
1 parent 928a0e1 commit 076ca75
Show file tree
Hide file tree
Showing 30 changed files with 972 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ pip-wheel-metadata
# Docs
docs/_build/
docs/build
docs/source/reference/apidoc
docs/source/reference/api
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
[![Coverage Status](https://codecov.io/gh/aiidaplugins/aiida-lammps/branch/master/graph/badge.svg)](https://codecov.io/gh/aiidaplugins/aiida-lammps)
[![PyPI](https://img.shields.io/pypi/v/aiida-lammps.svg)](https://pypi.python.org/pypi/aiida-lammps/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
[![Docs status](https://readthedocs.org/projects/aiida-lammps/badge)](http://aiida-lammps.readthedocs.io/)

# AiiDA LAMMPS plugin

A LAMMPS plugin for the [AiiDA](http://aiida-core.readthedocs.io/) framework.
An [AiiDA](http://aiida-core.readthedocs.io/) plugin for the classical molecular dynamics code [LAMMPS](https://www.lammps.org).

This plugin contains 2 types of calculations:

- `lammps.base`: Calculation making use of parameter based input generation for single stage LAMMPS calculations.
Expand Down Expand Up @@ -48,9 +50,9 @@ pip install -e aiida-lammps

## Built-in Potential Support

The `lammps.base` calculation and associated workflows make use of the ``LammpsPotentialData`` data structure which is created by passing apotential file, plus some labelling parameters to it.
The `lammps.base` calculation and associated workflows make use of the ``LammpsPotentialData`` data structure which is created by passing a potential file, plus some labelling parameters to it.

This data strcuture can be used to handle the following potential types:
This data structure can be used to handle the following potential types:

- Single file potentials: Any potential that can be stored in a single file, e.g. [EAM](https://docs.lammps.org/pair_eam.html), [MEAM](https://docs.lammps.org/pair_meam.html), [Tersoff](https://docs.lammps.org/pair_tersoff.html) and [ReaxFF](https://docs.lammps.org/pair_reaxff.html).
- Directly parametrized potentials: Potentials whose parameters are directly given via ``pair_coeff`` in the input file, e.g [Born](https://docs.lammps.org/pair_born_gauss.html), [Lennard-Jones](https://docs.lammps.org/pair_line_lj.html) and [Yukawa](https://docs.lammps.org/pair_yukawa.html). These parameters should be written into a file that is then stored into a ``LammpsPotentialData`` node.
Expand Down Expand Up @@ -105,7 +107,7 @@ pytest --lammps-workdir "test_workdir"

### Pre-commit

The code is formatted and linted using [pre-commit](https://pre-commit.com/), so that the code conform to the standars. One must simply install the repository with the `pre-commit` extra dependencies:
The code is formatted and linted using [pre-commit](https://pre-commit.com/), so that the code conform to the standard. One must simply install the repository with the `pre-commit` extra dependencies:

```shell
cd aiida-lammps
Expand All @@ -118,8 +120,11 @@ or to automate runs, triggered before each commit:
pre-commit install
```

The pre-commit can also be run in an isolated enviroment via `tox` with:
The pre-commit can also be run in an isolated environment via `tox` with:

```shell
tox -e pre-commit
```

## License
The `aiida-lammps` plugin package is released under the MIT license. See the `LICENSE.txt` file for more details.
8 changes: 4 additions & 4 deletions aiida_lammps/parsers/inputfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def generate_input_file(
parameters: dict,
potential: LammpsPotentialData,
structure: orm.StructureData,
trajectory_filename: str = "aiida_lampps.trajectory.dump",
trajectory_filename: str = "aiida_lammps.trajectory.dump",
restart_filename: str = "lammps.restart",
potential_filename: str = "potential.dat",
structure_filename: str = "structure.dat",
Expand All @@ -45,14 +45,14 @@ def generate_input_file(
command is used to overwrite the structure and set the velocity and
other parameters from a previous calculation.
:param parameters: calculation paramters used to control the LAMMPS calculation
:param parameters: calculation parameters used to control the LAMMPS calculation
:type parameters: dict
:param potential: potential used during the LAMMPS calculation
:type potential: LammpsPotentialData
:param structure: structure used during the LAMMPS calculation
:type structure: orm.StructureData
:param trajectory_filename: filename used to write the trajectory information,
defaults to 'aiida_lampps.trajectory.dump'
defaults to 'aiida_lammps.trajectory.dump'
:type trajectory_filename: str, optional
:param restart_filename: filename used to write the restart information,
defaults to 'restart.aiida'
Expand Down Expand Up @@ -973,7 +973,7 @@ def generate_id_tag(name: str = None, group: str = None) -> str:
"""Generate an id tag for fixes and/or computes.
To standardize the naming of computes and/or fixes and to ensure that one
can programatically recreate them their name will consist of the name of the fix/compute
can programmatically recreate them their name will consist of the name of the fix/compute
with the group at which is applied appended plus the aiida keyword. Of this
way one can always regenerate these tags by knowing which fix/computes
were asked of the calculation.
Expand Down
39 changes: 39 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source

.PHONY: all help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext customdefault

customdefault:
$(SPHINXBUILD) -b html -nW --keep-going $(ALLSPHINXOPTS) $(BUILDDIR)/html

all: clean html view

clean:
rm -rf $(BUILDDIR)
rm -rf $(shell find . -type d -wholename "*/reference/api/auto")

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

view:
open $(BUILDDIR)/html/index.html
130 changes: 130 additions & 0 deletions docs/source/_static/aiida-custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/* Fix CSS of top bar link icons */
a.nav-link.nav-external i {
padding-left: 0.3em !important;
font-size: inherit !important;
vertical-align: inherit !important;
}
/* Current fix for https://github.com/pandas-dev/pydata-sphinx-theme/issues/193 */
dl.field-list {
display: grid;
grid-template-columns: fit-content(30%) minmax(0, 1fr);
}
/* For icon unicodes see https://fontawesome.com/v4.7.0/icons/ */
.title-icon-rocket .admonition-title:before {
margin-right:.5rem;
content: "\f135"
}
.title-icon-info-circle .admonition-title:before {
margin-right:.5rem;
content: "\f05a"
}
.title-icon-question-circle .admonition-title:before {
margin-right:.5rem;
content: "\f059"
}
.title-icon-download .admonition-title:before {
margin-right:.5rem;
content: "\f019"
}
.title-icon-external-link .admonition-title:before {
margin-right:.5rem;
content: "\f08e"
}
.title-icon-lightbulb .admonition-title:before {
margin-right:.5rem;
content: "\f0eb"
}
.title-icon-wrench .admonition-title:before {
margin-right:.5rem;
content: "\f0ad"
}
.title-icon-cog .admonition-title:before {
margin-right:.5rem;
content: "\f013"
}
.title-icon-cogs .admonition-title:before {
margin-right:.5rem;
content: "\f085"
}
.title-icon-code-fork .admonition-title:before {
margin-right:.5rem;
content: "\f126"
}
/* Semantic icon names */
.title-icon-launch-software .admonition-title:before {
margin-right:.5rem;
content: "\f135" /* rocket */
}
.title-icon-install-software .admonition-title:before {
margin-right:.5rem;
content: "\f019" /* download */
}
.title-icon-information .admonition-title:before {
margin-right:.5rem;
content: "\f05a" /* info-circle */
}
.title-icon-tip .admonition-title:before {
margin-right:.5rem;
content: "\f0eb" /* lightbulb */
}
.title-icon-important .admonition-title:before {
margin-right:.5rem;
content: "\f06a" /* exclamation-circle */
}
.title-icon-warning .admonition-title:before {
margin-right:.5rem;
content: "\f071" /* exclamation-triangle */
}
.title-icon-troubleshoot .admonition-title:before {
margin-right:.5rem;
content: "\f0ad" /* wrench */
}
.title-icon-read-more .admonition-title:before {
margin-right:.5rem;
content: "\f518" /* external-link */
}

.dropdown-group .dropdown .summary-title {
border-bottom: 0 !important;
font-weight:700 !important;
}
.dropdown-group .dropdown:not(:last-child) {
margin-bottom: 0 !important;
border-radius: 0 !important;
}
.dropdown-group .dropdown:first-child,
.dropdown-group .dropdown:first-child .summary-title {
border-radius: 1rem 1rem 0rem 0rem !important;
}
.dropdown-group .dropdown:last-child,
.dropdown-group .dropdown:last-child .summary-title {
border-radius: 0rem 0rem 1rem 1rem !important;
}

.dropdown-group .dropdown:last-child {
margin-bottom: 24px !important;
}

div.admonition :last-child {
margin-bottom: 0
}

div.highlight-bash div.highlight {
background-color: aliceblue;
}

div.highlight-console div.highlight {
background-color: aliceblue;
}

.aiida-green {
color: #32B805;
}

.aiida-blue {
color: #0496DE;
}

.aiida-orange {
color: #FF7D16;
}
58 changes: 58 additions & 0 deletions docs/source/_static/aiida-lammps-custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.logo-table td {
padding: 20px 10px;
}

.center {
text-align: center;
max-width: 90%;
}

.bigfont {
font-size: 140%;
}

.navbar-brand {
padding: 0;
padding-top: 0.5rem;
}

img.logo__image {
max-height: 180px;
padding-left: 1.5rem;
padding-bottom: 1rem;
}

.navbar-icon-links i.fa-brands {
font-size: 40px!important;
}

img.aiida-sidebar-logo {
height: 40px!important;
}

img.aiida-logo {
width: 20px;
padding-bottom: 3px;
}

.fa {
color: var(--pst-color-primary);
}

.bd-search {
padding: 0 1rem;
}

.tutor-footer {
padding-top: 0rem;
border-top: none!important;
}

.footer-table {
margin-bottom: 0rem;
border-color: transparent;
}

.footer-table td:last-child {
text-align: right;
}
File renamed without changes
File renamed without changes.
5 changes: 5 additions & 0 deletions docs/source/_static/logo_aiida.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions docs/source/_templates/icon-links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{%- macro icon_link_nav_item(url, icon, name, type, attributes='') -%}
{%- if url | length > 2 %}
<li class="nav-item">
{%- set attributesDefault = { "href": url, "title": name, "class": "nav-link", "rel": "noopener", "target": "_blank", "data-bs-toggle": "tooltip", "data-bs-placement": "bottom"} %}
{%- if attributes %}{% for key, val in attributes.items() %}
{% set _ = attributesDefault.update(attributes) %}
{% endfor %}{% endif -%}
{% set attributeString = [] %}
{% for key, val in attributesDefault.items() %}
{%- set _ = attributeString.append('%s="%s"' % (key, val)) %}
{% endfor %}
{% set attributeString = attributeString | join(" ") -%}
<a {{ attributeString }}>
{%- if type == "fontawesome" -%}
<span><i class="{{ icon }} fa-lg" aria-hidden="true"></i></span>
<span class="sr-only">{{ name }}</span>
{%- elif type == "local" -%}
<img src="{{ pathto(icon, 1) }}" class="icon-link-image" alt="{{ name }}"/>
{%- elif type == "url" -%}
<img src="{{ icon }}" class="icon-link-image" alt="{{ name }}"/>
{%- else %}
<span>Incorrectly configured icon link. Type must be `fontawesome`, `url` or `local`.</span>
{%- endif -%}
</a>
</li>
{%- endif -%}
{%- endmacro -%}
{%- if theme_icon_links -%}
<ul class="navbar-icon-links navbar-nav"
aria-label="{{ theme_icon_links_label }}">
<li class="nav-item">
<a href="https://aiida.net/">
<img src="{{ pathto('_static/logo_aiida.svg', 1) }}" alt="AiiDA" class="aiida-sidebar-logo">
</a>
</li>
{%- for icon_link in theme_icon_links -%}
{{ icon_link_nav_item(icon_link["url"], icon_link["icon"], icon_link["name"], icon_link.get("type", "fontawesome"), icon_link.get("attributes", {})) -}}
{%- endfor %}
</ul>
{%- endif -%}
24 changes: 24 additions & 0 deletions docs/source/_templates/sbt-sidebar-nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<nav class="bd-links" id="bd-docs-nav" aria-label="Main">
<div class="bd-toc-item navbar-nav active">
{% if theme_home_page_in_toc == True %}
{#- This mimicks the pydata theme list style so we can append an extra item at the top #}
<ul class="nav bd-sidenav bd-sidenav__home-link">
<li class="toctree-l1{% if pagename == root_doc %} current active{% endif %}">
<a class="reference internal" href="{{ pathto(root_doc) }}">
{{ root_title }}
</a>
</li>
</ul>
{% endif -%}

{# Ref: https://github.com/pydata/pydata-sphinx-theme/blob/ebf7f704879a1cdc6016d6111062103353ac7677/src/pydata_sphinx_theme/__init__.py#L302 #}
{{- generate_toctree_html(
startdepth=0,
kind="sidebar",
maxdepth=2,
collapse=False,
includehidden=True,
titles_only=True,
show_nav_level=theme_show_navbar_depth) }}
</div>
</nav>
Loading

0 comments on commit 076ca75

Please sign in to comment.