From e083fdc797e01a7bb663785144efb4090733f0b3 Mon Sep 17 00:00:00 2001 From: ElliottKasoar <45317199+ElliottKasoar@users.noreply.github.com> Date: Thu, 31 Oct 2024 06:22:22 +0000 Subject: [PATCH] Update docs (#340) * Fix documentation link * Update type hints --- docs/source/developer_guide/get_started.rst | 2 +- janus_core/calculations/md.py | 6 +++--- janus_core/cli/descriptors.py | 2 +- janus_core/cli/eos.py | 2 +- janus_core/cli/geomopt.py | 2 +- janus_core/cli/md.py | 2 +- janus_core/cli/phonons.py | 2 +- janus_core/cli/singlepoint.py | 2 +- janus_core/cli/train.py | 2 +- janus_core/cli/types.py | 4 ++-- janus_core/helpers/correlator.py | 10 +++++----- janus_core/helpers/observables.py | 2 +- janus_core/helpers/utils.py | 6 +++--- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docs/source/developer_guide/get_started.rst b/docs/source/developer_guide/get_started.rst index 0995dd49..725d161e 100644 --- a/docs/source/developer_guide/get_started.rst +++ b/docs/source/developer_guide/get_started.rst @@ -64,7 +64,7 @@ Rules enforced by ruff are currently set up to be comparable to: - `isort `_ (import sorter) - `flake8-bugbear `_ (bug finder) -The full set of `ruff rules `_ are specified by the ``[tool.ruff]]`` sections of `pyproject.toml ` +The full set of `ruff rules `_ are specified by the ``[tool.ruff]`` sections of `pyproject.toml `_. Building the documentation diff --git a/janus_core/calculations/md.py b/janus_core/calculations/md.py index 026d7adf..673b7b78 100644 --- a/janus_core/calculations/md.py +++ b/janus_core/calculations/md.py @@ -509,7 +509,7 @@ def __init__( self._parse_correlations() - def _set_info(self): + def _set_info(self) -> None: """Set time in fs, current dynamics step, and density to info.""" time = (self.offset * self.timestep + self.dyn.get_time()) / units.fs step = self.offset + self.dyn.nsteps @@ -631,7 +631,7 @@ def _optimize_structure(self) -> None: optimizer = GeomOpt(self.struct, **self.minimize_kwargs) optimizer.run() - def _set_param_prefix(self, file_prefix: Optional[PathLike] = None): + def _set_param_prefix(self, file_prefix: Optional[PathLike] = None) -> str: """ Set ensemble parameters for output files. @@ -1205,7 +1205,7 @@ def __init__( **ensemble_kwargs, ) - def _set_param_prefix(self, file_prefix: Optional[PathLike] = None): + def _set_param_prefix(self, file_prefix: Optional[PathLike] = None) -> str: """ Set ensemble parameters for output files. diff --git a/janus_core/cli/descriptors.py b/janus_core/cli/descriptors.py index 30343d03..fd9e062c 100644 --- a/janus_core/cli/descriptors.py +++ b/janus_core/cli/descriptors.py @@ -57,7 +57,7 @@ def descriptors( write_kwargs: WriteKwargs = None, log: LogPath = None, summary: Summary = None, -): +) -> None: """ Calculate MLIP descriptors for the given structure(s). diff --git a/janus_core/cli/eos.py b/janus_core/cli/eos.py index 6f2a8aa2..09fd3025 100644 --- a/janus_core/cli/eos.py +++ b/janus_core/cli/eos.py @@ -73,7 +73,7 @@ def eos( ] = None, log: LogPath = None, summary: Summary = None, -): +) -> None: """ Calculate equation of state and write out results. diff --git a/janus_core/cli/geomopt.py b/janus_core/cli/geomopt.py index c072c80c..e80020e2 100644 --- a/janus_core/cli/geomopt.py +++ b/janus_core/cli/geomopt.py @@ -147,7 +147,7 @@ def geomopt( write_kwargs: WriteKwargs = None, log: LogPath = None, summary: Summary = None, -): +) -> None: """ Perform geometry optimization and save optimized structure to file. diff --git a/janus_core/cli/md.py b/janus_core/cli/md.py index df6897c1..804eb883 100644 --- a/janus_core/cli/md.py +++ b/janus_core/cli/md.py @@ -171,7 +171,7 @@ def md( ] = None, log: LogPath = None, summary: Summary = None, -): +) -> None: """ Run molecular dynamics simulation, and save trajectory and statistics. diff --git a/janus_core/cli/phonons.py b/janus_core/cli/phonons.py index a6163de6..9e7bad7e 100644 --- a/janus_core/cli/phonons.py +++ b/janus_core/cli/phonons.py @@ -101,7 +101,7 @@ def phonons( ] = None, log: LogPath = None, summary: Summary = None, -): +) -> None: """ Perform phonon calculations and write out results. diff --git a/janus_core/cli/singlepoint.py b/janus_core/cli/singlepoint.py index dc298e53..6f26a5bc 100644 --- a/janus_core/cli/singlepoint.py +++ b/janus_core/cli/singlepoint.py @@ -54,7 +54,7 @@ def singlepoint( write_kwargs: WriteKwargs = None, log: LogPath = None, summary: Summary = None, -): +) -> None: """ Perform single point calculations and save to file. diff --git a/janus_core/cli/train.py b/janus_core/cli/train.py index 63d694c2..51c5caef 100644 --- a/janus_core/cli/train.py +++ b/janus_core/cli/train.py @@ -26,7 +26,7 @@ def train( ) ), ] = Path("train-summary.yml"), -): +) -> None: """ Run training for MLIP by passing a configuration file to the MLIP's CLI. diff --git a/janus_core/cli/types.py b/janus_core/cli/types.py index 55ba52ef..31143a94 100644 --- a/janus_core/cli/types.py +++ b/janus_core/cli/types.py @@ -41,7 +41,7 @@ class TyperDict: Value of string representing a dictionary. """ - def __init__(self, value: str): + def __init__(self, value: str) -> None: """ Initialise class. @@ -52,7 +52,7 @@ def __init__(self, value: str): """ self.value = value - def __str__(self): + def __str__(self) -> str: """ Return string representation of class. diff --git a/janus_core/helpers/correlator.py b/janus_core/helpers/correlator.py index 7acf192e..f38e1241 100644 --- a/janus_core/helpers/correlator.py +++ b/janus_core/helpers/correlator.py @@ -23,7 +23,7 @@ class Correlator: Averaging window per block level. """ - def __init__(self, *, blocks: int, points: int, averaging: int): + def __init__(self, *, blocks: int, points: int, averaging: int) -> None: """ Initialise an empty Correlator. @@ -50,7 +50,7 @@ def __init__(self, *, blocks: int, points: int, averaging: int): self._correlation = np.zeros((self._blocks, self._points)) self._count_correlated = np.zeros((self._blocks, self._points), dtype=int) - def update(self, a: float, b: float): + def update(self, a: float, b: float) -> None: """ Update the correlation, , with new values a and b. @@ -63,7 +63,7 @@ def update(self, a: float, b: float): """ self._propagate(a, b, 0) - def _propagate(self, a: float, b: float, block: int): + def _propagate(self, a: float, b: float, block: int) -> None: """ Propagate update down block hierarchy. @@ -203,7 +203,7 @@ def __init__( points: int, averaging: int, update_frequency: int, - ): + ) -> None: """ Initialise a correlation. @@ -252,7 +252,7 @@ def update_frequency(self) -> int: """ return self._update_frequency - def update(self, atoms: Atoms): + def update(self, atoms: Atoms) -> None: """ Update a correlation. diff --git a/janus_core/helpers/observables.py b/janus_core/helpers/observables.py index c18eedbf..daec7840 100644 --- a/janus_core/helpers/observables.py +++ b/janus_core/helpers/observables.py @@ -15,7 +15,7 @@ class Stress: Calculate with the ideal gas contribution. """ - def __init__(self, component: str, *, include_ideal_gas: bool = True): + def __init__(self, component: str, *, include_ideal_gas: bool = True) -> None: """ Initialise the observables from a symbolic str component. diff --git a/janus_core/helpers/utils.py b/janus_core/helpers/utils.py index 3573465c..06cf53f0 100644 --- a/janus_core/helpers/utils.py +++ b/janus_core/helpers/utils.py @@ -67,7 +67,7 @@ def __init__( struct_path: Optional[PathLike], file_prefix: Optional[PathLike], *additional, - ): + ) -> None: """ Provide mixin functions for standard filename handling. @@ -643,7 +643,7 @@ def _dump_ascii( header: list[str], columns: dict[str, Sequence[Any]], formats: Sequence[str], -): +) -> None: """ Dump data as an ASCII style table. @@ -675,7 +675,7 @@ def _dump_csv( header: list[str], columns: dict[str, Sequence[Any]], formats: Sequence[str], -): +) -> None: """ Dump data as a csv style table.