Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
utf committed Jul 18, 2024
1 parent 0291106 commit 7d3e43b
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 134 deletions.
4 changes: 2 additions & 2 deletions docs/about/license.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
License
=======
# License

`atomate2` is developed under a modified BSD license, reproduced below:

Expand Down Expand Up @@ -51,3 +50,4 @@ modify, prepare derivative works, incorporate into other computer
software, distribute, and sublicense such enhancements or derivative
works thereof, in binary and source code form.
```

7 changes: 3 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
napoleon_use_ivar = True

# The suffix(es) of source filenames.
source_suffix = [".rst", ".md"]
source_suffix = {'.rst': 'restructuredtext', '.md': 'restructuredtext'}

mathjax3_config = {
"tex": {
Expand All @@ -92,10 +92,10 @@
"""
}
language = "en"
html_extra_path = ["images/badge.svg"]
#html_extra_path = ["images/badge.svg"]
html_static_path = ["_static"]
html_css_files = ["custom.css", "github.css"]
suppress_warnings = "etoc.toctree"
suppress_warnings = ["etoc.toctree"]

# autodoc options
autosummary_imported_members = False
Expand Down Expand Up @@ -172,6 +172,5 @@
"python": ("https://docs.python.org/3.8", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"networkx": ("https://networkx.org/documentation/stable/", None),
"monty": ("https://materialsvirtuallab.github.io/monty/", None),
"jobflow": ("https://materialsproject.github.io/jobflow", None),
}
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ user/index
user/install
user/running-workflows
user/fireworks
user/atomate-1-vs-2
user/codes/index
```

Expand All @@ -20,6 +21,7 @@ reference/index
dev/dev_install
dev/workflow_tutorial
dev/vasp_tests
dev/abinit_tests
```

```{toctree}
Expand Down
2 changes: 1 addition & 1 deletion docs/user/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ This is the command that you would use to run VASP with parallelization

The directory structure of `<<INSTALL_DIR>>/config` should now look like

```txt
```
config
├── jobflow.yaml
└── atomate2.yaml
Expand Down
5 changes: 1 addition & 4 deletions src/atomate2/amset/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
amset = None


if TYPE_CHECKING:
from typing_extensions import Self

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -147,7 +144,7 @@ def from_directory(
dir_name: Union[Path, str],
additional_fields: dict[str, Any] = None,
include_mesh: bool = False,
) -> Self:
):
"""Create a task document from a directory containing VASP files.
Parameters
Expand Down
50 changes: 27 additions & 23 deletions src/atomate2/common/flows/defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class FormationEnergyMaker(Maker, ABC):
lattice relaxation, you should manually set the grid size.
.. code-block:: python
relax_set = MPRelaxSet(defect.get_supercell_structure())
ng, ngf = relax_set.calculate_ng()
params = ["NGX", "NGY", "NGZ", "NGXF", "NGYF", "NGZF"]
Expand Down Expand Up @@ -217,32 +218,35 @@ class FormationEnergyMaker(Maker, ABC):
energy diagrams.
.. note::
Once we remove the requirement for explicit bulk supercell calculations,
this setting will be removed. It is only needed because the bulk supercell
locpot is currently needed for the finite-size correction calculation.
Once we remove the requirement for explicit bulk supercell calculations,
this setting will be removed. It is only needed because the bulk supercell
locpot is currently needed for the finite-size correction calculation.
Output format for the DefectEntry data:
.. code-block:: python
[
{
'bulk_dir_name': 'computer1:/folder1',
'bulk_locpot': {...},
'bulk_uuid': '48fb6da7-dc2b-4dcb-b1c8-1203c0f72ce3',
'defect_dir_name': 'computer1:/folder2',
'defect_entry': {...},
'defect_locpot': {...},
'defect_uuid': 'e9af2725-d63c-49b8-a01f-391540211750'
},
{
'bulk_dir_name': 'computer1:/folder3',
'bulk_locpot': {...},
'bulk_uuid': '48fb6da7-dc2b-4dcb-b1c8-1203c0f72ce3',
'defect_dir_name': 'computer1:/folder4',
'defect_entry': {...},
'defect_locpot': {...},
'defect_uuid': 'a1c31095-0494-4eed-9862-95311f80a993'
}
]
[
{
'bulk_dir_name': 'computer1:/folder1',
'bulk_locpot': {...},
'bulk_uuid': '48fb6da7-dc2b-4dcb-b1c8-1203c0f72ce3',
'defect_dir_name': 'computer1:/folder2',
'defect_entry': {...},
'defect_locpot': {...},
'defect_uuid': 'e9af2725-d63c-49b8-a01f-391540211750'
},
{
'bulk_dir_name': 'computer1:/folder3',
'bulk_locpot': {...},
'bulk_uuid': '48fb6da7-dc2b-4dcb-b1c8-1203c0f72ce3',
'defect_dir_name': 'computer1:/folder4',
'defect_entry': {...},
'defect_locpot': {...},
'defect_uuid': 'a1c31095-0494-4eed-9862-95311f80a993'
}
]
"""

defect_relax_maker: Maker
Expand Down
118 changes: 71 additions & 47 deletions src/atomate2/common/jobs/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class EOSPostProcessor(MSONable):
"""
Fit data to an EOS.
Parameters
----------
name : str
Name of the class
eos_attrs : tuple[str,...]
Expand Down Expand Up @@ -72,16 +74,19 @@ def fit(self, eos_flow_output: dict[str, Any]) -> None:
Parameters
----------
eos_flow_output : dict
Volume, energy, and (optionally) stress and pressure data in dict form,
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
Volume, energy, and (optionally) stress and pressure data in dict
form::
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
"""
self.results.update(eos_flow_output)
self._use_job_types = [key for key in self.job_types if self.results.get(key)]
Expand All @@ -103,16 +108,19 @@ def make(self, eos_flow_output: dict[str, Any]) -> Job:
Parameters
----------
eos_flow_output : dict
Volume, energy, and (optionally) stress and pressure data in dict form,
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
Volume, energy, and (optionally) stress and pressure data in dict
form::
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
"""
self.fit(eos_flow_output)
return self.results
Expand All @@ -125,16 +133,19 @@ class PostProcessEosEnergy(EOSPostProcessor):
Parameters
----------
eos_flow_output : dict
Volume, energy, and (optionally) stress and pressure data in dict form,
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
Volume, energy, and (optionally) stress and pressure data in dict
form::
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
name : str
Name of the class
eos_attrs : tuple[str,...]
Expand All @@ -158,7 +169,7 @@ class PostProcessEosEnergy(EOSPostProcessor):
)

def eval(self) -> None:
"""Fit the input data to each EOS in `self.eos_models."""
"""Fit the input data to each EOS in ``self.eos_models``."""
for jobtype in self._use_job_types:
self.results[jobtype]["EOS"] = {}
for eos_name in self.eos_models:
Expand All @@ -181,16 +192,19 @@ class PostProcessEosPressure(EOSPostProcessor):
Parameters
----------
eos_flow_output : dict
Volume, energy, and (optionally) stress and pressure data in dict form,
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
Volume, energy, and (optionally) stress and pressure data in dict
form::
{
"relax" <required> and "static" <optional> : {
"energy": list, <required>
"volume": list, <required>
"stress": list <optional>
},
"initial_<key>": {"E0": float, "V0": float} <optional>,
for <key> in ("relax", "static")
}
name : str
Name of the class
eos_attrs : tuple[str,...]
Expand All @@ -201,8 +215,10 @@ class PostProcessEosPressure(EOSPostProcessor):
Minimum number of data points needed to perform a fit.
If only stresses are specified, it is assumed that the elements of "stress"
are 3 x 3 tensors, and the pressure is computed as
are 3 x 3 tensors, and the pressure is computed as::
pressure = Trace(stress tensor)/3
The overall sign is irrelevant for a successful fit, as the overall sign
of the pressure indicates internal/external stress.
"""
Expand Down Expand Up @@ -232,14 +248,18 @@ def _birch_murnaghan_pressure(
-------
float : the BM pressure
BM EOS for E(V) has the form
BM EOS for E(V) has the form::
E(V) = E0 + 9 B0 V0 / 16 * (
(B1 - 4)*eta**6 + (14 - 3*B1)*eta**4 + (3*B1 - 16)*eta**2 + 6 - B1
)
eta = (V0/V)**(1/3).
This function computes p = - dE / dV via the chain rule,
This function computes p = - dE / dV via the chain rule,::
p = d E / d eta * (- d eta / dV)
= eta**4/(3*V0) * d E / d eta
"""
eta = (v0 / volume) ** (1.0 / 3.0)
return (
Expand All @@ -253,7 +273,8 @@ def _birch_murnaghan_pressure(
def _initial_fit(self) -> dict:
"""Generate initial polynomial fit for p(V) curve.
p(V) / V = a + b V + c V**2
::
p(V) / V = a + b V + c V**2
"""
init_pars = {}
for jobtype in self._use_job_types:
Expand Down Expand Up @@ -337,9 +358,12 @@ def apply_strain_to_structure(structure: Structure, deformations: list) -> list:
deformations: list[.Deformation]
A list of deformations to apply **independently** to the input
structure, in anticipation of performing an EOS fit.
Deformations should be of the form of a 3x3 matrix, e.g.,
Deformations should be of the form of a 3x3 matrix, e.g.,::
[[1.2, 0., 0.], [0., 1.2, 0.], [0., 0., 1.2]]
or
or::
((1.2, 0., 0.), (0., 1.2, 0.), (0., 0., 1.2))
Returns
Expand Down
10 changes: 6 additions & 4 deletions src/atomate2/common/schemas/magnetism.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,12 @@ def from_outputs(
def from_tasks(cls, tasks: list[dict]) -> MagneticOrderingsDocument:
"""Construct a MagneticOrderingsDocument from a list of task dicts.
.. Note:: this function assumes the tasks contain the keys "output" and
"metadata". These keys are automatically constructed when jobflow stores its
outputs; however, you may need to put the data in this format if using this
manually (as in a postprocessing job).
.. Note::
this function assumes the tasks contain the keys "output" and "metadata".
These keys are automatically constructed when jobflow stores its outputs;
however, you may need to put the data in this format if using this
manually (as in a postprocessing job).
"""
parent_structure = tasks[0]["metadata"]["parent_structure"]

Expand Down
4 changes: 2 additions & 2 deletions src/atomate2/lobster/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ class LobsterTaskDocument(StructureMetadata, extra="allow"): # type: ignore[cal
@classmethod
@requires(
Analysis,
"LobsterTaskDocument requires `lobsterpy` and `ijson` to function properly. "
"LobsterTaskDocument requires lobsterpy and ijson to function properly. "
"Please reinstall atomate2 using atomate2[lobster]",
)
def from_directory(
Expand Down Expand Up @@ -1320,7 +1320,7 @@ def read_saved_json(
filename: str, pymatgen_objs: bool = True, query: str = "structure"
) -> dict[str, Any]:
"""
Read the data from *.json.gz file corresponding to query.
Read the data from \*.json.gz files corresponding to query.
Uses ijson to parse specific keys(memory efficient)
Expand Down
Loading

0 comments on commit 7d3e43b

Please sign in to comment.