From 8ceeefe32ea92b5bad3baa6d1591e26983ddba5c Mon Sep 17 00:00:00 2001 From: Jacob Wilkins Date: Fri, 8 Nov 2024 14:15:07 +0000 Subject: [PATCH 1/2] Add autodoc typehints module --- docs/source/conf.py | 3 +++ janus_core/cli/types.py | 18 +++++++++--------- pyproject.toml | 1 + 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 1ca0dcbb..faa20498 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -31,8 +31,11 @@ "sphinx.ext.viewcode", "sphinxcontrib.contentui", "sphinx_copybutton", + "sphinx_autodoc_typehints", ] +always_use_bars_union = True + numpydoc_validation_checks = {"all", "EX01", "SA01", "ES01"} numpydoc_validation_exclude = { r"\.__weakref__$", diff --git a/janus_core/cli/types.py b/janus_core/cli/types.py index 31143a94..ab00c252 100644 --- a/janus_core/cli/types.py +++ b/janus_core/cli/types.py @@ -79,7 +79,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to ase.io.read. Must be passed as a dictionary - wrapped in quotes, e.g. "{'key' : value}". By default, + wrapped in quotes, e.g. "{'key': value}". By default, read_kwargs['index'] = ':', so all structures are read. """ ), @@ -94,7 +94,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to ase.io.read. Must be passed as a dictionary - wrapped in quotes, e.g. "{'key' : value}". By default, + wrapped in quotes, e.g. "{'key': value}". By default, read_kwargs['index'] = -1, so only the last structure is read. """ ), @@ -109,8 +109,8 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to selected calculator. Must be passed as a - dictionary wrapped in quotes, e.g. "{'key' : value}". For the default - architecture ('mace_mp'), "{'model':'small'}" is set unless overwritten. + dictionary wrapped in quotes, e.g. "{'key': value}". For the default + architecture ('mace_mp'), "{'model': 'small'}" is set unless overwritten. """ ), metavar="DICT", @@ -124,7 +124,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to ase.io.write when saving results. Must be - passed as a dictionary wrapped in quotes, e.g. "{'key' : value}". + passed as a dictionary wrapped in quotes, e.g. "{'key': value}". """ ), metavar="DICT", @@ -138,7 +138,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to optimizer. Must be passed as a dictionary - wrapped in quotes, e.g. "{'key' : value}". + wrapped in quotes, e.g. "{'key': value}". """ ), metavar="DICT", @@ -152,7 +152,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to optimizer. Must be passed as a dictionary - wrapped in quotes, e.g. "{'key' : value}". + wrapped in quotes, e.g. "{'key': value}". """ ), metavar="DICT", @@ -166,7 +166,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to ensemble initialization. Must be passed as a - dictionary wrapped in quotes, e.g. "{'key' : value}". + dictionary wrapped in quotes, e.g. "{'key': value}". """ ), metavar="DICT", @@ -180,7 +180,7 @@ def __str__(self) -> str: help=( """ Keyword arguments to pass to post-processer. Must be passed as a dictionary - wrapped in quotes, e.g. "{'key' : value}". + wrapped in quotes, e.g. "{'key': value}". """ ), metavar="DICT", diff --git a/pyproject.toml b/pyproject.toml index 5beba1b3..ec485ab6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,7 @@ sphinx = "^7.2.6" sphinxcontrib-contentui = "^0.2.5" sphinxcontrib-details-directive = "^0.1" sphinx-copybutton = "^0.5.2" +sphinx-autodoc-typehints = "^2.5.0" [build-system] requires = ["poetry-core"] From 58994528840a0f1cd87e838ab992f0787a3bc27d Mon Sep 17 00:00:00 2001 From: Jacob Wilkins Date: Fri, 8 Nov 2024 14:41:12 +0000 Subject: [PATCH 2/2] Remove doc typehints in favour of signature --- docs/source/conf.py | 8 +- janus_core/calculations/base.py | 72 +++--- janus_core/calculations/descriptors.py | 75 +++--- janus_core/calculations/eos.py | 113 +++++---- janus_core/calculations/geom_opt.py | 103 ++++---- janus_core/calculations/md.py | 307 +++++++++++------------- janus_core/calculations/phonons.py | 195 +++++++-------- janus_core/calculations/single_point.py | 71 +++--- janus_core/cli/descriptors.py | 32 +-- janus_core/cli/eos.py | 46 ++-- janus_core/cli/geomopt.py | 56 ++--- janus_core/cli/janus.py | 2 +- janus_core/cli/md.py | 98 ++++---- janus_core/cli/phonons.py | 58 ++--- janus_core/cli/singlepoint.py | 28 +-- janus_core/cli/train.py | 10 +- janus_core/cli/types.py | 6 +- janus_core/cli/utils.py | 46 ++-- janus_core/helpers/janus_types.py | 6 +- janus_core/helpers/log.py | 39 ++- janus_core/helpers/mlip_calculators.py | 14 +- janus_core/helpers/stats.py | 8 +- janus_core/helpers/struct_io.py | 50 ++-- janus_core/helpers/utils.py | 70 +++--- janus_core/processing/correlator.py | 66 ++--- janus_core/processing/observables.py | 14 +- janus_core/processing/post_process.py | 38 +-- janus_core/processing/symmetry.py | 10 +- janus_core/training/train.py | 16 +- 29 files changed, 787 insertions(+), 870 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index faa20498..0a0889b5 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,9 +24,10 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - "numpydoc", + # "numpydoc", "sphinx.ext.autodoc", "sphinx.ext.intersphinx", + "sphinx.ext.napoleon", "sphinx.ext.mathjax", "sphinx.ext.viewcode", "sphinxcontrib.contentui", @@ -35,8 +36,10 @@ ] always_use_bars_union = True +napoleon_include_special_with_doc = True +napoleon_use_param = True -numpydoc_validation_checks = {"all", "EX01", "SA01", "ES01"} +numpydoc_validation_checks = {"all", "EX01", "SA01", "ES01", "PR04"} numpydoc_validation_exclude = { r"\.__weakref__$", r"\.__repr__$", @@ -193,6 +196,7 @@ # Warnings to ignore when using the -n (nitpicky) option # We should ignore any python built-in exception, for instance +nitpicky = True nitpick_ignore = [ ("py:class", "Logger"), ("py:class", "numpy.float64"), diff --git a/janus_core/calculations/base.py b/janus_core/calculations/base.py index 0797b1db..b319081f 100644 --- a/janus_core/calculations/base.py +++ b/janus_core/calculations/base.py @@ -24,48 +24,48 @@ class BaseCalculation(FileNameMixin): Parameters ---------- - calc_name : str + calc_name Name of calculation being run, used for name of logger. Default is "base". - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs + read_kwargs Keyword arguments to pass to ase.io.read. Default is {}. - sequence_allowed : bool + sequence_allowed Whether a sequence of Atoms objects is allowed. Default is True. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is None. - additional_prefix : str | None + additional_prefix Component to add to default file_prefix (joined by hyphens). Default is None. - param_prefix : str | None + param_prefix Additional parameters to add to default file_prefix. Default is None. Attributes ---------- - logger : logging.Logger | None + logger Logger if log file has been specified. - tracker : OfflineEmissionsTracker | None + tracker Tracker if logging is enabled. """ @@ -95,42 +95,42 @@ def __init__( Parameters ---------- - calc_name : str + calc_name Name of calculation being run, used for name of logger. Default is "base". - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. Default is {}. - sequence_allowed : bool + sequence_allowed Whether a sequence of Atoms objects is allowed. Default is True. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is None. - additional_prefix : str | None + additional_prefix Component to add to default file_prefix (joined by hyphens). Default is None. - param_prefix : str | None + param_prefix Additional parameters to add to default file_prefix. Default is None. """ (read_kwargs, calc_kwargs, log_kwargs, tracker_kwargs) = none_to_dict( diff --git a/janus_core/calculations/descriptors.py b/janus_core/calculations/descriptors.py index f8fa98ad..91f2047b 100644 --- a/janus_core/calculations/descriptors.py +++ b/janus_core/calculations/descriptors.py @@ -28,49 +28,44 @@ class Descriptors(BaseCalculation): Parameters ---------- - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to calculate descriptors for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to calculate descriptors for. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - invariants_only : bool + invariants_only Whether only the invariant descriptors should be returned. Default is True. - calc_per_element : bool + calc_per_element Whether to calculate mean descriptors for each element. Default is False. - calc_per_atom : bool + calc_per_atom Whether to calculate descriptors for each atom. Default is False. - write_results : bool + write_results True to write out structure with results of calculations. Default is False. - write_kwargs : ASEWriteArgs | None + write_kwargs Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}. - - Methods - ------- - run() - Calculate descriptors for structure(s) """ def __init__( @@ -98,42 +93,42 @@ def __init__( Parameters ---------- - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to calculate descriptors for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to calculate descriptors for. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - invariants_only : bool + invariants_only Whether only the invariant descriptors should be returned. Default is True. - calc_per_element : bool + calc_per_element Whether to calculate mean descriptors for each element. Default is False. - calc_per_atom : bool + calc_per_atom Whether to calculate descriptors for each atom. Default is False. - write_results : bool + write_results True to write out structure with results of calculations. Default is False. - write_kwargs : ASEWriteArgs | None + write_kwargs Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}. """ @@ -225,7 +220,7 @@ def _calc_descriptors(self, struct: Atoms) -> None: Parameters ---------- - struct : Atoms + struct Structure to calculate descriptors for. """ if "arch" in struct.calc.parameters: diff --git a/janus_core/calculations/eos.py b/janus_core/calculations/eos.py index 09926588..f66e0c31 100644 --- a/janus_core/calculations/eos.py +++ b/janus_core/calculations/eos.py @@ -31,78 +31,73 @@ class EoS(BaseCalculation): Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to calculate equation of state for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to calculate equation of state for. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - min_volume : float + min_volume Minimum volume scale factor. Default is 0.95. - max_volume : float + max_volume Maximum volume scale factor. Default is 1.05. - n_volumes : int + n_volumes Number of volumes to use. Default is 7. - eos_type : EoSNames + eos_type Type of fit for equation of state. Default is "birchmurnaghan". - minimize : bool + minimize Whether to minimize initial structure before calculations. Default is True. - minimize_all : bool + minimize_all Whether to optimize geometry for all generated structures. Default is False. - minimize_kwargs : dict[str, Any] | None + minimize_kwargs Keyword arguments to pass to optimize. Default is None. - write_results : bool + write_results True to write out results of equation of state calculations. Default is True. - write_structures : bool + write_structures True to write out all genereated structures. Default is False. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to ase.io.write to save generated structures. Default is {}. - plot_to_file : bool + plot_to_file Whether to save plot equation of state to svg. Default is False. - plot_kwargs : dict[str, Any] | None + plot_kwargs Keyword arguments to pass to EquationOfState.plot. Default is {}. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure name, or chemical formula of the structure. Attributes ---------- - results : EoSResults + results Dictionary containing equation of state ASE object, and the fitted minimum bulk modulus, volume, and energy. - volumes : list[float] + volumes List of volumes of generated structures. - energies : list[float] + energies List of energies of generated structures. - lattice_scalars : NDArray[float64] + lattice_scalars Lattice scalars of generated structures. - - Methods - ------- - run() - Calculate equation of state. """ def __init__( @@ -138,61 +133,61 @@ def __init__( Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to optimize geometry for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to optimize. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for optimization. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - min_volume : float + min_volume Minimum volume scale factor. Default is 0.95. - max_volume : float + max_volume Maximum volume scale factor. Default is 1.05. - n_volumes : int + n_volumes Number of volumes to use. Default is 7. - eos_type : EoSNames + eos_type Type of fit for equation of state. Default is "birchmurnaghan". - minimize : bool + minimize Whether to minimize initial structure before calculations. Default is True. - minimize_all : bool + minimize_all Whether to optimize geometry for all generated structures. Default is False. - minimize_kwargs : dict[str, Any] | None + minimize_kwargs Keyword arguments to pass to optimize. Default is None. - write_results : bool + write_results True to write out results of equation of state calculations. Default is True. - write_structures : bool + write_structures True to write out all genereated structures. Default is False. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to ase.io.write to save generated structures. Default is {}. - plot_to_file : bool + plot_to_file Whether to save plot equation of state to svg. Default is False. - plot_kwargs : dict[str, Any] | None + plot_kwargs Keyword arguments to pass to EquationOfState.plot. Default is {}. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure name, or chemical formula of the structure. """ diff --git a/janus_core/calculations/geom_opt.py b/janus_core/calculations/geom_opt.py index 170ae3f8..dc7e1f3c 100644 --- a/janus_core/calculations/geom_opt.py +++ b/janus_core/calculations/geom_opt.py @@ -32,69 +32,62 @@ class GeomOpt(BaseCalculation): Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to optimize geometry for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to optimize. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for optimization. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - fmax : float + fmax Set force convergence criteria for optimizer in units eV/Å. Default is 0.1. - steps : int + steps Set maximum number of optimization steps to run. Default is 1000. - symmetrize : bool + symmetrize Whether to refine symmetry after geometry optimization. Default is False. - symmetry_tolerance : float + symmetry_tolerance Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001. - angle_tolerance : float + angle_tolerance Angle precision for spglib symmetry determination, in degrees. Default is -1.0, which means an internally optimized routine is used to judge symmetry. - filter_func : Callable | str | None + filter_func Filter function, or name of function from ase.filters to apply constraints to atoms. Default is `FrechetCellFilter`. - filter_kwargs : dict[str, Any] | None + filter_kwargs Keyword arguments to pass to filter_func. Default is {}. - optimizer : Callable | str + optimizer Optimization function, or name of function from ase.optimize. Default is `LBFGS`. - opt_kwargs : ASEOptArgs | None + opt_kwargs Keyword arguments to pass to optimizer. Default is {}. - write_results : bool + write_results True to write out optimized structure. Default is False. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to ase.io.write to save optimized structure. Default is {}. - traj_kwargs : OutputKwargs | None + traj_kwargs Keyword arguments to pass to ase.io.write to save optimization trajectory. Must include "filename" keyword. Default is {}. - - Methods - ------- - set_optimizer() - Set optimizer for geometry optimization. - run() - Run geometry optimization. """ def __init__( @@ -129,61 +122,61 @@ def __init__( Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to optimize geometry for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to optimize. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for optimization. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - fmax : float + fmax Set force convergence criteria for optimizer in units eV/Å. Default is 0.1. - steps : int + steps Set maximum number of optimization steps to run. Default is 1000. - symmetrize : bool + symmetrize Whether to refine symmetry after geometry optimization. Default is False. - symmetry_tolerance : float + symmetry_tolerance Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001. - angle_tolerance : float + angle_tolerance Angle precision for spglib symmetry determination, in degrees. Default is -1.0, which means an internally optimized routine is used to judge symmetry. - filter_func : Callable | str | None + filter_func Filter function, or name of function from ase.filters to apply constraints to atoms. Default is `FrechetCellFilter`. - filter_kwargs : dict[str, Any] | None + filter_kwargs Keyword arguments to pass to filter_func. Default is {}. - optimizer : Callable | str + optimizer Optimization function, or name of function from ase.optimize. Default is `LBFGS`. - opt_kwargs : ASEOptArgs | None + opt_kwargs Keyword arguments to pass to optimizer. Default is {}. - write_results : bool + write_results True to write out optimized structure. Default is False. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to ase.io.write to save optimized structure. Default is {}. - traj_kwargs : OutputKwargs | None + traj_kwargs Keyword arguments to pass to ase.io.write to save optimization trajectory. Must include "filename" keyword. Default is {}. """ diff --git a/janus_core/calculations/md.py b/janus_core/calculations/md.py index 3b691795..ecde8ea8 100644 --- a/janus_core/calculations/md.py +++ b/janus_core/calculations/md.py @@ -52,127 +52,120 @@ class MolecularDynamics(BaseCalculation): Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for simulation. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - struct : Atoms + struct Structure to simulate. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is None. - steps : int + steps Number of steps in simulation. Default is 0. - timestep : float + timestep Timestep for integrator, in fs. Default is 1.0. - temp : float + temp Temperature, in K. Default is 300. - equil_steps : int + equil_steps Maximum number of steps at which to perform optimization and reset velocities. Default is 0. - minimize : bool + minimize Whether to minimize structure during equilibration. Default is False. - minimize_every : int + minimize_every Frequency of minimizations. Default is -1, which disables minimization after beginning dynamics. - minimize_kwargs : dict[str, Any] | None + minimize_kwargs Keyword arguments to pass to geometry optimizer. Default is {}. - rescale_velocities : bool + rescale_velocities Whether to rescale velocities. Default is False. - remove_rot : bool + remove_rot Whether to remove rotation. Default is False. - rescale_every : int + rescale_every Frequency to rescale velocities. Default is 10. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, and temperature. - restart : bool + restart Whether restarting dynamics. Default is False. - restart_auto : bool + restart_auto Whether to infer restart file name if restarting dynamics. Default is True. - restart_stem : str + restart_stem Stem for restart file name. Default inferred from `file_prefix`. - restart_every : int + restart_every Frequency of steps to save restart info. Default is 1000. - rotate_restart : bool + rotate_restart Whether to rotate restart files. Default is False. - restarts_to_keep : int + restarts_to_keep Restart files to keep if rotating. Default is 4. - final_file : PathLike | None + final_file File to save final configuration at each temperature of similation. Default inferred from `file_prefix`. - stats_file : PathLike | None + stats_file File to save thermodynamical statistics. Default inferred from `file_prefix`. - stats_every : int + stats_every Frequency to output statistics. Default is 100. - traj_file : PathLike | None + traj_file Trajectory file to save. Default inferred from `file_prefix`. - traj_append : bool + traj_append Whether to append trajectory. Default is False. - traj_start : int + traj_start Step to start saving trajectory. Default is 0. - traj_every : int + traj_every Frequency of steps to save trajectory. Default is 100. - temp_start : float | None + temp_start Temperature to start heating, in K. Default is None, which disables heating. - temp_end : float | None + temp_end Maximum temperature for heating, in K. Default is None, which disables heating. - temp_step : float | None + temp_step Size of temperature steps when heating, in K. Default is None, which disables heating. - temp_time : float | None + temp_time Time between heating steps, in fs. Default is None, which disables heating. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to `output_structs` when saving trajectory and final files. Default is {}. - post_process_kwargs : PostProcessKwargs | None + post_process_kwargs Keyword arguments to control post-processing operations. - correlation_kwargs : CorrelationKwargs | None + correlation_kwargs Keyword arguments to control on-the-fly correlations. - seed : int | None + seed Random seed used by numpy.random and random functions, such as in Langevin. Default is None. Attributes ---------- - dyn : Dynamics + dyn Dynamics object to run simulation. - n_atoms : int + n_atoms Number of atoms in structure being simulated. - restart_files : list[PathLike] + restart_files List of files saved to restart dynamics. - offset : int + offset Number of previous steps if restarting simulation. - created_final : bool + created_final Whether the final structure file has been created. - - Methods - ------- - run() - Run molecular dynamics simulation and/or heating ramp. - get_stats() - Get thermodynamical statistics to be written to file. """ def __init__( @@ -228,107 +221,107 @@ def __init__( Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for simulation. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is None. - steps : int + steps Number of steps in simulation. Default is 0. - timestep : float + timestep Timestep for integrator, in fs. Default is 1.0. - temp : float + temp Temperature, in K. Default is 300. - equil_steps : int + equil_steps Maximum number of steps at which to perform optimization and reset velocities. Default is 0. - minimize : bool + minimize Whether to minimize structure during equilibration. Default is False. - minimize_every : int + minimize_every Frequency of minimizations. Default is -1, which disables minimization after beginning dynamics. - minimize_kwargs : dict[str, Any] | None + minimize_kwargs Keyword arguments to pass to geometry optimizer. Default is {}. - rescale_velocities : bool + rescale_velocities Whether to rescale velocities. Default is False. - remove_rot : bool + remove_rot Whether to remove rotation. Default is False. - rescale_every : int + rescale_every Frequency to rescale velocities. Default is 10. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, and temperature. - restart : bool + restart Whether restarting dynamics. Default is False. - restart_auto : bool + restart_auto Whether to infer restart file name if restarting dynamics. Default is True. - restart_stem : str + restart_stem Stem for restart file name. Default inferred from `file_prefix`. - restart_every : int + restart_every Frequency of steps to save restart info. Default is 1000. - rotate_restart : bool + rotate_restart Whether to rotate restart files. Default is False. - restarts_to_keep : int + restarts_to_keep Restart files to keep if rotating. Default is 4. - final_file : PathLike | None + final_file File to save final configuration at each temperature of similation. Default inferred from `file_prefix`. - stats_file : PathLike | None + stats_file File to save thermodynamical statistics. Default inferred from `file_prefix`. - stats_every : int + stats_every Frequency to output statistics. Default is 100. - traj_file : PathLike | None + traj_file Trajectory file to save. Default inferred from `file_prefix`. - traj_append : bool + traj_append Whether to append trajectory. Default is False. - traj_start : int + traj_start Step to start saving trajectory. Default is 0. - traj_every : int + traj_every Frequency of steps to save trajectory. Default is 100. - temp_start : float | None + temp_start Temperature to start heating, in K. Default is None, which disables heating. - temp_end : float | None + temp_end Maximum temperature for heating, in K. Default is None, which disables heating. - temp_step : float | None + temp_step Size of temperature steps when heating, in K. Default is None, which disables heating. - temp_time : float | None + temp_time Time between heating steps, in fs. Default is None, which disables heating. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to `output_structs` when saving trajectory and final files. Default is {}. - post_process_kwargs : PostProcessKwargs | None + post_process_kwargs Keyword arguments to control post-processing operations. - correlation_kwargs : list[CorrelationKwargs] | None + correlation_kwargs Keyword arguments to control on-the-fly correlations. - seed : int | None + seed Random seed used by numpy.random and random functions, such as in Langevin. Default is None. """ @@ -641,7 +634,7 @@ def _set_param_prefix(self, file_prefix: PathLike | None = None) -> str: Parameters ---------- - file_prefix : PathLike | None + file_prefix Prefix for output filenames on class init. If not None, param_prefix = "". Returns @@ -1126,28 +1119,23 @@ class NPT(MolecularDynamics): ---------- *args Additional arguments. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - barostat_time : float + barostat_time Barostat time, in fs. Default is 75.0. - bulk_modulus : float + bulk_modulus Bulk modulus, in GPa. Default is 2.0. - pressure : float + pressure Pressure, in GPa. Default is 0.0. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "npt". - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure. - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. - - Attributes - ---------- - dyn : Dynamics - Configured NPT dynamics. """ def __init__( @@ -1169,20 +1157,20 @@ def __init__( ---------- *args Additional arguments. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - barostat_time : float + barostat_time Barostat time, in fs. Default is 75.0. - bulk_modulus : float + bulk_modulus Bulk modulus, in GPa. Default is 2.0. - pressure : float + pressure Pressure, in GPa. Default is 0.0. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "npt". - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure. - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. @@ -1219,7 +1207,7 @@ def _set_param_prefix(self, file_prefix: PathLike | None = None) -> str: Parameters ---------- - file_prefix : PathLike | None + file_prefix Prefix for output filenames on class init. If not None, param_prefix = "". Returns @@ -1279,19 +1267,14 @@ class NVT(MolecularDynamics): ---------- *args Additional arguments. - friction : float + friction Friction coefficient in fs^-1. Default is 0.005. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nvt". - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. - - Attributes - ---------- - dyn : Dynamics - Configured NVT dynamics. """ def __init__( @@ -1309,11 +1292,11 @@ def __init__( ---------- *args Additional arguments. - friction : float + friction Friction coefficient in fs^-1. Default is 0.005. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nvt". - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. @@ -1376,17 +1359,12 @@ class NVE(MolecularDynamics): ---------- *args Additional arguments. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nve". - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. - - Attributes - ---------- - dyn : Dynamics - Configured NVE dynamics. """ def __init__( @@ -1403,9 +1381,9 @@ def __init__( ---------- *args Additional arguments. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nve". - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. @@ -1429,11 +1407,11 @@ class NVT_NH(NPT): # noqa: N801 (invalid-class-name) ---------- *args Additional arguments. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nvt-nh". - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. @@ -1454,11 +1432,11 @@ def __init__( ---------- *args Additional arguments. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nvt-nh". - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. @@ -1519,26 +1497,21 @@ class NPH(NPT): ---------- *args Additional arguments. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - bulk_modulus : float + bulk_modulus Bulk modulus, in GPa. Default is 2.0. - pressure : float + pressure Pressure, in GPa. Default is 0.0. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nph". - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure. - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. - - Attributes - ---------- - dyn : Dynamics - Configured NVE dynamics. """ def __init__( @@ -1559,18 +1532,18 @@ def __init__( ---------- *args Additional arguments. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - bulk_modulus : float + bulk_modulus Bulk modulus, in GPa. Default is 2.0. - pressure : float + pressure Pressure, in GPa. Default is 0.0. - ensemble : Ensembles + ensemble Name for thermodynamic ensemble. Default is "nph". - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure. - ensemble_kwargs : dict[str, Any] | None + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. **kwargs Additional keyword arguments. diff --git a/janus_core/calculations/phonons.py b/janus_core/calculations/phonons.py index b69c5ed6..b53a97ac 100644 --- a/janus_core/calculations/phonons.py +++ b/janus_core/calculations/phonons.py @@ -31,36 +31,36 @@ class Phonons(BaseCalculation): Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to calculate phonons for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to calculate phonons for. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - calcs : MaybeSequence[PhononCalcs] | None + calcs Phonon calculations to run. Default calculates force constants only. - supercell : MaybeList[int] + supercell The size of a supercell for calculation, or the supercell itself. If a single number is provided, it is interpreted as the size, so a diagonal supercell of that size in all dimensions is constructed. @@ -69,72 +69,47 @@ class Phonons(BaseCalculation): are assumed to be the full supercell matrix in the style of Phonopy, so the first three values will be used as the first row, the second three as the second row, etc. Default is 2. - displacement : float + displacement Displacement for force constants calculation, in A. Default is 0.01. - mesh : tuple[int, int, int] + mesh Mesh for sampling. Default is (10, 10, 10). - symmetrize : bool + symmetrize Whether to symmetrize structure and force constants after calculation. Default is False. - minimize : bool + minimize Whether to perform geometry optimisation before calculating phonons. Default is False. - minimize_kwargs : dict[str, Any] | None + minimize_kwargs Keyword arguments to pass to geometry optimizer. Default is {}. - temp_min : float + temp_min Start temperature for thermal properties calculations, in K. Default is 0.0. - temp_max : float + temp_max End temperature for thermal properties calculations, in K. Default is 1000.0. - temp_step : float + temp_step Temperature step for thermal properties calculations, in K. Default is 50.0. - force_consts_to_hdf5 : bool + force_consts_to_hdf5 Whether to write force constants in hdf format or not. Default is True. - plot_to_file : bool + plot_to_file Whether to plot various graphs as band stuctures, dos/pdos in svg. Default is False. - write_results : bool + write_results Default for whether to write out results to file. Default is True. - write_full : bool + write_full Whether to maximize information written in various output files. Default is True. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from chemical formula of the structure. - enable_progress_bar : bool + enable_progress_bar Whether to show a progress bar during phonon calculations. Default is False. Attributes ---------- - calc : ase.calculators.calculator.Calculator + calc ASE Calculator attached to structure. - results : dict + results Results of phonon calculations. - - Methods - ------- - calc_force_constants(write_force_consts) - Calculate force constants and optionally write results. - write_force_constants(phonopy_file, force_consts_to_hdf5 force_consts_file) - Write results of force constants calculations. - calc_bands(write_bands) - Calculate band structure and optionally write and plot results. - write_bands(bands_file, save_plots, plot_file) - Write results of band structure calculations. - calc_thermal_props(mesh, write_thermal) - Calculate thermal properties and optionally write results. - write_thermal_props(thermal_file) - Write results of thermal properties calculations. - calc_dos(mesh, write_dos) - Calculate density of states and optionally write results. - write_dos(dos_file, plot_to_file, plot_file, plot_bands, plot_bands_file) - Write results of DOS calculation. - calc_pdos(mesh, write_pdos) - Calculate projected density of states and optionally write results. - write_pdos(pdos_file, plot_to_file, plot_file) - Write results of PDOS calculation. - run() - Run phonon calculations. """ def __init__( @@ -173,36 +148,36 @@ def __init__( Parameters ---------- - struct : Atoms | None + struct ASE Atoms structure to calculate phonons for. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to calculate phonons for. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - calcs : MaybeSequence[PhononCalcs] | None + calcs Phonon calculations to run. Default calculates force constants only. - supercell : MaybeList[int] + supercell The size of a supercell for calculation, or the supercell itself. If a single number is provided, it is interpreted as the size, so a diagonal supercell of that size in all dimensions is constructed. @@ -211,39 +186,39 @@ def __init__( are assumed to be the full supercell matrix in the style of Phonopy, so the first three values will be used as the first row, the second three as the second row, etc. Default is 2. - displacement : float + displacement Displacement for force constants calculation, in A. Default is 0.01. - mesh : tuple[int, int, int] + mesh Mesh for sampling. Default is (10, 10, 10). - symmetrize : bool + symmetrize Whether to symmetrize structure and force constants after calculation. Default is False. - minimize : bool + minimize Whether to perform geometry optimisation before calculating phonons. Default is False. - minimize_kwargs : dict[str, Any] | None + minimize_kwargs Keyword arguments to pass to geometry optimizer. Default is {}. - temp_min : float + temp_min Start temperature for thermal calculations, in K. Default is 0.0. - temp_max : float + temp_max End temperature for thermal calculations, in K. Default is 1000.0. - temp_step : float + temp_step Temperature step for thermal calculations, in K. Default is 50.0. - force_consts_to_hdf5 : bool + force_consts_to_hdf5 Whether to write force constants in hdf format or not. Default is True. - plot_to_file : bool + plot_to_file Whether to plot various graphs as band stuctures, dos/pdos in svg. Default is False. - write_results : bool + write_results Default for whether to write out results to file. Default is True. - write_full : bool + write_full Whether to maximize information written in various output files. Default is True. - file_prefix : PathLike | None + file_prefix Prefix for output filenames. Default is inferred from structure name, or chemical formula of the structure. - enable_progress_bar : bool + enable_progress_bar Whether to show a progress bar during phonon calculations. Default is False. """ (read_kwargs, minimize_kwargs) = none_to_dict((read_kwargs, minimize_kwargs)) @@ -347,7 +322,7 @@ def calcs(self, value: MaybeSequence[PhononCalcs]) -> None: Parameters ---------- - value : MaybeSequence[PhononCalcs] + value Phonon calculations to be run. """ if isinstance(value, str): @@ -373,7 +348,7 @@ def calc_force_constants( Parameters ---------- - write_force_consts : bool | None + write_force_consts Whether to write out results to file. Default is self.write_results. **kwargs Additional keyword arguments to pass to `write_force_constants`. @@ -448,13 +423,13 @@ def write_force_constants( Parameters ---------- - phonopy_file : PathLike | None + phonopy_file Name of yaml file to save params of phonopy and optionally force constants. Default is inferred from `file_prefix`. - force_consts_to_hdf5 : bool | None + force_consts_to_hdf5 Whether to save the force constants separately to an hdf5 file. Default is self.force_consts_to_hdf5. - force_consts_file : PathLike | None + force_consts_file Name of hdf5 file to save force constants. Unused if `force_consts_to_hdf5` is False. Default is inferred from `file_prefix`. """ @@ -488,7 +463,7 @@ def calc_bands(self, write_bands: bool | None = None, **kwargs) -> None: Parameters ---------- - write_bands : bool | None + write_bands Whether to write out results to file. Default is self.write_results. **kwargs Additional keyword arguments to pass to `write_bands`. @@ -516,12 +491,12 @@ def write_bands( Parameters ---------- - bands_file : PathLike | None + bands_file Name of yaml file to save band structure. Default is inferred from `file_prefix`. - save_plots : bool | None + save_plots Whether to save plot to file. Default is self.plot_to_file. - plot_file : PathLike | None + plot_file Name of svg file if saving band structure plot. Default is inferred from `file_prefix`. """ @@ -558,9 +533,9 @@ def calc_thermal_props( Parameters ---------- - mesh : tuple[int, int, int] | None + mesh Mesh for sampling. Default is self.mesh. - write_thermal : bool | None + write_thermal Whether to write out thermal properties to file. Default is self.write_results. **kwargs @@ -606,7 +581,7 @@ def write_thermal_props(self, thermal_file: PathLike | None = None) -> None: Parameters ---------- - thermal_file : PathLike | None + thermal_file Name of data file to save thermal properties. Default is inferred from `file_prefix`. """ @@ -640,9 +615,9 @@ def calc_dos( Parameters ---------- - mesh : tuple[int, int, int] | None + mesh Mesh for sampling. Default is self.mesh. - write_dos : bool | None + write_dos Whether to write out results to file. Default is True. **kwargs Additional keyword arguments to pass to `write_dos`. @@ -690,17 +665,17 @@ def write_dos( Parameters ---------- - dos_file : PathLike | None + dos_file Name of data file to save the calculated DOS. Default is inferred from `file_prefix`. - plot_to_file : bool | None + plot_to_file Whether to save plot to file. Default is self.plot_to_file. - plot_file : PathLike | None + plot_file Name of svg file if saving plot of the DOS. Default is inferred from `file_prefix`. - plot_bands : bool + plot_bands Whether to plot the band structure and DOS together. Default is True. - plot_bands_file : PathLike | None + plot_bands_file Name of svg file if saving plot of the band structure and DOS. Default is inferred from `file_prefix`. """ @@ -747,9 +722,9 @@ def calc_pdos( Parameters ---------- - mesh : tuple[int, int, int] | None + mesh Mesh for sampling. Default is self.mesh. - write_pdos : bool | None + write_pdos Whether to write out results to file. Default is self.write_results. **kwargs Additional keyword arguments to pass to `write_pdos`. @@ -797,12 +772,12 @@ def write_pdos( Parameters ---------- - pdos_file : PathLike | None + pdos_file Name of file to save the calculated PDOS. Default is inferred from `file_prefix`. - plot_to_file : bool | None + plot_to_file Whether to save plot to file. Default is self.plot_to_file. - plot_file : PathLike | None + plot_file Name of svg file if saving plot of the calculated PDOS. Default is inferred from `file_prefix`. """ @@ -831,7 +806,7 @@ def _Phonopy_to_ASEAtoms(self, struct: PhonopyAtoms) -> Atoms: # noqa: N802 Parameters ---------- - struct : PhonopyAtoms + struct PhonopyAtoms structure to be converted. Returns @@ -855,7 +830,7 @@ def _ASE_to_PhonopyAtoms(self, struct: Atoms) -> PhonopyAtoms: # noqa: N802 Parameters ---------- - struct : Atoms + struct ASE Atoms structure to be converted. Returns @@ -876,7 +851,7 @@ def _calc_forces(self, struct: PhonopyAtoms) -> ndarray: Parameters ---------- - struct : PhonopyAtoms + struct Structure to calculate forces on. Returns diff --git a/janus_core/calculations/single_point.py b/janus_core/calculations/single_point.py index 0fcb1b95..2d9cd35d 100644 --- a/janus_core/calculations/single_point.py +++ b/janus_core/calculations/single_point.py @@ -31,52 +31,47 @@ class SinglePoint(BaseCalculation): Parameters ---------- - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for single point calculations. Default is "mace_mp". - device : Devices + device Device to run model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is ":". - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - properties : MaybeSequence[Properties] + properties Physical properties to calculate. If not specified, "energy", "forces", and "stress" will be returned. - write_results : bool + write_results True to write out structure with results of calculations. Default is False. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}. Attributes ---------- - results : CalcResults + results Dictionary of calculated results, with keys from `properties`. - - Methods - ------- - run() - Run single point calculations. """ def __init__( @@ -103,40 +98,40 @@ def __init__( Parameters ---------- - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - arch : Architectures + arch MLIP architecture to use for single point calculations. Default is "mace_mp". - device : Devices + device Device to run MLIP model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - read_kwargs : ASEReadArgs | None + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is ":". - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is None. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. - properties : MaybeSequence[Properties] + properties Physical properties to calculate. If not specified, "energy", "forces", and "stress" will be returned. - write_results : bool + write_results True to write out structure with results of calculations. Default is False. - write_kwargs : OutputKwargs | None + write_kwargs Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}. """ @@ -197,7 +192,7 @@ def properties(self, value: MaybeSequence[Properties]) -> None: Parameters ---------- - value : MaybeSequence[Properties] + value Physical properties to be calculated. """ if isinstance(value, str): @@ -272,7 +267,7 @@ def _calc_hessian(self, struct: Atoms) -> ndarray: Parameters ---------- - struct : Atoms + struct Structure to calculate Hessian for. Returns diff --git a/janus_core/cli/descriptors.py b/janus_core/cli/descriptors.py index eccedc36..d2fd235f 100644 --- a/janus_core/cli/descriptors.py +++ b/janus_core/cli/descriptors.py @@ -71,42 +71,42 @@ def descriptors( Parameters ---------- - ctx : Context + ctx Typer (Click) Context. Automatically set. - struct : Path + struct Path of structure to simulate. - invariants_only : bool + invariants_only Whether only the invariant descriptors should be returned. Default is True. - calc_per_element : bool + calc_per_element Whether to calculate mean descriptors for each element. Default is False. - calc_per_atom : bool + calc_per_atom Whether to calculate descriptors for each atom. Default is False. - arch : Optional[str] + arch MLIP architecture to use for single point calculations. Default is "mace_mp". - device : Optional[str] + device Device to run model on. Default is "cpu". - model_path : Optional[str] + model_path Path to MLIP model. Default is `None`. - out : Optional[Path] + out Path to save structure with calculated results. Default is inferred from name of the structure file. - read_kwargs : Optional[dict[str, Any]] + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is ":". - calc_kwargs : Optional[dict[str, Any]] + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - write_kwargs : Optional[dict[str, Any]] + write_kwargs Keyword arguments to pass to ase.io.write when saving results. Default is {}. - log : Optional[Path] + log Path to write logs to. Default is inferred from the name of the structure file. - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file. - config : Optional[Path] + config Path to yaml configuration file to define the above options. Default is None. """ from janus_core.calculations.descriptors import Descriptors diff --git a/janus_core/cli/eos.py b/janus_core/cli/eos.py index 047c7398..65e45386 100644 --- a/janus_core/cli/eos.py +++ b/janus_core/cli/eos.py @@ -87,58 +87,58 @@ def eos( Parameters ---------- - ctx : Context + ctx Typer (Click) Context. Automatically set. - struct : Path + struct Path of structure to simulate. - min_volume : float + min_volume Minimum volume scale factor. Default is 0.95. - max_volume : float + max_volume Maximum volume scale factor. Default is 1.05. - n_volumes : int + n_volumes Number of volumes to use. Default is 7. - eos_type : Optional[str] + eos_type Type of fit for equation of state. Default is "birchmurnaghan". - minimize : bool + minimize Whether to minimize initial structure before calculations. Default is True. - minimize_all : bool + minimize_all Whether to optimize geometry for all generated structures. Default is False. - fmax : float + fmax Set force convergence criteria for optimizer in units eV/Å. Default is 0.1. - minimize_kwargs : Optional[dict[str, Any]] + minimize_kwargs Other keyword arguments to pass to geometry optimizer. Default is {}. - write_structures : bool + write_structures True to write out all genereated structures. Default is False. - write_kwargs : Optional[dict[str, Any]], + write_kwargs Keyword arguments to pass to ase.io.write to save generated structures. Default is {}. - plot_to_file : bool + plot_to_file Whether to save plot equation of state to svg. Default is False. - arch : Optional[str] + arch MLIP architecture to use for geometry optimization. Default is "mace_mp". - device : Optional[str] + device Device to run model on. Default is "cpu". - model_path : Optional[str] + model_path Path to MLIP model. Default is `None`. - read_kwargs : Optional[dict[str, Any]] + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : Optional[dict[str, Any]] + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - file_prefix : Optional[PathLike] + file_prefix Prefix for output filenames. Default is inferred from structure name, or chemical formula. - log : Optional[Path] + log Path to write logs to. Default is inferred from the name of the structure file. - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file. - config : Optional[Path] + config Path to yaml configuration file to define the above options. Default is None. """ from janus_core.calculations.eos import EoS diff --git a/janus_core/cli/geomopt.py b/janus_core/cli/geomopt.py index 5a504b4f..fc965e19 100644 --- a/janus_core/cli/geomopt.py +++ b/janus_core/cli/geomopt.py @@ -39,14 +39,14 @@ def _set_minimize_kwargs( Parameters ---------- - minimize_kwargs : dict[str, Any] + minimize_kwargs Other keyword arguments to pass to geometry optimizer. - traj : Optional[str] + traj Path if saving optimization frames. - opt_cell_lengths : bool + opt_cell_lengths Whether to optimize cell vectors, as well as atomic positions, by setting `hydrostatic_strain` in the filter function. - pressure : float + pressure Scalar pressure when optimizing cell geometry, in GPa. Passed to the filter function if either `opt_cell_lengths` or `opt_cell_fully` is True. """ @@ -161,66 +161,66 @@ def geomopt( Parameters ---------- - ctx : Context + ctx Typer (Click) Context. Automatically set. - struct : Path + struct Path of structure to simulate. - optimizer : Optional[str] + optimizer Name of optimization function from ase.optimize. Default is `LBFGS`. - fmax : float + fmax Set force convergence criteria for optimizer, in eV/Å. Default is 0.1. - steps : int + steps Set maximum number of optimization steps to run. Default is 1000. - arch : Optional[str] + arch MLIP architecture to use for geometry optimization. Default is "mace_mp". - device : Optional[str] + device Device to run model on. Default is "cpu". - model_path : Optional[str] + model_path Path to MLIP model. Default is `None`. - opt_cell_lengths : bool + opt_cell_lengths Whether to optimize cell vectors, as well as atomic positions, by setting `hydrostatic_strain` in the filter function. Default is False. - opt_cell_fully : bool + opt_cell_fully Whether to fully optimize the cell vectors, angles, and atomic positions. Default is False. - filter_func : Optional[str] + filter_func Name of filter function from ase.filters or ase.constraints, to apply constraints to atoms. If using --opt-cell-lengths or --opt-cell-fully, defaults to `FrechetCellFilter` if available, otherwise `ExpCellFilter`. - pressure : float + pressure Scalar pressure when optimizing cell geometry, in GPa. Passed to the filter function if either `opt_cell_lengths` or `opt_cell_fully` is True. Default is 0.0. - symmetrize : bool + symmetrize Whether to refine symmetry after geometry optimization. Default is False. - symmetry_tolerance : float + symmetry_tolerance Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001. - out : Optional[Path] + out Path to save optimized structure, or last structure if optimization did not converge. Default is inferred from name of structure file. - traj : Optional[str] + traj Path if saving optimization frames. Default is None. - read_kwargs : Optional[dict[str, Any]] + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : Optional[dict[str, Any]] + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - minimize_kwargs : Optional[dict[str, Any]] + minimize_kwargs Other keyword arguments to pass to geometry optimizer. Default is {}. - write_kwargs : Optional[dict[str, Any]] + write_kwargs Keyword arguments to pass to ase.io.write when saving optimized structure. Default is {}. - log : Optional[Path] + log Path to write logs to. Default is inferred from the name of the structure file. - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file. - config : Optional[Path] + config Path to yaml configuration file to define the above options. Default is None. """ from janus_core.calculations.geom_opt import GeomOpt diff --git a/janus_core/cli/janus.py b/janus_core/cli/janus.py index 75a52aa9..b0cf36d1 100644 --- a/janus_core/cli/janus.py +++ b/janus_core/cli/janus.py @@ -43,7 +43,7 @@ def print_version( Parameters ---------- - version : bool + version Whether to print the current janus-core version. """ if version: diff --git a/janus_core/cli/md.py b/janus_core/cli/md.py index 964cf9a8..7ee66b5b 100644 --- a/janus_core/cli/md.py +++ b/janus_core/cli/md.py @@ -185,117 +185,117 @@ def md( Parameters ---------- - ctx : Context + ctx Typer (Click) Context. Automatically set. - ensemble : str + ensemble Name of thermodynamic ensemble. - struct : Path + struct Path of structure to simulate. - steps : int + steps Number of steps in simulation. Default is 0. - timestep : float + timestep Timestep for integrator, in fs. Default is 1.0. - temp : float + temp Temperature, in K. Default is 300. - thermostat_time : float + thermostat_time Thermostat time, in fs. Default is 50.0. - barostat_time : float + barostat_time Barostat time, in fs. Default is 75.0. - bulk_modulus : float + bulk_modulus Bulk modulus, in GPa. Default is 2.0. - pressure : float + pressure Pressure, in GPa. Default is 0.0. - friction : float + friction Friction coefficient in fs^-1. Default is 0.005. - ensemble_kwargs : Optional[dict[str, Any]] + ensemble_kwargs Keyword arguments to pass to ensemble initialization. Default is {}. - arch : Optional[str] + arch MLIP architecture to use for molecular dynamics. Default is "mace_mp". - device : Optional[str] + device Device to run model on. Default is "cpu". - model_path : Optional[str] + model_path Path to MLIP model. Default is `None`. - read_kwargs : Optional[dict[str, Any]] + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is -1. - calc_kwargs : Optional[dict[str, Any]] + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - equil_steps : int + equil_steps Maximum number of steps at which to perform optimization and reset velocities. Default is 0. - minimize : bool + minimize Whether to minimize structure during equilibration. Default is False. - minimize_every : int + minimize_every Frequency of minimizations. Default is -1, which disables minimization after beginning dynamics. - minimize_kwargs : Optional[dict[str, Any]] + minimize_kwargs Keyword arguments to pass to geometry optimizer. Default is {}. - rescale_velocities : bool + rescale_velocities Whether to rescale velocities. Default is False. - remove_rot : bool + remove_rot Whether to remove rotation. Default is False. - rescale_every : int + rescale_every Frequency to rescale velocities. Default is 10. - file_prefix : Optional[PathLike] + file_prefix Prefix for output filenames. Default is inferred from structure, ensemble, and temperature. - restart : bool + restart Whether restarting dynamics. Default is False. - restart_auto : bool + restart_auto Whether to infer restart file name if restarting dynamics. Default is True. - restart_stem : str + restart_stem Stem for restart file name. Default inferred from `file_prefix`. - restart_every : int + restart_every Frequency of steps to save restart info. Default is 1000. - rotate_restart : bool + rotate_restart Whether to rotate restart files. Default is False. - restarts_to_keep : int + restarts_to_keep Restart files to keep if rotating. Default is 4. - final_file : Optional[PathLike] + final_file File to save final configuration at each temperature of similation. Default inferred from `file_prefix`. - stats_file : Optional[PathLike] + stats_file File to save thermodynamical statistics. Default inferred from `file_prefix`. - stats_every : int + stats_every Frequency to output statistics. Default is 100. - traj_file : Optional[PathLike] + traj_file Trajectory file to save. Default inferred from `file_prefix`. - traj_append : bool + traj_append Whether to append trajectory. Default is False. - traj_start : int + traj_start Step to start saving trajectory. Default is 0. - traj_every : int + traj_every Frequency of steps to save trajectory. Default is 100. - temp_start : Optional[float] + temp_start Temperature to start heating, in K. Default is None, which disables heating. - temp_end : Optional[float] + temp_end Maximum temperature for heating, in K. Default is None, which disables heating. - temp_step : Optional[float] + temp_step Size of temperature steps when heating, in K. Default is None, which disables heating. - temp_time : Optional[float] + temp_time Time between heating steps, in fs. Default is None, which disables heating. - write_kwargs : Optional[dict[str, Any]], + write_kwargs Keyword arguments to pass to `output_structs` when saving trajectory and final files. Default is {}. - post_process_kwargs : Optional[PostProcessKwargs] + post_process_kwargs Kwargs to pass to post-processing. - seed : Optional[int] + seed Random seed used by numpy.random and random functions, such as in Langevin. Default is None. - log : Optional[Path] + log Path to write logs to. Default is inferred from the name of the structure file. - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file. - config : Optional[Path] + config Path to yaml configuration file to define the above options. Default is None. """ from janus_core.calculations.md import NPH, NPT, NVE, NVT, NVT_NH diff --git a/janus_core/cli/phonons.py b/janus_core/cli/phonons.py index d1ee845f..1420dc30 100644 --- a/janus_core/cli/phonons.py +++ b/janus_core/cli/phonons.py @@ -122,77 +122,77 @@ def phonons( Parameters ---------- - ctx : Context + ctx Typer (Click) Context. Automatically set. - struct : Path + struct Path of structure to simulate. - supercell : str + supercell Supercell matrix, in the Phonopy style. Must be passed as a string in one of three forms: single integer ('2'), which specifies all diagonal elements; three integers ('1 2 3'), which specifies each individual diagonal element; or nine values ('1 2 3 4 5 6 7 8 9'), which specifies all elements, filling the matrix row-wise. - displacement : float + displacement Displacement for force constants calculation, in A. Default is 0.01. - mesh : tuple[int, int, int] + mesh Mesh for sampling. Default is (10, 10, 10). - bands : bool + bands Whether to calculate and save the band structure. Default is False. - dos : bool + dos Whether to calculate and save the DOS. Default is False. - pdos : bool + pdos Whether to calculate and save the PDOS. Default is False. - thermal : bool + thermal Whether to calculate thermal properties. Default is False. - temp_min : float + temp_min Start temperature for thermal calculations, in K. Unused if `thermal` is False. Default is 0.0. - temp_max : float + temp_max End temperature for thermal calculations, in K. Unused if `thermal` is False. Default is 1000.0. - temp_step : float + temp_step Temperature step for thermal calculations, in K. Unused if `thermal` is False. Default is 50.0. - symmetrize : bool + symmetrize Whether to symmetrize force constants. Default is False. - minimize : bool + minimize Whether to minimize structure before calculations. Default is False. - fmax : float + fmax Set force convergence criteria for optimizer in units eV/Å. Default is 0.1. - minimize_kwargs : Optional[dict[str, Any]] + minimize_kwargs Other keyword arguments to pass to geometry optimizer. Default is {}. - hdf5 : bool + hdf5 Whether to save force constants in hdf5 format. Default is True. - plot_to_file : bool + plot_to_file Whether to plot. Default is False. - write_full : bool + write_full Whether to maximize information written in various output files. Default is True. - arch : Optional[str] + arch MLIP architecture to use for geometry optimization. Default is "mace_mp". - device : Optional[str] + device Device to run model on. Default is "cpu". - model_path : Optional[str] + model_path Path to MLIP model. Default is `None`. - read_kwargs : Optional[dict[str, Any]] + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is 0. - calc_kwargs : Optional[dict[str, Any]] + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - file_prefix : Optional[PathLike] + file_prefix Prefix for output filenames. Default is inferred from structure name, or chemical formula. - log : Optional[Path] + log Path to write logs to. Default is inferred from the name of the structure file. - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file. - config : Optional[Path] + config Path to yaml configuration file to define the above options. Default is None. """ from janus_core.calculations.phonons import Phonons diff --git a/janus_core/cli/singlepoint.py b/janus_core/cli/singlepoint.py index 059edd59..356a459d 100644 --- a/janus_core/cli/singlepoint.py +++ b/janus_core/cli/singlepoint.py @@ -68,38 +68,38 @@ def singlepoint( Parameters ---------- - ctx : Context + ctx Typer (Click) Context. Automatically set. - struct : Path + struct Path of structure to simulate. - arch : Optional[str] + arch MLIP architecture to use for single point calculations. Default is "mace_mp". - device : Optional[str] + device Device to run model on. Default is "cpu". - model_path : Optional[str] + model_path Path to MLIP model. Default is `None`. - properties : Optional[list[str]] + properties Physical properties to calculate. Default is ("energy", "forces", "stress"). - out : Optional[Path] + out Path to save structure with calculated results. Default is inferred from name of the structure file. - read_kwargs : Optional[dict[str, Any]] + read_kwargs Keyword arguments to pass to ase.io.read. By default, read_kwargs["index"] is ":". - calc_kwargs : Optional[dict[str, Any]] + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - write_kwargs : Optional[dict[str, Any]] + write_kwargs Keyword arguments to pass to ase.io.write when saving results. Default is {}. - log : Optional[Path] + log Path to write logs to. Default is inferred from the name of the structure file. - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file. - config : Optional[Path] + config Path to yaml configuration file to define the above options. Default is None. """ from janus_core.calculations.single_point import SinglePoint diff --git a/janus_core/cli/train.py b/janus_core/cli/train.py index 197ca272..990787b1 100644 --- a/janus_core/cli/train.py +++ b/janus_core/cli/train.py @@ -40,16 +40,16 @@ def train( Parameters ---------- - mlip_config : Path + mlip_config Configuration file to pass to MLIP CLI. - fine_tune : bool + fine_tune Whether to fine-tune a foundational model. Default is False. - log : Optional[Path] + log Path to write logs to. Default is Path("train-log.yml"). - tracker : bool + tracker Whether to save carbon emissions of calculation in log file and summary. Default is True. - summary : Optional[Path] + summary Path to save summary of inputs, start/end time, and carbon emissions. Default is Path("train-summary.yml"). """ diff --git a/janus_core/cli/types.py b/janus_core/cli/types.py index ab00c252..b1ebfc4d 100644 --- a/janus_core/cli/types.py +++ b/janus_core/cli/types.py @@ -18,7 +18,7 @@ def parse_dict_class(value: str | ASEReadArgs) -> TyperDict: Parameters ---------- - value : str | ASEReadArgs + value String representing dictionary to be parsed. Returns @@ -37,7 +37,7 @@ class TyperDict: Parameters ---------- - value : str + value Value of string representing a dictionary. """ @@ -47,7 +47,7 @@ def __init__(self, value: str) -> None: Parameters ---------- - value : str + value Value of string representing a dictionary. """ self.value = value diff --git a/janus_core/cli/utils.py b/janus_core/cli/utils.py index c92718f9..be2b66f1 100644 --- a/janus_core/cli/utils.py +++ b/janus_core/cli/utils.py @@ -30,7 +30,7 @@ def dict_paths_to_strs(dictionary: dict) -> None: Parameters ---------- - dictionary : dict + dictionary Dictionary to be converted. """ for key, value in dictionary.items(): @@ -46,7 +46,7 @@ def dict_tuples_to_lists(dictionary: dict) -> None: Parameters ---------- - dictionary : dict + dictionary Dictionary to be converted. """ for key, value in dictionary.items(): @@ -62,7 +62,7 @@ def dict_remove_hyphens(dictionary: dict) -> dict: Parameters ---------- - dictionary : dict + dictionary Dictionary to be converted. Returns @@ -84,7 +84,7 @@ def set_read_kwargs_index(read_kwargs: dict[str, Any]) -> None: Parameters ---------- - read_kwargs : dict[str, Any] + read_kwargs Keyword arguments to be passed to ase.io.read. If specified, read_kwargs["index"] must be an integer, and if not, a default value of -1 is set. @@ -102,7 +102,7 @@ def parse_typer_dicts(typer_dicts: list[TyperDict]) -> list[dict]: Parameters ---------- - typer_dicts : list[TyperDict] + typer_dicts List of TyperDict objects to convert. Returns @@ -120,7 +120,7 @@ def parse_typer_dicts(typer_dicts: list[TyperDict]) -> list[dict]: if not isinstance(typer_dicts[i], dict): raise ValueError( f"""{typer_dicts[i]} must be passed as a dictionary wrapped in quotes.\ - For example, "{{'key' : value}}" """ + For example, "{{'key': value}}" """ ) return typer_dicts @@ -131,7 +131,7 @@ def yaml_converter_loader(config_file: str) -> dict[str, Any]: Parameters ---------- - config_file : str + config_file Yaml configuration file to read. Returns @@ -156,11 +156,11 @@ def start_summary(*, command: str, summary: Path, inputs: dict) -> None: Parameters ---------- - command : str + command Name of CLI command being used. - summary : Path + summary Path to summary file being saved. - inputs : dict + inputs Inputs to CLI command to save. """ save_info = { @@ -178,9 +178,9 @@ def carbon_summary(*, summary: Path, log: Path) -> None: Parameters ---------- - summary : Path + summary Path to summary file being saved. - log : Path + log Path to log file with carbon emissions saved. """ with open(log, encoding="utf8") as file: @@ -202,7 +202,7 @@ def end_summary(summary: Path) -> None: Parameters ---------- - summary : Path + summary Path to summary file being saved. """ with open(summary, "a", encoding="utf8") as outfile: @@ -231,23 +231,23 @@ def save_struct_calc( Parameters ---------- - inputs : dict + inputs Inputs dictionary to add information to. - struct : MaybeSequence[Atoms] + struct Structure to be simulated. - struct_path : Path + struct_path Path of structure file. - arch : Architectures + arch MLIP architecture. - device : Devices + device Device to run calculations on. - model_path : str + model_path Path to MLIP model. - read_kwargs : ASEReadArgs + read_kwargs Keyword arguments to pass to ase.io.read. - calc_kwargs : dict[str, Any]] + calc_kwargs Keyword arguments to pass to the calculator. - log : Path + log Path to log file. """ from ase import Atoms @@ -301,7 +301,7 @@ def check_config(ctx: Context) -> None: Parameters ---------- - ctx : Context + ctx Typer (Click) Context within command. """ # Compare options from config file (default_map) to function definition (params) diff --git a/janus_core/helpers/janus_types.py b/janus_core/helpers/janus_types.py index 708c7845..13d535c8 100644 --- a/janus_core/helpers/janus_types.py +++ b/janus_core/helpers/janus_types.py @@ -96,11 +96,11 @@ def __call__(self, atoms: Atoms, *args, **kwargs) -> float: Parameters ---------- - atoms : Atoms + atoms Atoms object to extract values from. - *args : tuple + *args Additional positional arguments passed to getter. - **kwargs : dict + **kwargs Additional kwargs passed getter. """ diff --git a/janus_core/helpers/log.py b/janus_core/helpers/log.py index bd224327..d4965e8d 100644 --- a/janus_core/helpers/log.py +++ b/janus_core/helpers/log.py @@ -18,29 +18,24 @@ class YamlFormatter(logging.Formatter): # numpydoc ignore=PR02 Parameters ---------- - fmt : str | None + fmt A format string in the given style for the logged output as a whole. Default is defined by `FORMAT`. - datefmt : str | None + datefmt A format string in the given style for the date/time portion of the logged output. Default is taken from logging.Formatter.formatTime(). - style : Literal['%', '{', '$'] + style Determines how the format string will be merged with its data. Can be one of '%', '{' or '$'. Default is '%'. - validate : bool + validate If True, incorrect or mismatched fmt and style will raise a ValueError. Default is True. - defaults : dict[str, logging.Any] | None + defaults A dictionary with default values to use in custom fields. Default is None. *args Arguments to pass to logging.Formatter.__init__. **kwargs Keyword arguments to pass to logging.Formatter.__init__. - - Methods - ------- - format(record) - Format log message to convert new lines into a yaml list. """ FORMAT = """ @@ -71,7 +66,7 @@ def format(self, record: logging.LogRecord) -> str: Parameters ---------- - record : logging.LogRecord + record Log record to be formatted. Returns @@ -111,17 +106,17 @@ def config_logger( Parameters ---------- - name : str + name Name of logger. Default is None. - filename : str | None + filename Name of log file if writing logs. Default is None. - level : LogLevel + level Threshold for logger. Default is logging.INFO. - capture_warnings : bool + capture_warnings Whether to capture warnings in log. Default is True. - filemode : str + filemode Mode of file to open. Default is "w". - force : bool + force If true, remove and close existing handlers attached to the root logger before configuration. Default is True. @@ -166,15 +161,15 @@ def config_tracker( Parameters ---------- - janus_logger : logging.Logger | None + janus_logger Logger for codecarbon output. - track_carbon : bool + track_carbon Whether to track carbon emissions for calculation. Default is True. - country_iso_code : str + country_iso_code 3 letter ISO Code of the country where the code is running. Default is "GBR". - save_to_file : bool + save_to_file Whether to also output results to a csv file. Default is False. - log_level : Literal["debug", "info", "warning", "error", "critical"] + log_level Log level of internal carbon tracker log. Default is "critical". Returns diff --git a/janus_core/helpers/mlip_calculators.py b/janus_core/helpers/mlip_calculators.py index 2308c3e5..658f885e 100644 --- a/janus_core/helpers/mlip_calculators.py +++ b/janus_core/helpers/mlip_calculators.py @@ -29,9 +29,9 @@ def _set_model_path( Parameters ---------- - model_path : PathLike | None + model_path Path to MLIP file. - kwargs : dict[str, Any] | None + kwargs Dictionary of additional keyword arguments passed to the selected calculator. Returns @@ -79,11 +79,11 @@ def choose_calculator( Parameters ---------- - arch : Architectures + arch MLIP architecture. Default is "mace". - device : Devices + device Device to run calculator on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP file. **kwargs Additional keyword arguments passed to the selected calculator. @@ -245,9 +245,9 @@ def check_calculator(calc: Calculator, attribute: str) -> None: Parameters ---------- - calc : Calculator + calc ASE Calculator to check. - attribute : str + attribute Attribute to check calculator for. """ # If dispersion added to MLIP calculator, use only MLIP calculator for calculation diff --git a/janus_core/helpers/stats.py b/janus_core/helpers/stats.py index f0f5fbb4..87fbd5bb 100644 --- a/janus_core/helpers/stats.py +++ b/janus_core/helpers/stats.py @@ -26,7 +26,7 @@ class Stats: Parameters ---------- - source : PathLike + source File that contains the stats of a molecular dynamics simulation. """ @@ -36,7 +36,7 @@ def __init__(self, source: PathLike) -> None: Parameters ---------- - source : PathLike + source File that contains the stats of a molecular dynamics simulation. """ self._data = zeros((0, 0)) @@ -54,7 +54,7 @@ def _getind(self, lab: T) -> T: Parameters ---------- - lab : str + lab Label to find. Returns @@ -91,7 +91,7 @@ def __getitem__(self, ind) -> NDArray[float64]: Parameters ---------- - ind : Any + ind Index or label to find. Returns diff --git a/janus_core/helpers/struct_io.py b/janus_core/helpers/struct_io.py index 9cdc04f4..50cb770e 100644 --- a/janus_core/helpers/struct_io.py +++ b/janus_core/helpers/struct_io.py @@ -35,11 +35,11 @@ def results_to_info( Parameters ---------- - struct : Atoms + struct Atoms object to copy or move calculated results to info dict. - properties : Collection[Properties] + properties Properties to copy from results to info dict. Default is (). - invalidate_calc : bool + invalidate_calc Whether to remove all calculator results after copying properties to info dict. Default is False. """ @@ -77,15 +77,15 @@ def attach_calculator( Parameters ---------- - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to attach calculators to. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. """ calc_kwargs = calc_kwargs if calc_kwargs else {} @@ -122,28 +122,28 @@ def input_structs( Parameters ---------- - struct : MaybeSequence[Atoms] | None + struct ASE Atoms structure(s) to simulate. Required if `struct_path` is None. Default is None. - struct_path : PathLike | None + struct_path Path of structure to simulate. Required if `struct` is None. Default is None. - read_kwargs : ASEReadArgs + read_kwargs Keyword arguments to pass to ase.io.read. Default is {}. - sequence_allowed : bool + sequence_allowed Whether a sequence of Atoms objects is allowed. Default is True. - arch : Architectures + arch MLIP architecture to use for calculations. Default is "mace_mp". - device : Devices + device Device to run model on. Default is "cpu". - model_path : PathLike | None + model_path Path to MLIP model. Default is `None`. - calc_kwargs : dict[str, Any] | None + calc_kwargs Keyword arguments to pass to the selected calculator. Default is {}. - set_calc : bool | None + set_calc Whether to set (new) calculators for structures. Default is True if `struct_path` is specified or `struct` is missing calculators, else default is False. - logger : logging.Logger | None + logger Logger if log file has been specified. Default is None. Returns @@ -230,21 +230,21 @@ def output_structs( Parameters ---------- - images : MaybeSequence[Atoms] + images Atoms object or a list of Atoms objects to interact with. - struct_path : PathLike | None + struct_path Path of structure being simulated. If specified, the file stem is added to the info dict under "system_name". Default is None. - set_info : bool + set_info True to set info dict from calculated results. Default is True. - write_results : bool + write_results True to write out structure with results of calculations. Default is False. - properties : Collection[Properties] + properties Properties to copy from calculated results to info dict. Default is (). - invalidate_calc : bool + invalidate_calc Whether to remove all calculator results after copying properties to info dict. Default is False. - write_kwargs : ASEWriteArgs | None + write_kwargs Keyword arguments passed to ase.io.write. Default is {}. """ # Separate kwargs for output_structs from kwargs for ase.io.write diff --git a/janus_core/helpers/utils.py b/janus_core/helpers/utils.py index 3153fac4..69499f2d 100644 --- a/janus_core/helpers/utils.py +++ b/janus_core/helpers/utils.py @@ -27,23 +27,15 @@ class FileNameMixin(ABC): # noqa: B024 (abstract-base-class-without-abstract-me Parameters ---------- - struct : MaybeSequence[Atoms] + struct Structure from which to derive the default name. If `struct` is a sequence, the first structure will be used. - struct_path : PathLike | None + struct_path Path to file containing structures. - file_prefix : PathLike | None + file_prefix Default prefix to use. *additional Components to add to default file_prefix (joined by hyphens). - - Methods - ------- - _get_default_prefix(file_prefix, struct) - Return a prefix from the provided file_prefix or from chemical formula of - struct. - _build_filename(suffix, *additional, filename, prefix_override) - Return a standard format filename if filename not provided. """ def __init__( @@ -58,12 +50,12 @@ def __init__( Parameters ---------- - struct : MaybeSequence[Atoms] + struct Structure(s) from which to derive the default name. If `struct` is a sequence, the first structure will be used. - struct_path : PathLike | None + struct_path Path to file structures were read from. Used as default prefix is not None. - file_prefix : PathLike | None + file_prefix Default prefix to use. *additional Components to add to default file_prefix (joined by hyphens). @@ -84,12 +76,12 @@ def _get_default_prefix( Parameters ---------- - file_prefix : PathLike | None + file_prefix Given file_prefix. - struct : MaybeSequence[Atoms] + struct Structure(s) from which to derive the default name. If `struct` is a sequence, the first structure will be used. - struct_path : PathLike | None + struct_path Path to file containing structures. *additional Components to add to default file_prefix (joined by hyphens). @@ -124,13 +116,13 @@ def _build_filename( Parameters ---------- - suffix : str + suffix Default suffix to use if `filename` is not specified. *additional Extra components to add to suffix (joined with hyphens). - filename : PathLike | None + filename Filename to use, if specified. Default is None. - prefix_override : str | None + prefix_override Replace file_prefix if not None. Returns @@ -157,7 +149,7 @@ def none_to_dict(dictionaries: Sequence[dict | None]) -> Generator[dict, None, N Parameters ---------- - dictionaries : Sequence[dict | None] + dictionaries Sequence of dictionaries that could be None. Yields @@ -190,12 +182,12 @@ def write_table( Parameters ---------- - fmt : {'ascii', 'csv'} + fmt Format to write table in. - file : TextIO + file File to dump to. If unspecified function returns io.StringIO object simulating file. - units : dict[str, str] + units Units as ``{key: unit}``: key @@ -205,16 +197,16 @@ def write_table( Units which do not match any columns in `columns` are ignored. - formats : dict[str, str] + formats Output formats as ``{key: format}``: key To align with those in `columns`. format Python magic format string to use. - print_header : bool + print_header Whether to print the header or just append formatted data. - **columns : dict[str, Any] + **columns Dictionary of columns names to data with optional "
_units"/"
_format" to define units/format. @@ -317,19 +309,19 @@ def _dump_ascii( Parameters ---------- - file : TextIO + file File to dump to. - header : list[str] + header Column name information. - columns : dict[str, Sequence[Any]] + columns Column data by key (ordered with header info). - formats : Sequence[str] + formats Python magic string formats to apply (must align with header info). See Also -------- - write_table : Main entry function. + write_table """ if header: print(f"# {' | '.join(header)}", file=file) @@ -349,19 +341,19 @@ def _dump_csv( Parameters ---------- - file : TextIO + file File to dump to. - header : list[str] + header Column name information. - columns : dict[str, Sequence[Any]] + columns Column data by key (ordered with header info). - formats : Sequence[str] + formats Python magic string formats to apply (must align with header info). See Also -------- - write_table : Main entry function. + write_table """ if header: print(",".join(header), file=file) @@ -380,9 +372,9 @@ def track_progress(sequence: Sequence | Iterable, description: str) -> Iterable: Parameters ---------- - sequence : Iterable + sequence The sequence to iterate over. Must support "len". - description : str + description The text to display to the left of the progress bar. Yields diff --git a/janus_core/processing/correlator.py b/janus_core/processing/correlator.py index 39752a82..78cfb4a1 100644 --- a/janus_core/processing/correlator.py +++ b/janus_core/processing/correlator.py @@ -16,11 +16,11 @@ class Correlator: Parameters ---------- - blocks : int + blocks Number of correlation blocks. - points : int + points Number of points per block. - averaging : int + averaging Averaging window per block level. """ @@ -30,11 +30,11 @@ def __init__(self, *, blocks: int, points: int, averaging: int) -> None: Parameters ---------- - blocks : int + blocks Number of correlation blocks. - points : int + points Number of points per block. - averaging : int + averaging Averaging window per block level. """ self._blocks = blocks @@ -57,9 +57,9 @@ def update(self, a: float, b: float) -> None: Parameters ---------- - a : float + a Newly observed value of left correland. - b : float + b Newly observed value of right correland. """ self._propagate(a, b, 0) @@ -70,11 +70,11 @@ def _propagate(self, a: float, b: float, block: int) -> None: Parameters ---------- - a : float + a Newly observed value of left correland/average. - b : float + b Newly observed value of right correland/average. - block : int + block Block in the hierachy being updated. """ if block == self._blocks: @@ -126,11 +126,11 @@ def _shifts_valid(self, block: int, p_i: int, p_j: int) -> bool: Parameters ---------- - block : int + block Block to check the shift register of. - p_i : int + p_i Index i in the shift (left correland). - p_j : int + p_j Index j in the shift (right correland). Returns @@ -146,9 +146,9 @@ def get(self) -> tuple[Iterable[float], Iterable[float]]: Returns ------- - correlation : Iterable[float] + correlation The correlation values . - lags : Iterable[float]] + lags The correlation lag times t'. """ correlation = np.zeros(self._points * self._blocks) @@ -179,19 +179,19 @@ class Correlation: Parameters ---------- - a : tuple[Observable, dict] + a Getter for a and kwargs. - b : tuple[Observable, dict] + b Getter for b and kwargs. - name : str + name Name of correlation. - blocks : int + blocks Number of correlation blocks. - points : int + points Number of points per block. - averaging : int + averaging Averaging window per block level. - update_frequency : int + update_frequency Frequency to update the correlation, md steps. """ @@ -210,19 +210,19 @@ def __init__( Parameters ---------- - a : tuple[Observable, tuple, dict] + a Getter for a and kwargs. - b : tuple[Observable, tuple, dict] + b Getter for b and kwargs. - name : str + name Name of correlation. - blocks : int + blocks Number of correlation blocks. - points : int + points Number of points per block. - averaging : int + averaging Averaging window per block level. - update_frequency : int + update_frequency Frequency to update the correlation, md steps. """ self.name = name @@ -259,7 +259,7 @@ def update(self, atoms: Atoms) -> None: Parameters ---------- - atoms : Atoms + atoms Atoms object to observe values from. """ self._correlator.update( @@ -273,9 +273,9 @@ def get(self) -> tuple[Iterable[float], Iterable[float]]: Returns ------- - correlation : Iterable[float] + correlation The correlation values . - lags : Iterable[float]] + lags The correlation lag times t'. """ return self._correlator.get() diff --git a/janus_core/processing/observables.py b/janus_core/processing/observables.py index 32eee246..9cf7359c 100644 --- a/janus_core/processing/observables.py +++ b/janus_core/processing/observables.py @@ -11,9 +11,9 @@ class Stress: Parameters ---------- - component : str + component Symbol for tensor components, xx, yy, etc. - include_ideal_gas : bool + include_ideal_gas Calculate with the ideal gas contribution. """ @@ -23,9 +23,9 @@ def __init__(self, component: str, *, include_ideal_gas: bool = True) -> None: Parameters ---------- - component : str + component Symbol for tensor components, xx, yy, etc. - include_ideal_gas : bool + include_ideal_gas Calculate with the ideal gas contribution. """ components = { @@ -54,11 +54,11 @@ def __call__(self, atoms: Atoms, *args, **kwargs) -> float: Parameters ---------- - atoms : Atoms + atoms Atoms object to extract values from. - *args : tuple + *args Additional positional arguments passed to getter. - **kwargs : dict + **kwargs Additional kwargs passed getter. Returns diff --git a/janus_core/processing/post_process.py b/janus_core/processing/post_process.py index 044b8d02..23c4081f 100644 --- a/janus_core/processing/post_process.py +++ b/janus_core/processing/post_process.py @@ -25,7 +25,7 @@ def _process_index(index: SliceLike) -> StartStopStep: Parameters ---------- - index : SliceLike + index `SliceLike` to standardize. Returns @@ -62,29 +62,29 @@ def compute_rdf( Parameters ---------- - data : MaybeSequence[Atoms] + data Dataset to compute RDF of. - ana : Analysis | None + ana ASE Analysis object for data reuse. - filenames : MaybeSequence[PathLike] | None + filenames Filenames to output data to. Must match number of RDFs computed. - by_elements : bool + by_elements Split RDF into pairwise by elements group. Default is False. N.B. mixed RDFs (e.g. C-H) include all self-RDFs (e.g. C-C), to get the pure (C-H) RDF subtract the self-RDFs. - rmax : float + rmax Maximum distance of RDF. - nbins : int + nbins Number of bins to divide RDF. - elements : MaybeSequence[int | str] | None + elements Make partial RDFs. If `by_elements` is true will filter to only display pairs in list. - index : SliceLike + index Images to analyze as: `index` if `int`, `start`, `stop`, `step` if `tuple`, `slice` if `slice` or `range`. - volume : float | None + volume Volume of cell for normalisation. Only needs to be provided if aperiodic cell. Default is (2*rmax)**3. @@ -198,31 +198,31 @@ def compute_vaf( Parameters ---------- - data : Sequence[Atoms] + data Dataset to compute VAF of. - filenames : MaybeSequence[PathLike] | None + filenames If present, dump resultant VAF to file. - use_velocities : bool + use_velocities Compute VAF using velocities rather than momenta. Default is False. - fft : bool + fft Compute the fourier transformed VAF. Default is False. - index : SliceLike + index Images to analyze as `start`, `stop`, `step`. Default is all images. - filter_atoms : MaybeSequence[MaybeSequence[int | None]] + filter_atoms Compute the VAF averaged over subsets of the system. Default is all atoms. - time_step : float + time_step Time step for scaling lags to align with input data. Default is 1 (i.e. no scaling). Returns ------- - lags : numpy.ndarray + lags Lags at which the VAFs have been computed. - vafs : list[numpy.ndarray] + vafs Computed VAF(s). Notes diff --git a/janus_core/processing/symmetry.py b/janus_core/processing/symmetry.py index 1adb332b..6a3fa81f 100644 --- a/janus_core/processing/symmetry.py +++ b/janus_core/processing/symmetry.py @@ -15,12 +15,12 @@ def spacegroup( Parameters ---------- - struct : Atoms + struct Structure as an ase Atoms object. - sym_tolerance : float + sym_tolerance Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001. - angle_tolerance : float + angle_tolerance Angle precision for spglib symmetry determination, in degrees. Default is -1.0, which means an internally optimized routine is used to judge symmetry. @@ -46,9 +46,9 @@ def snap_symmetry(struct: Atoms, sym_tolerance: float = 0.001) -> None: Parameters ---------- - struct : Atoms + struct Structure as an ase Atoms object. - sym_tolerance : float + sym_tolerance Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001. """ diff --git a/janus_core/training/train.py b/janus_core/training/train.py index 72bb5610..2100a017 100644 --- a/janus_core/training/train.py +++ b/janus_core/training/train.py @@ -23,9 +23,9 @@ def check_files_exist(config: dict, req_file_keys: list[PathLike]) -> None: Parameters ---------- - config : dict + config MLIP configuration file options. - req_file_keys : list[Pathlike] + req_file_keys List of files that must exist if defined in the configuration file. Raises @@ -56,18 +56,18 @@ def train( Parameters ---------- - mlip_config : PathLike + mlip_config Configuration file to pass to MLIP. - req_file_keys : list[PathLike] | None + req_file_keys List of files that must exist if defined in the configuration file. Default is ["train_file", "test_file", "valid_file", "statistics_file"]. - attach_logger : bool + attach_logger Whether to attach a logger. Default is False. - log_kwargs : dict[str, Any] | None + log_kwargs Keyword arguments to pass to `config_logger`. Default is {}. - track_carbon : bool + track_carbon Whether to track carbon emissions of calculation. Default is True. - tracker_kwargs : dict[str, Any] | None + tracker_kwargs Keyword arguments to pass to `config_tracker`. Default is {}. """ (log_kwargs, tracker_kwargs) = none_to_dict((log_kwargs, tracker_kwargs))