janus_core package

Module contents

Tools for machine learnt interatomic potentials.

Submodules

janus_core.calculations.base module

Prepare structures for MLIP calculations.

class janus_core.calculations.base.BaseCalculation(*, calc_name: str = 'base', struct: Atoms | Sequence[Atoms] | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, sequence_allowed: bool = True, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, file_prefix: str | Path | None = None, additional_prefix: str | None = None, param_prefix: str | None = None)[source]

Bases: FileNameMixin

Prepare structures for MLIP calculations.

Parameters:
calc_namestr

Name of calculation being run, used for name of logger. Default is “base”.

structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs

Keyword arguments to pass to ase.io.read. Default is {}.

sequence_allowedbool

Whether a sequence of Atoms objects is allowed. Default is True.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

file_prefixPathLike | None

Prefix for output filenames. Default is None.

additional_prefixstr | None

Component to add to default file_prefix (joined by hyphens). Default is None.

param_prefixstr | None

Additional parameters to add to default file_prefix. Default is None.

Attributes:
loggerlogging.Logger | None

Logger if log file has been specified.

trackerOfflineEmissionsTracker | None

Tracker if logging is enabled.

__abstractmethods__ = frozenset({})
__init__(*, calc_name: str = 'base', struct: Atoms | Sequence[Atoms] | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, sequence_allowed: bool = True, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, file_prefix: str | Path | None = None, additional_prefix: str | None = None, param_prefix: str | None = None) None[source]

Read the structure being simulated and attach an MLIP calculator.

Parameters:
calc_namestr

Name of calculation being run, used for name of logger. Default is “base”.

structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. Default is {}.

sequence_allowedbool

Whether a sequence of Atoms objects is allowed. Default is True.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

file_prefixPathLike | None

Prefix for output filenames. Default is None.

additional_prefixstr | None

Component to add to default file_prefix (joined by hyphens). Default is None.

param_prefixstr | None

Additional parameters to add to default file_prefix. Default is None.

__module__ = 'janus_core.calculations.base'
_abc_impl = <_abc._abc_data object>

janus_core.calculations.descriptors module

Calculate MLIP descriptors for structures.

class janus_core.calculations.descriptors.Descriptors(struct: Atoms | Sequence[Atoms] | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, invariants_only: bool = True, calc_per_element: bool = False, calc_per_atom: bool = False, write_results: bool = False, write_kwargs: ASEWriteArgs | None = None)[source]

Bases: BaseCalculation

Prepare and calculate MLIP descriptors for structures.

Parameters:
structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to calculate descriptors for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to calculate descriptors for. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

invariants_onlybool

Whether only the invariant descriptors should be returned. Default is True.

calc_per_elementbool

Whether to calculate mean descriptors for each element. Default is False.

calc_per_atombool

Whether to calculate descriptors for each atom. Default is False.

write_resultsbool

True to write out structure with results of calculations. Default is False.

write_kwargsASEWriteArgs | None

Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}.

Methods

run()

Calculate descriptors for structure(s)

__abstractmethods__ = frozenset({})
__annotations__ = {}
__init__(struct: Atoms | Sequence[Atoms] | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, invariants_only: bool = True, calc_per_element: bool = False, calc_per_atom: bool = False, write_results: bool = False, write_kwargs: ASEWriteArgs | None = None) None[source]

Initialise class.

Parameters:
structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to calculate descriptors for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to calculate descriptors for. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

invariants_onlybool

Whether only the invariant descriptors should be returned. Default is True.

calc_per_elementbool

Whether to calculate mean descriptors for each element. Default is False.

calc_per_atombool

Whether to calculate descriptors for each atom. Default is False.

write_resultsbool

True to write out structure with results of calculations. Default is False.

write_kwargsASEWriteArgs | None

Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}.

__module__ = 'janus_core.calculations.descriptors'
_abc_impl = <_abc._abc_data object>
_calc_descriptors(struct: Atoms) None[source]

Calculate MLIP descriptors a given structure.

Parameters:
structAtoms

Structure to calculate descriptors for.

run() None[source]

Calculate descriptors for structure(s).

janus_core.calculations.eos module

Equation of State.

class janus_core.calculations.eos.EoS(struct: Atoms | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, min_volume: float = 0.95, max_volume: float = 1.05, n_volumes: int = 7, eos_type: Literal['sj', 'taylor', 'murnaghan', 'birch', 'birchmurnaghan', 'pouriertarantola', 'vinet', 'antonschmidt', 'p3'] = 'birchmurnaghan', minimize: bool = True, minimize_all: bool = False, minimize_kwargs: dict[str, Any] | None = None, write_results: bool = True, write_structures: bool = False, write_kwargs: OutputKwargs | None = None, plot_to_file: bool = False, plot_kwargs: dict[str, Any] | None = None, file_prefix: str | Path | None = None)[source]

Bases: BaseCalculation

Prepare and calculate equation of state of a structure.

Parameters:
structAtoms | None

ASE Atoms structure to calculate equation of state for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to calculate equation of state for. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

min_volumefloat

Minimum volume scale factor. Default is 0.95.

max_volumefloat

Maximum volume scale factor. Default is 1.05.

n_volumesint

Number of volumes to use. Default is 7.

eos_typeEoSNames

Type of fit for equation of state. Default is “birchmurnaghan”.

minimizebool

Whether to minimize initial structure before calculations. Default is True.

minimize_allbool

Whether to optimize geometry for all generated structures. Default is False.

minimize_kwargsdict[str, Any] | None

Keyword arguments to pass to optimize. Default is None.

write_resultsbool

True to write out results of equation of state calculations. Default is True.

write_structuresbool

True to write out all genereated structures. Default is False.

write_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write to save generated structures. Default is {}.

plot_to_filebool

Whether to save plot equation of state to svg. Default is False.

plot_kwargsdict[str, Any] | None

Keyword arguments to pass to EquationOfState.plot. Default is {}.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure name, or chemical formula of the structure.

Attributes:
resultsEoSResults

Dictionary containing equation of state ASE object, and the fitted minimum bulk modulus, volume, and energy.

volumeslist[float]

List of volumes of generated structures.

energieslist[float]

List of energies of generated structures.

lattice_scalarsNDArray[float64]

Lattice scalars of generated structures.

Methods

run()

Calculate equation of state.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__init__(struct: Atoms | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, min_volume: float = 0.95, max_volume: float = 1.05, n_volumes: int = 7, eos_type: Literal['sj', 'taylor', 'murnaghan', 'birch', 'birchmurnaghan', 'pouriertarantola', 'vinet', 'antonschmidt', 'p3'] = 'birchmurnaghan', minimize: bool = True, minimize_all: bool = False, minimize_kwargs: dict[str, Any] | None = None, write_results: bool = True, write_structures: bool = False, write_kwargs: OutputKwargs | None = None, plot_to_file: bool = False, plot_kwargs: dict[str, Any] | None = None, file_prefix: str | Path | None = None) None[source]

Initialise class.

Parameters:
structAtoms | None

ASE Atoms structure to optimize geometry for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to optimize. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for optimization. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

min_volumefloat

Minimum volume scale factor. Default is 0.95.

max_volumefloat

Maximum volume scale factor. Default is 1.05.

n_volumesint

Number of volumes to use. Default is 7.

eos_typeEoSNames

Type of fit for equation of state. Default is “birchmurnaghan”.

minimizebool

Whether to minimize initial structure before calculations. Default is True.

minimize_allbool

Whether to optimize geometry for all generated structures. Default is False.

minimize_kwargsdict[str, Any] | None

Keyword arguments to pass to optimize. Default is None.

write_resultsbool

True to write out results of equation of state calculations. Default is True.

write_structuresbool

True to write out all genereated structures. Default is False.

write_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write to save generated structures. Default is {}.

plot_to_filebool

Whether to save plot equation of state to svg. Default is False.

plot_kwargsdict[str, Any] | None

Keyword arguments to pass to EquationOfState.plot. Default is {}.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure name, or chemical formula of the structure.

__module__ = 'janus_core.calculations.eos'
_abc_impl = <_abc._abc_data object>
_calc_volumes_energies() None[source]

Calculate volumes and energies for all lattice constants.

run() EoSResults[source]

Calculate equation of state.

Returns:
EoSResults

Dictionary containing equation of state ASE object, and the fitted minimum bulk modulus, volume, and energy.

janus_core.calculations.geom_opt module

Prepare and run geometry optimization.

class janus_core.calculations.geom_opt.GeomOpt(struct: ~ase.atoms.Atoms | None = None, struct_path: str | ~pathlib.Path | None = None, arch: ~typing.Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: ~typing.Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | ~pathlib.Path | None = None, read_kwargs: ~janus_core.helpers.janus_types.ASEReadArgs | None = None, calc_kwargs: dict[str, ~typing.Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, ~typing.Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, ~typing.Any] | None = None, fmax: float = 0.1, steps: int = 1000, symmetrize: bool = False, symmetry_tolerance: float = 0.001, angle_tolerance: float = -1.0, filter_func: ~typing.Callable | str | None = <class 'ase.filters.FrechetCellFilter'>, filter_kwargs: dict[str, ~typing.Any] | None = None, optimizer: ~typing.Callable | str = <class 'ase.optimize.lbfgs.LBFGS'>, opt_kwargs: ~janus_core.helpers.janus_types.ASEOptArgs | None = None, write_results: bool = False, write_kwargs: ~janus_core.helpers.janus_types.OutputKwargs | None = None, traj_kwargs: ~janus_core.helpers.janus_types.OutputKwargs | None = None)[source]

Bases: BaseCalculation

Prepare and run geometry optimization.

Parameters:
structAtoms | None

ASE Atoms structure to optimize geometry for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to optimize. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for optimization. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

fmaxfloat

Set force convergence criteria for optimizer in units eV/Å. Default is 0.1.

stepsint

Set maximum number of optimization steps to run. Default is 1000.

symmetrizebool

Whether to refine symmetry after geometry optimization. Default is False.

symmetry_tolerancefloat

Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001.

angle_tolerancefloat

Angle precision for spglib symmetry determination, in degrees. Default is -1.0, which means an internally optimized routine is used to judge symmetry.

filter_funcCallable | str | None

Filter function, or name of function from ase.filters to apply constraints to atoms. Default is FrechetCellFilter.

filter_kwargsdict[str, Any] | None

Keyword arguments to pass to filter_func. Default is {}.

optimizerCallable | str

Optimization function, or name of function from ase.optimize. Default is LBFGS.

opt_kwargsASEOptArgs | None

Keyword arguments to pass to optimizer. Default is {}.

write_resultsbool

True to write out optimized structure. Default is False.

write_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write to save optimized structure. Default is {}.

traj_kwargsOutputKwargs | None

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.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__init__(struct: ~ase.atoms.Atoms | None = None, struct_path: str | ~pathlib.Path | None = None, arch: ~typing.Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: ~typing.Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | ~pathlib.Path | None = None, read_kwargs: ~janus_core.helpers.janus_types.ASEReadArgs | None = None, calc_kwargs: dict[str, ~typing.Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, ~typing.Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, ~typing.Any] | None = None, fmax: float = 0.1, steps: int = 1000, symmetrize: bool = False, symmetry_tolerance: float = 0.001, angle_tolerance: float = -1.0, filter_func: ~typing.Callable | str | None = <class 'ase.filters.FrechetCellFilter'>, filter_kwargs: dict[str, ~typing.Any] | None = None, optimizer: ~typing.Callable | str = <class 'ase.optimize.lbfgs.LBFGS'>, opt_kwargs: ~janus_core.helpers.janus_types.ASEOptArgs | None = None, write_results: bool = False, write_kwargs: ~janus_core.helpers.janus_types.OutputKwargs | None = None, traj_kwargs: ~janus_core.helpers.janus_types.OutputKwargs | None = None) None[source]

Initialise GeomOpt class.

Parameters:
structAtoms | None

ASE Atoms structure to optimize geometry for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to optimize. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for optimization. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

fmaxfloat

Set force convergence criteria for optimizer in units eV/Å. Default is 0.1.

stepsint

Set maximum number of optimization steps to run. Default is 1000.

symmetrizebool

Whether to refine symmetry after geometry optimization. Default is False.

symmetry_tolerancefloat

Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001.

angle_tolerancefloat

Angle precision for spglib symmetry determination, in degrees. Default is -1.0, which means an internally optimized routine is used to judge symmetry.

filter_funcCallable | str | None

Filter function, or name of function from ase.filters to apply constraints to atoms. Default is FrechetCellFilter.

filter_kwargsdict[str, Any] | None

Keyword arguments to pass to filter_func. Default is {}.

optimizerCallable | str

Optimization function, or name of function from ase.optimize. Default is LBFGS.

opt_kwargsASEOptArgs | None

Keyword arguments to pass to optimizer. Default is {}.

write_resultsbool

True to write out optimized structure. Default is False.

write_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write to save optimized structure. Default is {}.

traj_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write to save optimization trajectory. Must include “filename” keyword. Default is {}.

__module__ = 'janus_core.calculations.geom_opt'
_abc_impl = <_abc._abc_data object>
_set_functions() None[source]

Set optimizer and filter functions.

run() None[source]

Run geometry optimization.

set_optimizer() None[source]

Set optimizer for geometry optimization.

janus_core.calculations.md module

Run molecular dynamics simulations.

class janus_core.calculations.md.MolecularDynamics(struct: Atoms | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] | None = None, steps: int = 0, timestep: float = 1.0, temp: float = 300, equil_steps: int = 0, minimize: bool = False, minimize_every: int = -1, minimize_kwargs: dict[str, Any] | None = None, rescale_velocities: bool = False, remove_rot: bool = False, rescale_every: int = 10, file_prefix: str | Path | None = None, restart: bool = False, restart_auto: bool = True, restart_stem: str | Path | None = None, restart_every: int = 1000, rotate_restart: bool = False, restarts_to_keep: int = 4, final_file: str | Path | None = None, stats_file: str | Path | None = None, stats_every: int = 100, traj_file: str | Path | None = None, traj_append: bool = False, traj_start: int = 0, traj_every: int = 100, temp_start: float | None = None, temp_end: float | None = None, temp_step: float | None = None, temp_time: float | None = None, write_kwargs: OutputKwargs | None = None, post_process_kwargs: PostProcessKwargs | None = None, correlation_kwargs: list[CorrelationKwargs] | None = None, seed: int | None = None)[source]

Bases: BaseCalculation

Configure shared molecular dynamics simulation options.

Parameters:
structAtoms | None

ASE Atoms structure to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for simulation. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

structAtoms

Structure to simulate.

ensembleEnsembles

Name for thermodynamic ensemble. Default is None.

stepsint

Number of steps in simulation. Default is 0.

timestepfloat

Timestep for integrator, in fs. Default is 1.0.

tempfloat

Temperature, in K. Default is 300.

equil_stepsint

Maximum number of steps at which to perform optimization and reset velocities. Default is 0.

minimizebool

Whether to minimize structure during equilibration. Default is False.

minimize_everyint

Frequency of minimizations. Default is -1, which disables minimization after beginning dynamics.

minimize_kwargsdict[str, Any] | None

Keyword arguments to pass to geometry optimizer. Default is {}.

rescale_velocitiesbool

Whether to rescale velocities. Default is False.

remove_rotbool

Whether to remove rotation. Default is False.

rescale_everyint

Frequency to rescale velocities. Default is 10.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure, ensemble, and temperature.

restartbool

Whether restarting dynamics. Default is False.

restart_autobool

Whether to infer restart file name if restarting dynamics. Default is True.

restart_stemstr

Stem for restart file name. Default inferred from file_prefix.

restart_everyint

Frequency of steps to save restart info. Default is 1000.

rotate_restartbool

Whether to rotate restart files. Default is False.

restarts_to_keepint

Restart files to keep if rotating. Default is 4.

final_filePathLike | None

File to save final configuration at each temperature of similation. Default inferred from file_prefix.

stats_filePathLike | None

File to save thermodynamical statistics. Default inferred from file_prefix.

stats_everyint

Frequency to output statistics. Default is 100.

traj_filePathLike | None

Trajectory file to save. Default inferred from file_prefix.

traj_appendbool

Whether to append trajectory. Default is False.

traj_startint

Step to start saving trajectory. Default is 0.

traj_everyint

Frequency of steps to save trajectory. Default is 100.

temp_startfloat | None

Temperature to start heating, in K. Default is None, which disables heating.

temp_endfloat | None

Maximum temperature for heating, in K. Default is None, which disables heating.

temp_stepfloat | None

Size of temperature steps when heating, in K. Default is None, which disables heating.

temp_timefloat | None

Time between heating steps, in fs. Default is None, which disables heating.

write_kwargsOutputKwargs | None

Keyword arguments to pass to output_structs when saving trajectory and final files. Default is {}.

post_process_kwargsPostProcessKwargs | None

Keyword arguments to control post-processing operations.

correlation_kwargsCorrelationKwargs | None

Keyword arguments to control on-the-fly correlations.

seedint | None

Random seed used by numpy.random and random functions, such as in Langevin. Default is None.

Attributes:
dynDynamics

Dynamics object to run simulation.

n_atomsint

Number of atoms in structure being simulated.

restart_fileslist[PathLike]

List of files saved to restart dynamics.

offsetint

Number of previous steps if restarting simulation.

created_finalbool

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.

__abstractmethods__ = frozenset({})
__annotations__ = {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.md', '__doc__': '\n    Configure shared molecular dynamics simulation options.\n\n    Parameters\n    ----------\n    struct : Atoms | None\n        ASE Atoms structure to simulate. Required if `struct_path` is None. Default is\n        None.\n    struct_path : PathLike | None\n        Path of structure to simulate. Required if `struct` is None. Default is None.\n    arch : Architectures\n        MLIP architecture to use for simulation. Default is "mace_mp".\n    device : Devices\n        Device to run MLIP model on. Default is "cpu".\n    model_path : PathLike | None\n        Path to MLIP model. Default is `None`.\n    read_kwargs : ASEReadArgs | None\n        Keyword arguments to pass to ase.io.read. By default,\n        read_kwargs["index"] is -1.\n    calc_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to the selected calculator. Default is {}.\n    set_calc : bool | None\n        Whether to set (new) calculators for structures. Default is None.\n    attach_logger : bool\n        Whether to attach a logger. Default is False.\n    log_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to `config_logger`. Default is {}.\n    track_carbon : bool\n        Whether to track carbon emissions of calculation. Default is True.\n    tracker_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to `config_tracker`. Default is {}.\n    struct : Atoms\n        Structure to simulate.\n    ensemble : Ensembles\n        Name for thermodynamic ensemble. Default is None.\n    steps : int\n        Number of steps in simulation. Default is 0.\n    timestep : float\n        Timestep for integrator, in fs. Default is 1.0.\n    temp : float\n        Temperature, in K. Default is 300.\n    equil_steps : int\n        Maximum number of steps at which to perform optimization and reset velocities.\n        Default is 0.\n    minimize : bool\n        Whether to minimize structure during equilibration. Default is False.\n    minimize_every : int\n        Frequency of minimizations. Default is -1, which disables minimization after\n        beginning dynamics.\n    minimize_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to geometry optimizer. Default is {}.\n    rescale_velocities : bool\n        Whether to rescale velocities. Default is False.\n    remove_rot : bool\n        Whether to remove rotation. Default is False.\n    rescale_every : int\n        Frequency to rescale velocities. Default is 10.\n    file_prefix : PathLike | None\n        Prefix for output filenames. Default is inferred from structure, ensemble,\n        and temperature.\n    restart : bool\n        Whether restarting dynamics. Default is False.\n    restart_auto : bool\n        Whether to infer restart file name if restarting dynamics. Default is True.\n    restart_stem : str\n        Stem for restart file name. Default inferred from `file_prefix`.\n    restart_every : int\n        Frequency of steps to save restart info. Default is 1000.\n    rotate_restart : bool\n        Whether to rotate restart files. Default is False.\n    restarts_to_keep : int\n        Restart files to keep if rotating. Default is 4.\n    final_file : PathLike | None\n        File to save final configuration at each temperature of similation. Default\n        inferred from `file_prefix`.\n    stats_file : PathLike | None\n        File to save thermodynamical statistics. Default inferred from `file_prefix`.\n    stats_every : int\n        Frequency to output statistics. Default is 100.\n    traj_file : PathLike | None\n        Trajectory file to save. Default inferred from `file_prefix`.\n    traj_append : bool\n        Whether to append trajectory. Default is False.\n    traj_start : int\n        Step to start saving trajectory. Default is 0.\n    traj_every : int\n        Frequency of steps to save trajectory. Default is 100.\n    temp_start : float | None\n        Temperature to start heating, in K. Default is None, which disables heating.\n    temp_end : float | None\n        Maximum temperature for heating, in K. Default is None, which disables heating.\n    temp_step : float | None\n        Size of temperature steps when heating, in K. Default is None, which disables\n        heating.\n    temp_time : float | None\n        Time between heating steps, in fs. Default is None, which disables heating.\n    write_kwargs : OutputKwargs | None\n        Keyword arguments to pass to `output_structs` when saving trajectory and final\n        files. Default is {}.\n    post_process_kwargs : PostProcessKwargs | None\n        Keyword arguments to control post-processing operations.\n    correlation_kwargs : CorrelationKwargs | None\n        Keyword arguments to control on-the-fly correlations.\n    seed : int | None\n        Random seed used by numpy.random and random functions, such as in Langevin.\n        Default is None.\n\n    Attributes\n    ----------\n    dyn : Dynamics\n        Dynamics object to run simulation.\n    n_atoms : int\n        Number of atoms in structure being simulated.\n    restart_files : list[PathLike]\n        List of files saved to restart dynamics.\n    offset : int\n        Number of previous steps if restarting simulation.\n    created_final : bool\n        Whether the final structure file has been created.\n\n    Methods\n    -------\n    run()\n        Run molecular dynamics simulation and/or heating ramp.\n    get_stats()\n        Get thermodynamical statistics to be written to file.\n    ', '__init__': <function MolecularDynamics.__init__>, '_set_info': <function MolecularDynamics._set_info>, '_prepare_restart': <function MolecularDynamics._prepare_restart>, '_rotate_restart_files': <function MolecularDynamics._rotate_restart_files>, '_set_velocity_distribution': <function MolecularDynamics._set_velocity_distribution>, '_reset_velocities': <function MolecularDynamics._reset_velocities>, '_optimize_structure': <function MolecularDynamics._optimize_structure>, '_set_param_prefix': <function MolecularDynamics._set_param_prefix>, '_restart_stem': <property object>, '_restart_file': <property object>, '_parse_correlations': <function MolecularDynamics._parse_correlations>, '_attach_correlations': <function MolecularDynamics._attach_correlations>, '_write_correlations': <function MolecularDynamics._write_correlations>, 'get_stats': <function MolecularDynamics.get_stats>, 'unit_info': <property object>, 'default_formats': <property object>, '_write_header': <function MolecularDynamics._write_header>, '_write_stats_file': <function MolecularDynamics._write_stats_file>, '_write_traj': <function MolecularDynamics._write_traj>, '_write_final_state': <function MolecularDynamics._write_final_state>, '_post_process': <function MolecularDynamics._post_process>, '_write_restart': <function MolecularDynamics._write_restart>, 'run': <function MolecularDynamics.run>, '_run_dynamics': <function MolecularDynamics._run_dynamics>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}})
__init__(struct: Atoms | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] | None = None, steps: int = 0, timestep: float = 1.0, temp: float = 300, equil_steps: int = 0, minimize: bool = False, minimize_every: int = -1, minimize_kwargs: dict[str, Any] | None = None, rescale_velocities: bool = False, remove_rot: bool = False, rescale_every: int = 10, file_prefix: str | Path | None = None, restart: bool = False, restart_auto: bool = True, restart_stem: str | Path | None = None, restart_every: int = 1000, rotate_restart: bool = False, restarts_to_keep: int = 4, final_file: str | Path | None = None, stats_file: str | Path | None = None, stats_every: int = 100, traj_file: str | Path | None = None, traj_append: bool = False, traj_start: int = 0, traj_every: int = 100, temp_start: float | None = None, temp_end: float | None = None, temp_step: float | None = None, temp_time: float | None = None, write_kwargs: OutputKwargs | None = None, post_process_kwargs: PostProcessKwargs | None = None, correlation_kwargs: list[CorrelationKwargs] | None = None, seed: int | None = None) None[source]

Initialise molecular dynamics simulation configuration.

Parameters:
structAtoms | None

ASE Atoms structure to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for simulation. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

ensembleEnsembles

Name for thermodynamic ensemble. Default is None.

stepsint

Number of steps in simulation. Default is 0.

timestepfloat

Timestep for integrator, in fs. Default is 1.0.

tempfloat

Temperature, in K. Default is 300.

equil_stepsint

Maximum number of steps at which to perform optimization and reset velocities. Default is 0.

minimizebool

Whether to minimize structure during equilibration. Default is False.

minimize_everyint

Frequency of minimizations. Default is -1, which disables minimization after beginning dynamics.

minimize_kwargsdict[str, Any] | None

Keyword arguments to pass to geometry optimizer. Default is {}.

rescale_velocitiesbool

Whether to rescale velocities. Default is False.

remove_rotbool

Whether to remove rotation. Default is False.

rescale_everyint

Frequency to rescale velocities. Default is 10.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure, ensemble, and temperature.

restartbool

Whether restarting dynamics. Default is False.

restart_autobool

Whether to infer restart file name if restarting dynamics. Default is True.

restart_stemstr

Stem for restart file name. Default inferred from file_prefix.

restart_everyint

Frequency of steps to save restart info. Default is 1000.

rotate_restartbool

Whether to rotate restart files. Default is False.

restarts_to_keepint

Restart files to keep if rotating. Default is 4.

final_filePathLike | None

File to save final configuration at each temperature of similation. Default inferred from file_prefix.

stats_filePathLike | None

File to save thermodynamical statistics. Default inferred from file_prefix.

stats_everyint

Frequency to output statistics. Default is 100.

traj_filePathLike | None

Trajectory file to save. Default inferred from file_prefix.

traj_appendbool

Whether to append trajectory. Default is False.

traj_startint

Step to start saving trajectory. Default is 0.

traj_everyint

Frequency of steps to save trajectory. Default is 100.

temp_startfloat | None

Temperature to start heating, in K. Default is None, which disables heating.

temp_endfloat | None

Maximum temperature for heating, in K. Default is None, which disables heating.

temp_stepfloat | None

Size of temperature steps when heating, in K. Default is None, which disables heating.

temp_timefloat | None

Time between heating steps, in fs. Default is None, which disables heating.

write_kwargsOutputKwargs | None

Keyword arguments to pass to output_structs when saving trajectory and final files. Default is {}.

post_process_kwargsPostProcessKwargs | None

Keyword arguments to control post-processing operations.

correlation_kwargslist[CorrelationKwargs] | None

Keyword arguments to control on-the-fly correlations.

seedint | None

Random seed used by numpy.random and random functions, such as in Langevin. Default is None.

__module__ = 'janus_core.calculations.md'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_attach_correlations() None[source]

Attach all correlations to self.dyn.

_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

_optimize_structure() None[source]

Perform geometry optimization.

_parse_correlations() None[source]

Parse correlation kwargs into Correlations.

_post_process() None[source]

Compute properties after MD run.

_prepare_restart() None[source]

Prepare restart files, structure and offset.

_reset_velocities() None[source]

Reset velocities and (optionally) rotation of system while equilibrating.

property _restart_file: str

Restart file name.

Returns:
str

File name for restart files.

property _restart_stem: str

Stem for restart files.

Restart files will be named {restart_stem}-{step}.extxyz. If file_prefix is specified, restart_stem will be of the form {file_prefix}-{param_prefix}-res.

Returns:
str

Stem for restart files.

_rotate_restart_files() None[source]

Rotate restart files.

_run_dynamics() None[source]

Run dynamics and/or temperature ramp.

_set_info() None[source]

Set time in fs, current dynamics step, and density to info.

_set_param_prefix(file_prefix: str | Path | None = None) str[source]

Set ensemble parameters for output files.

Parameters:
file_prefixPathLike | None

Prefix for output filenames on class init. If not None, param_prefix = “”.

Returns:
str

Formatted ensemble parameters, including temp ramp range and/or and MD temp.

_set_velocity_distribution() None[source]

Set velocities to current target temperature.

Sets Maxwell-Boltzmann velocity distribution, as well as removing centre-of-mass momentum, and (optionally) total angular momentum.

_write_correlations() None[source]

Write out the correlations.

_write_final_state() None[source]

Write the final system state.

_write_header() None[source]

Write header for stats file.

_write_restart() None[source]

Write restart file and (optionally) rotate files saved.

_write_stats_file() None[source]

Write molecular dynamics statistics.

_write_traj() None[source]

Write current structure to trajectory file.

property default_formats: dict[str, str]

Default format of returned statistics.

Returns:
dict[str, str]

Default formats attached to statistical properties.

get_stats() dict[str, float][source]

Get thermodynamical statistics to be written to file.

Returns:
dict[str, float]

Thermodynamical statistics to be written out.

run() None[source]

Run molecular dynamics simulation and/or temperature ramp.

property unit_info: dict[str, str]

Get units of returned statistics.

Returns:
dict[str, str]

Units attached to statistical properties.

class janus_core.calculations.md.NPH(*args, thermostat_time: float = 50.0, bulk_modulus: float = 2.0, pressure: float = 0.0, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nph', file_prefix: str | Path | None = None, ensemble_kwargs: dict[str, Any] | None = None, **kwargs)[source]

Bases: NPT

Configure NPH simulation.

Parameters:
*args

Additional arguments.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

bulk_modulusfloat

Bulk modulus, in GPa. Default is 2.0.

pressurefloat

Pressure, in GPa. Default is 0.0.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nph”.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

Attributes:
dynDynamics

Configured NVE dynamics.

Methods

get_stats()

Get thermodynamical statistics to be written to file.

run()

Run molecular dynamics simulation and/or temperature ramp.

__abstractmethods__ = frozenset({})
__annotations__ = {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.md', '__doc__': '\n    Configure NPH simulation.\n\n    Parameters\n    ----------\n    *args\n        Additional arguments.\n    thermostat_time : float\n        Thermostat time, in fs. Default is 50.0.\n    bulk_modulus : float\n        Bulk modulus, in GPa. Default is 2.0.\n    pressure : float\n        Pressure, in GPa. Default is 0.0.\n    ensemble : Ensembles\n        Name for thermodynamic ensemble. Default is "nph".\n    file_prefix : PathLike | None\n        Prefix for output filenames. Default is inferred from structure, ensemble,\n        temperature, and pressure.\n    ensemble_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to ensemble initialization. Default is {}.\n    **kwargs\n        Additional keyword arguments.\n\n    Attributes\n    ----------\n    dyn : Dynamics\n        Configured NVE dynamics.\n    ', '__init__': <function NPH.__init__>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}})
__init__(*args, thermostat_time: float = 50.0, bulk_modulus: float = 2.0, pressure: float = 0.0, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nph', file_prefix: str | Path | None = None, ensemble_kwargs: dict[str, Any] | None = None, **kwargs) None[source]

Initialise dynamics for NPH simulation.

Parameters:
*args

Additional arguments.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

bulk_modulusfloat

Bulk modulus, in GPa. Default is 2.0.

pressurefloat

Pressure, in GPa. Default is 0.0.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nph”.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

__module__ = 'janus_core.calculations.md'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_attach_correlations() None

Attach all correlations to self.dyn.

_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

_optimize_structure() None

Perform geometry optimization.

_parse_correlations() None

Parse correlation kwargs into Correlations.

_post_process() None

Compute properties after MD run.

_prepare_restart() None

Prepare restart files, structure and offset.

_reset_velocities() None

Reset velocities and (optionally) rotation of system while equilibrating.

property _restart_file: str

Restart file name.

Returns:
str

File name for restart files.

property _restart_stem: str

Stem for restart files.

Restart files will be named {restart_stem}-{step}.extxyz. If file_prefix is specified, restart_stem will be of the form {file_prefix}-{param_prefix}-res.

Returns:
str

Stem for restart files.

_rotate_restart_files() None

Rotate restart files.

_run_dynamics() None

Run dynamics and/or temperature ramp.

_set_info() None

Set time in fs, current dynamics step, and density to info.

_set_param_prefix(file_prefix: str | Path | None = None) str

Set ensemble parameters for output files.

Parameters:
file_prefixPathLike | None

Prefix for output filenames on class init. If not None, param_prefix = “”.

Returns:
str

Formatted ensemble parameters, including pressure and temperature(s).

_set_velocity_distribution() None

Set velocities to current target temperature.

Sets Maxwell-Boltzmann velocity distribution, as well as removing centre-of-mass momentum, and (optionally) total angular momentum.

_write_correlations() None

Write out the correlations.

_write_final_state() None

Write the final system state.

_write_header() None

Write header for stats file.

_write_restart() None

Write restart file and (optionally) rotate files saved.

_write_stats_file() None

Write molecular dynamics statistics.

_write_traj() None

Write current structure to trajectory file.

property default_formats: dict[str, str]

Default format of returned statistics.

Returns:
dict[str, str]

Default formats attached to statistical properties.

dyn: Langevin | VelocityVerlet | NPT
get_stats() dict[str, float]

Get thermodynamical statistics to be written to file.

Returns:
dict[str, float]

Thermodynamical statistics to be written out.

run() None

Run molecular dynamics simulation and/or temperature ramp.

property unit_info: dict[str, str]

Get units of returned statistics.

Returns:
dict[str, str]

Units attached to statistical properties.

class janus_core.calculations.md.NPT(*args, thermostat_time: float = 50.0, barostat_time: float = 75.0, bulk_modulus: float = 2.0, pressure: float = 0.0, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'npt', file_prefix: str | Path | None = None, ensemble_kwargs: dict[str, Any] | None = None, **kwargs)[source]

Bases: MolecularDynamics

Configure NPT dynamics.

Parameters:
*args

Additional arguments.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

barostat_timefloat

Barostat time, in fs. Default is 75.0.

bulk_modulusfloat

Bulk modulus, in GPa. Default is 2.0.

pressurefloat

Pressure, in GPa. Default is 0.0.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “npt”.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

Attributes:
dynDynamics

Configured NPT dynamics.

Methods

get_stats()

Get thermodynamical statistics to be written to file.

run()

Run molecular dynamics simulation and/or temperature ramp.

__abstractmethods__ = frozenset({})
__annotations__ = {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.md', '__doc__': '\n    Configure NPT dynamics.\n\n    Parameters\n    ----------\n    *args\n        Additional arguments.\n    thermostat_time : float\n        Thermostat time, in fs. Default is 50.0.\n    barostat_time : float\n        Barostat time, in fs. Default is 75.0.\n    bulk_modulus : float\n        Bulk modulus, in GPa. Default is 2.0.\n    pressure : float\n        Pressure, in GPa. Default is 0.0.\n    ensemble : Ensembles\n        Name for thermodynamic ensemble. Default is "npt".\n    file_prefix : PathLike | None\n        Prefix for output filenames. Default is inferred from structure, ensemble,\n        temperature, and pressure.\n    ensemble_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to ensemble initialization. Default is {}.\n    **kwargs\n        Additional keyword arguments.\n\n    Attributes\n    ----------\n    dyn : Dynamics\n        Configured NPT dynamics.\n    ', '__init__': <function NPT.__init__>, '_set_param_prefix': <function NPT._set_param_prefix>, 'get_stats': <function NPT.get_stats>, 'unit_info': <property object>, 'default_formats': <property object>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}})
__init__(*args, thermostat_time: float = 50.0, barostat_time: float = 75.0, bulk_modulus: float = 2.0, pressure: float = 0.0, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'npt', file_prefix: str | Path | None = None, ensemble_kwargs: dict[str, Any] | None = None, **kwargs) None[source]

Initialise dynamics for NPT simulation.

Parameters:
*args

Additional arguments.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

barostat_timefloat

Barostat time, in fs. Default is 75.0.

bulk_modulusfloat

Bulk modulus, in GPa. Default is 2.0.

pressurefloat

Pressure, in GPa. Default is 0.0.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “npt”.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure, ensemble, temperature, and pressure.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

__module__ = 'janus_core.calculations.md'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_attach_correlations() None

Attach all correlations to self.dyn.

_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

_optimize_structure() None

Perform geometry optimization.

_parse_correlations() None

Parse correlation kwargs into Correlations.

_post_process() None

Compute properties after MD run.

_prepare_restart() None

Prepare restart files, structure and offset.

_reset_velocities() None

Reset velocities and (optionally) rotation of system while equilibrating.

property _restart_file: str

Restart file name.

Returns:
str

File name for restart files.

property _restart_stem: str

Stem for restart files.

Restart files will be named {restart_stem}-{step}.extxyz. If file_prefix is specified, restart_stem will be of the form {file_prefix}-{param_prefix}-res.

Returns:
str

Stem for restart files.

_rotate_restart_files() None

Rotate restart files.

_run_dynamics() None

Run dynamics and/or temperature ramp.

_set_info() None

Set time in fs, current dynamics step, and density to info.

_set_param_prefix(file_prefix: str | Path | None = None) str[source]

Set ensemble parameters for output files.

Parameters:
file_prefixPathLike | None

Prefix for output filenames on class init. If not None, param_prefix = “”.

Returns:
str

Formatted ensemble parameters, including pressure and temperature(s).

_set_velocity_distribution() None

Set velocities to current target temperature.

Sets Maxwell-Boltzmann velocity distribution, as well as removing centre-of-mass momentum, and (optionally) total angular momentum.

_write_correlations() None

Write out the correlations.

_write_final_state() None

Write the final system state.

_write_header() None

Write header for stats file.

_write_restart() None

Write restart file and (optionally) rotate files saved.

_write_stats_file() None

Write molecular dynamics statistics.

_write_traj() None

Write current structure to trajectory file.

property default_formats: dict[str, str]

Default format of returned statistics.

Returns:
dict[str, str]

Default formats attached to statistical properties.

dyn: Langevin | VelocityVerlet | NPT
get_stats() dict[str, float][source]

Get thermodynamical statistics to be written to file.

Returns:
dict[str, float]

Thermodynamical statistics to be written out.

run() None

Run molecular dynamics simulation and/or temperature ramp.

property unit_info: dict[str, str]

Get units of returned statistics.

Returns:
dict[str, str]

Units attached to statistical properties.

class janus_core.calculations.md.NVE(*args, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nve', ensemble_kwargs: dict[str, Any] | None = None, **kwargs)[source]

Bases: MolecularDynamics

Configure NVE simulation.

Parameters:
*args

Additional arguments.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nve”.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

Attributes:
dynDynamics

Configured NVE dynamics.

Methods

get_stats()

Get thermodynamical statistics to be written to file.

run()

Run molecular dynamics simulation and/or temperature ramp.

__abstractmethods__ = frozenset({})
__annotations__ = {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.md', '__doc__': '\n    Configure NVE simulation.\n\n    Parameters\n    ----------\n    *args\n        Additional arguments.\n    ensemble : Ensembles\n        Name for thermodynamic ensemble. Default is "nve".\n    ensemble_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to ensemble initialization. Default is {}.\n    **kwargs\n        Additional keyword arguments.\n\n    Attributes\n    ----------\n    dyn : Dynamics\n        Configured NVE dynamics.\n    ', '__init__': <function NVE.__init__>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}})
__init__(*args, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nve', ensemble_kwargs: dict[str, Any] | None = None, **kwargs) None[source]

Initialise dynamics for NVE simulation.

Parameters:
*args

Additional arguments.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nve”.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

__module__ = 'janus_core.calculations.md'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_attach_correlations() None

Attach all correlations to self.dyn.

_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

_optimize_structure() None

Perform geometry optimization.

_parse_correlations() None

Parse correlation kwargs into Correlations.

_post_process() None

Compute properties after MD run.

_prepare_restart() None

Prepare restart files, structure and offset.

_reset_velocities() None

Reset velocities and (optionally) rotation of system while equilibrating.

property _restart_file: str

Restart file name.

Returns:
str

File name for restart files.

property _restart_stem: str

Stem for restart files.

Restart files will be named {restart_stem}-{step}.extxyz. If file_prefix is specified, restart_stem will be of the form {file_prefix}-{param_prefix}-res.

Returns:
str

Stem for restart files.

_rotate_restart_files() None

Rotate restart files.

_run_dynamics() None

Run dynamics and/or temperature ramp.

_set_info() None

Set time in fs, current dynamics step, and density to info.

_set_param_prefix(file_prefix: str | Path | None = None) str

Set ensemble parameters for output files.

Parameters:
file_prefixPathLike | None

Prefix for output filenames on class init. If not None, param_prefix = “”.

Returns:
str

Formatted ensemble parameters, including temp ramp range and/or and MD temp.

_set_velocity_distribution() None

Set velocities to current target temperature.

Sets Maxwell-Boltzmann velocity distribution, as well as removing centre-of-mass momentum, and (optionally) total angular momentum.

_write_correlations() None

Write out the correlations.

_write_final_state() None

Write the final system state.

_write_header() None

Write header for stats file.

_write_restart() None

Write restart file and (optionally) rotate files saved.

_write_stats_file() None

Write molecular dynamics statistics.

_write_traj() None

Write current structure to trajectory file.

property default_formats: dict[str, str]

Default format of returned statistics.

Returns:
dict[str, str]

Default formats attached to statistical properties.

dyn: Langevin | VelocityVerlet | NPT
get_stats() dict[str, float]

Get thermodynamical statistics to be written to file.

Returns:
dict[str, float]

Thermodynamical statistics to be written out.

run() None

Run molecular dynamics simulation and/or temperature ramp.

property unit_info: dict[str, str]

Get units of returned statistics.

Returns:
dict[str, str]

Units attached to statistical properties.

class janus_core.calculations.md.NVT(*args, friction: float = 0.005, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nvt', ensemble_kwargs: dict[str, Any] | None = None, **kwargs)[source]

Bases: MolecularDynamics

Configure NVT simulation.

Parameters:
*args

Additional arguments.

frictionfloat

Friction coefficient in fs^-1. Default is 0.005.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nvt”.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

Attributes:
dynDynamics

Configured NVT dynamics.

Methods

get_stats()

Get thermodynamical statistics to be written to file.

run()

Run molecular dynamics simulation and/or temperature ramp.

__abstractmethods__ = frozenset({})
__annotations__ = {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.md', '__doc__': '\n    Configure NVT simulation.\n\n    Parameters\n    ----------\n    *args\n        Additional arguments.\n    friction : float\n        Friction coefficient in fs^-1. Default is 0.005.\n    ensemble : Ensembles\n        Name for thermodynamic ensemble. Default is "nvt".\n    ensemble_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to ensemble initialization. Default is {}.\n    **kwargs\n        Additional keyword arguments.\n\n    Attributes\n    ----------\n    dyn : Dynamics\n        Configured NVT dynamics.\n    ', '__init__': <function NVT.__init__>, 'get_stats': <function NVT.get_stats>, 'unit_info': <property object>, 'default_formats': <property object>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}})
__init__(*args, friction: float = 0.005, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nvt', ensemble_kwargs: dict[str, Any] | None = None, **kwargs) None[source]

Initialise dynamics for NVT simulation.

Parameters:
*args

Additional arguments.

frictionfloat

Friction coefficient in fs^-1. Default is 0.005.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nvt”.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

__module__ = 'janus_core.calculations.md'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_attach_correlations() None

Attach all correlations to self.dyn.

_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

_optimize_structure() None

Perform geometry optimization.

_parse_correlations() None

Parse correlation kwargs into Correlations.

_post_process() None

Compute properties after MD run.

_prepare_restart() None

Prepare restart files, structure and offset.

_reset_velocities() None

Reset velocities and (optionally) rotation of system while equilibrating.

property _restart_file: str

Restart file name.

Returns:
str

File name for restart files.

property _restart_stem: str

Stem for restart files.

Restart files will be named {restart_stem}-{step}.extxyz. If file_prefix is specified, restart_stem will be of the form {file_prefix}-{param_prefix}-res.

Returns:
str

Stem for restart files.

_rotate_restart_files() None

Rotate restart files.

_run_dynamics() None

Run dynamics and/or temperature ramp.

_set_info() None

Set time in fs, current dynamics step, and density to info.

_set_param_prefix(file_prefix: str | Path | None = None) str

Set ensemble parameters for output files.

Parameters:
file_prefixPathLike | None

Prefix for output filenames on class init. If not None, param_prefix = “”.

Returns:
str

Formatted ensemble parameters, including temp ramp range and/or and MD temp.

_set_velocity_distribution() None

Set velocities to current target temperature.

Sets Maxwell-Boltzmann velocity distribution, as well as removing centre-of-mass momentum, and (optionally) total angular momentum.

_write_correlations() None

Write out the correlations.

_write_final_state() None

Write the final system state.

_write_header() None

Write header for stats file.

_write_restart() None

Write restart file and (optionally) rotate files saved.

_write_stats_file() None

Write molecular dynamics statistics.

_write_traj() None

Write current structure to trajectory file.

property default_formats: dict[str, str]

Default format of returned statistics.

Returns:
dict[str, str]

Default formats attached to statistical properties.

dyn: Langevin | VelocityVerlet | NPT
get_stats() dict[str, float][source]

Get thermodynamical statistics to be written to file.

Returns:
dict[str, float]

Thermodynamical statistics to be written out.

run() None

Run molecular dynamics simulation and/or temperature ramp.

property unit_info: dict[str, str]

Get units of returned statistics.

Returns:
dict[str, str]

Units attached to statistical properties.

class janus_core.calculations.md.NVT_NH(*args, thermostat_time: float = 50.0, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nvt-nh', ensemble_kwargs: dict[str, Any] | None = None, **kwargs)[source]

Bases: NPT

Configure NVT Nosé-Hoover simulation.

Parameters:
*args

Additional arguments.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nvt-nh”.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

Attributes:
default_formats

Default format of returned statistics.

unit_info

Get units of returned statistics.

Methods

get_stats()

Get thermodynamical statistics to be written to file.

run()

Run molecular dynamics simulation and/or temperature ramp.

__abstractmethods__ = frozenset({})
__annotations__ = {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.md', '__doc__': '\n    Configure NVT Nosé-Hoover simulation.\n\n    Parameters\n    ----------\n    *args\n        Additional arguments.\n    thermostat_time : float\n        Thermostat time, in fs. Default is 50.0.\n    ensemble : Ensembles\n        Name for thermodynamic ensemble. Default is "nvt-nh".\n    ensemble_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to ensemble initialization. Default is {}.\n    **kwargs\n        Additional keyword arguments.\n    ', '__init__': <function NVT_NH.__init__>, 'get_stats': <function NVT_NH.get_stats>, 'unit_info': <property object>, 'default_formats': <property object>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {'dyn': 'Langevin | VelocityVerlet | ASE_NPT'}})
__init__(*args, thermostat_time: float = 50.0, ensemble: Literal['nph', 'npt', 'nve', 'nvt', 'nvt-nh'] = 'nvt-nh', ensemble_kwargs: dict[str, Any] | None = None, **kwargs) None[source]

Initialise dynamics for NVT simulation.

Parameters:
*args

Additional arguments.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

ensembleEnsembles

Name for thermodynamic ensemble. Default is “nvt-nh”.

ensemble_kwargsdict[str, Any] | None

Keyword arguments to pass to ensemble initialization. Default is {}.

**kwargs

Additional keyword arguments.

__module__ = 'janus_core.calculations.md'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_attach_correlations() None

Attach all correlations to self.dyn.

_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

_optimize_structure() None

Perform geometry optimization.

_parse_correlations() None

Parse correlation kwargs into Correlations.

_post_process() None

Compute properties after MD run.

_prepare_restart() None

Prepare restart files, structure and offset.

_reset_velocities() None

Reset velocities and (optionally) rotation of system while equilibrating.

property _restart_file: str

Restart file name.

Returns:
str

File name for restart files.

property _restart_stem: str

Stem for restart files.

Restart files will be named {restart_stem}-{step}.extxyz. If file_prefix is specified, restart_stem will be of the form {file_prefix}-{param_prefix}-res.

Returns:
str

Stem for restart files.

_rotate_restart_files() None

Rotate restart files.

_run_dynamics() None

Run dynamics and/or temperature ramp.

_set_info() None

Set time in fs, current dynamics step, and density to info.

_set_param_prefix(file_prefix: str | Path | None = None) str

Set ensemble parameters for output files.

Parameters:
file_prefixPathLike | None

Prefix for output filenames on class init. If not None, param_prefix = “”.

Returns:
str

Formatted ensemble parameters, including pressure and temperature(s).

_set_velocity_distribution() None

Set velocities to current target temperature.

Sets Maxwell-Boltzmann velocity distribution, as well as removing centre-of-mass momentum, and (optionally) total angular momentum.

_write_correlations() None

Write out the correlations.

_write_final_state() None

Write the final system state.

_write_header() None

Write header for stats file.

_write_restart() None

Write restart file and (optionally) rotate files saved.

_write_stats_file() None

Write molecular dynamics statistics.

_write_traj() None

Write current structure to trajectory file.

property default_formats: dict[str, str]

Default format of returned statistics.

Returns:
dict[str, str]

Default formats attached to statistical properties.

dyn: Langevin | VelocityVerlet | NPT
get_stats() dict[str, float][source]

Get thermodynamical statistics to be written to file.

Returns:
dict[str, float]

Thermodynamical statistics to be written out.

run() None

Run molecular dynamics simulation and/or temperature ramp.

property unit_info: dict[str, str]

Get units of returned statistics.

Returns:
dict[str, str]

Units attached to statistical properties.

janus_core.calculations.phonons module

Phonon calculations.

class janus_core.calculations.phonons.Phonons(struct: Atoms | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, calcs: Literal['bands', 'dos', 'pdos', 'thermal'] | Sequence[Literal['bands', 'dos', 'pdos', 'thermal']] = (), supercell: int | list[int] = 2, displacement: float = 0.01, displacement_kwargs: dict[str, Any] | None = None, mesh: tuple[int, int, int] = (10, 10, 10), symmetrize: bool = False, minimize: bool = False, minimize_kwargs: dict[str, Any] | None = None, n_qpoints: int = 51, qpoint_file: str | Path | None = None, dos_kwargs: dict[str, Any] | None = None, pdos_kwargs: dict[str, Any] | None = None, temp_min: float = 0.0, temp_max: float = 1000.0, temp_step: float = 50.0, force_consts_to_hdf5: bool = True, plot_to_file: bool = False, write_results: bool = True, write_full: bool = True, file_prefix: str | Path | None = None, enable_progress_bar: bool = False)[source]

Bases: BaseCalculation

Configure, perform phonon calculations and write out results.

Parameters:
structAtoms | None

ASE Atoms structure to calculate phonons for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to calculate phonons for. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

calcsMaybeSequence[PhononCalcs] | None

Phonon calculations to run. Default calculates force constants only.

supercellMaybeList[int]

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. If three values are provided, they are interpreted as the diagonal values of a diagonal supercell. If nine values are provided, they 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.

displacementfloat

Displacement for force constants calculation, in A. Default is 0.01.

displacement_kwargsdict[str, Any] | None

Keyword arguments to pass to generate_displacements. Default is {}.

meshtuple[int, int, int]

Mesh for sampling. Default is (10, 10, 10).

symmetrizebool

Whether to symmetrize structure and force constants after calculation. Default is False.

minimizebool

Whether to perform geometry optimisation before calculating phonons. Default is False.

minimize_kwargsdict[str, Any] | None

Keyword arguments to pass to geometry optimizer. Default is {}.

n_qpointsint

Number of q-points to sample along generated path, including end points. Unused if qpoint_file is specified. Default is 51.

qpoint_filePathLike | None

Path to yaml file with info to generate a path of q-points for band structure. Default is None.

dos_kwargsdict[str, Any] | None

Keyword arguments to pass to run_total_dos. Default is {}.

pdos_kwargsdict[str, Any] | None

Keyword arguments to pass to run_projected_dos. Default is {}.

temp_minfloat

Start temperature for thermal properties calculations, in K. Default is 0.0.

temp_maxfloat

End temperature for thermal properties calculations, in K. Default is 1000.0.

temp_stepfloat

Temperature step for thermal properties calculations, in K. Default is 50.0.

force_consts_to_hdf5bool

Whether to write force constants in hdf format or not. Default is True.

plot_to_filebool

Whether to plot various graphs as band stuctures, dos/pdos in svg. Default is False.

write_resultsbool

Default for whether to write out results to file. Default is True.

write_fullbool

Whether to maximize information written in various output files. Default is True.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from chemical formula of the structure.

enable_progress_barbool

Whether to show a progress bar during phonon calculations. Default is False.

Attributes:
calcase.calculators.calculator.Calculator

ASE Calculator attached to structure.

resultsdict

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.

_ASE_to_PhonopyAtoms(struct: Atoms) PhonopyAtoms[source]

Convert ASE Atoms structure to Phonopy Atoms structure.

Parameters:
structAtoms

ASE Atoms structure to be converted.

Returns:
PhonopyAtoms

Converted PhonopyAtoms structure.

_Phonopy_to_ASEAtoms(struct: PhonopyAtoms) Atoms[source]

Convert Phonopy Atoms structure to ASE Atoms structure.

Parameters:
structPhonopyAtoms

PhonopyAtoms structure to be converted.

Returns:
Atoms

Converted ASE Atoms structure.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'janus_core.calculations.phonons', '__doc__': '\n    Configure, perform phonon calculations and write out results.\n\n    Parameters\n    ----------\n    struct : Atoms | None\n        ASE Atoms structure to calculate phonons for. Required if `struct_path` is\n        None. Default is None.\n    struct_path : PathLike | None\n        Path of structure to calculate phonons for. Required if `struct` is None.\n        Default is None.\n    arch : Architectures\n        MLIP architecture to use for calculations. Default is "mace_mp".\n    device : Devices\n        Device to run MLIP model on. Default is "cpu".\n    model_path : PathLike | None\n        Path to MLIP model. Default is `None`.\n    read_kwargs : ASEReadArgs | None\n        Keyword arguments to pass to ase.io.read. By default,\n        read_kwargs["index"] is -1.\n    calc_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to the selected calculator. Default is {}.\n    set_calc : bool | None\n        Whether to set (new) calculators for structures. Default is None.\n    attach_logger : bool\n        Whether to attach a logger. Default is False.\n    log_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to `config_logger`. Default is {}.\n    track_carbon : bool\n        Whether to track carbon emissions of calculation. Default is True.\n    tracker_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to `config_tracker`. Default is {}.\n    calcs : MaybeSequence[PhononCalcs] | None\n        Phonon calculations to run. Default calculates force constants only.\n    supercell : MaybeList[int]\n        The size of a supercell for calculation, or the supercell itself.\n        If a single number is provided, it is interpreted as the size, so a\n        diagonal supercell of that size in all dimensions is constructed.\n        If three values are provided, they are interpreted as the diagonal\n        values of a diagonal supercell. If nine values are provided, they\n        are assumed to be the full supercell matrix in the style of Phonopy,\n        so the first three values will be used as the first row, the second\n        three as the second row, etc. Default is 2.\n    displacement : float\n        Displacement for force constants calculation, in A. Default is 0.01.\n    displacement_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to generate_displacements. Default is {}.\n    mesh : tuple[int, int, int]\n        Mesh for sampling. Default is (10, 10, 10).\n    symmetrize : bool\n        Whether to symmetrize structure and force constants after calculation.\n        Default is False.\n    minimize : bool\n        Whether to perform geometry optimisation before calculating phonons.\n        Default is False.\n    minimize_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to geometry optimizer. Default is {}.\n    n_qpoints : int\n        Number of q-points to sample along generated path, including end points.\n        Unused if `qpoint_file` is specified. Default is 51.\n    qpoint_file : PathLike | None\n        Path to yaml file with info to generate a path of q-points for band structure.\n        Default is None.\n    dos_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to run_total_dos. Default is {}.\n    pdos_kwargs : dict[str, Any] | None\n        Keyword arguments to pass to run_projected_dos. Default is {}.\n    temp_min : float\n        Start temperature for thermal properties calculations, in K. Default is 0.0.\n    temp_max : float\n        End temperature for thermal properties calculations, in K. Default is 1000.0.\n    temp_step : float\n        Temperature step for thermal properties calculations, in K. Default is 50.0.\n    force_consts_to_hdf5 : bool\n        Whether to write force constants in hdf format or not. Default is True.\n    plot_to_file : bool\n        Whether to plot various graphs as band stuctures, dos/pdos in svg.\n        Default is False.\n    write_results : bool\n        Default for whether to write out results to file. Default is True.\n    write_full : bool\n        Whether to maximize information written in various output files.\n        Default is True.\n    file_prefix : PathLike | None\n        Prefix for output filenames. Default is inferred from chemical formula of the\n        structure.\n    enable_progress_bar : bool\n        Whether to show a progress bar during phonon calculations. Default is False.\n\n    Attributes\n    ----------\n    calc : ase.calculators.calculator.Calculator\n        ASE Calculator attached to structure.\n    results : dict\n        Results of phonon calculations.\n\n    Methods\n    -------\n    calc_force_constants(write_force_consts)\n        Calculate force constants and optionally write results.\n    write_force_constants(phonopy_file, force_consts_to_hdf5, force_consts_file)\n        Write results of force constants calculations.\n    calc_bands(write_bands)\n        Calculate band structure and optionally write and plot results.\n    write_bands(bands_file, save_plots, plot_file)\n        Write results of band structure calculations.\n    calc_thermal_props(mesh, write_thermal)\n        Calculate thermal properties and optionally write results.\n    write_thermal_props(thermal_file)\n        Write results of thermal properties calculations.\n    calc_dos(mesh, write_dos)\n        Calculate density of states and optionally write results.\n    write_dos(dos_file, plot_to_file, plot_file, plot_bands, plot_bands_file)\n        Write results of DOS calculation.\n    calc_pdos(mesh, write_pdos)\n        Calculate projected density of states and optionally write results.\n    write_pdos(pdos_file, plot_to_file, plot_file)\n        Write results of PDOS calculation.\n    run()\n        Run phonon calculations.\n    ', '__init__': <function Phonons.__init__>, 'calcs': <property object>, 'calc_force_constants': <function Phonons.calc_force_constants>, 'write_force_constants': <function Phonons.write_force_constants>, 'calc_bands': <function Phonons.calc_bands>, 'write_bands': <function Phonons.write_bands>, 'calc_thermal_props': <function Phonons.calc_thermal_props>, 'write_thermal_props': <function Phonons.write_thermal_props>, 'calc_dos': <function Phonons.calc_dos>, 'write_dos': <function Phonons.write_dos>, 'calc_pdos': <function Phonons.calc_pdos>, 'write_pdos': <function Phonons.write_pdos>, '_Phonopy_to_ASEAtoms': <function Phonons._Phonopy_to_ASEAtoms>, '_ASE_to_PhonopyAtoms': <function Phonons._ASE_to_PhonopyAtoms>, '_calc_forces': <function Phonons._calc_forces>, 'run': <function Phonons.run>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
__init__(struct: Atoms | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, calcs: Literal['bands', 'dos', 'pdos', 'thermal'] | Sequence[Literal['bands', 'dos', 'pdos', 'thermal']] = (), supercell: int | list[int] = 2, displacement: float = 0.01, displacement_kwargs: dict[str, Any] | None = None, mesh: tuple[int, int, int] = (10, 10, 10), symmetrize: bool = False, minimize: bool = False, minimize_kwargs: dict[str, Any] | None = None, n_qpoints: int = 51, qpoint_file: str | Path | None = None, dos_kwargs: dict[str, Any] | None = None, pdos_kwargs: dict[str, Any] | None = None, temp_min: float = 0.0, temp_max: float = 1000.0, temp_step: float = 50.0, force_consts_to_hdf5: bool = True, plot_to_file: bool = False, write_results: bool = True, write_full: bool = True, file_prefix: str | Path | None = None, enable_progress_bar: bool = False) None[source]

Initialise Phonons class.

Parameters:
structAtoms | None

ASE Atoms structure to calculate phonons for. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to calculate phonons for. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is -1.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

calcsMaybeSequence[PhononCalcs] | None

Phonon calculations to run. Default calculates force constants only.

supercellMaybeList[int]

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. If three values are provided, they are interpreted as the diagonal values of a diagonal supercell. If nine values are provided, they 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.

displacementfloat

Displacement for force constants calculation, in A. Default is 0.01.

displacement_kwargsdict[str, Any] | None

Keyword arguments to pass to generate_displacements. Default is {}.

meshtuple[int, int, int]

Mesh for sampling. Default is (10, 10, 10).

symmetrizebool

Whether to symmetrize structure and force constants after calculation. Default is False.

minimizebool

Whether to perform geometry optimisation before calculating phonons. Default is False.

minimize_kwargsdict[str, Any] | None

Keyword arguments to pass to geometry optimizer. Default is {}.

n_qpointsint

Number of q-points to sample along generated path, including end points. Unused if qpoint_file is specified. Default is 51.

qpoint_filePathLike | None

Path to yaml file with info to generate a path of q-points for band structure. Default is None.

dos_kwargsdict[str, Any] | None

Keyword arguments to pass to run_total_dos. Default is {}.

pdos_kwargsdict[str, Any] | None

Keyword arguments to pass to run_projected_dos. Default is {}.

temp_minfloat

Start temperature for thermal calculations, in K. Default is 0.0.

temp_maxfloat

End temperature for thermal calculations, in K. Default is 1000.0.

temp_stepfloat

Temperature step for thermal calculations, in K. Default is 50.0.

force_consts_to_hdf5bool

Whether to write force constants in hdf format or not. Default is True.

plot_to_filebool

Whether to plot various graphs as band stuctures, dos/pdos in svg. Default is False.

write_resultsbool

Default for whether to write out results to file. Default is True.

write_fullbool

Whether to maximize information written in various output files. Default is True.

file_prefixPathLike | None

Prefix for output filenames. Default is inferred from structure name, or chemical formula of the structure.

enable_progress_barbool

Whether to show a progress bar during phonon calculations. Default is False.

__module__ = 'janus_core.calculations.phonons'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

_calc_forces(struct: PhonopyAtoms) ndarray[source]

Calculate forces on PhonopyAtoms structure.

Parameters:
structPhonopyAtoms

Structure to calculate forces on.

Returns:
ndarray

Forces on the structure.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

calc_bands(write_bands: bool | None = None, **kwargs) None[source]

Calculate band structure and optionally write and plot results.

Parameters:
write_bandsbool | None

Whether to write out results to file. Default is self.write_results.

**kwargs

Additional keyword arguments to pass to write_bands.

calc_dos(*, mesh: tuple[int, int, int] | None = None, write_dos: bool | None = None, **kwargs) None[source]

Calculate density of states and optionally write results.

Parameters:
meshtuple[int, int, int] | None

Mesh for sampling. Default is self.mesh.

write_dosbool | None

Whether to write out results to file. Default is True.

**kwargs

Additional keyword arguments to pass to write_dos.

calc_force_constants(write_force_consts: bool | None = None, **kwargs) None[source]

Calculate force constants and optionally write results.

Parameters:
write_force_constsbool | None

Whether to write out results to file. Default is self.write_results.

**kwargs

Additional keyword arguments to pass to write_force_constants.

calc_pdos(*, mesh: tuple[int, int, int] | None = None, write_pdos: bool | None = None, **kwargs) None[source]

Calculate projected density of states and optionally write results.

Parameters:
meshtuple[int, int, int] | None

Mesh for sampling. Default is self.mesh.

write_pdosbool | None

Whether to write out results to file. Default is self.write_results.

**kwargs

Additional keyword arguments to pass to write_pdos.

calc_thermal_props(mesh: tuple[int, int, int] | None = None, write_thermal: bool | None = None, **kwargs) None[source]

Calculate thermal properties and optionally write results.

Parameters:
meshtuple[int, int, int] | None

Mesh for sampling. Default is self.mesh.

write_thermalbool | None

Whether to write out thermal properties to file. Default is self.write_results.

**kwargs

Additional keyword arguments to pass to write_thermal_props.

property calcs: Sequence[Literal['bands', 'dos', 'pdos', 'thermal']]

Phonon calculations to be run.

Returns:
Sequence[PhononCalcs]

Phonon calculations.

run() None[source]

Run phonon calculations.

write_bands(*, bands_file: str | Path | None = None, save_plots: bool | None = None, plot_file: str | Path | None = None) None[source]

Write results of band structure calculations.

Parameters:
bands_filePathLike | None

Name of yaml file to save band structure. Default is inferred from file_prefix.

save_plotsbool | None

Whether to save plot to file. Default is self.plot_to_file.

plot_filePathLike | None

Name of svg file if saving band structure plot. Default is inferred from file_prefix.

write_dos(*, dos_file: str | Path | None = None, plot_to_file: bool | None = None, plot_file: str | Path | None = None, plot_bands: bool = False, plot_bands_file: str | Path | None = None) None[source]

Write results of DOS calculation.

Parameters:
dos_filePathLike | None

Name of data file to save the calculated DOS. Default is inferred from file_prefix.

plot_to_filebool | None

Whether to save plot to file. Default is self.plot_to_file.

plot_filePathLike | None

Name of svg file if saving plot of the DOS. Default is inferred from file_prefix.

plot_bandsbool

Whether to plot the band structure and DOS together. Default is True.

plot_bands_filePathLike | None

Name of svg file if saving plot of the band structure and DOS. Default is inferred from file_prefix.

write_force_constants(*, phonopy_file: str | Path | None = None, force_consts_to_hdf5: bool | None = None, force_consts_file: str | Path | None = None) None[source]

Write results of force constants calculations.

Parameters:
phonopy_filePathLike | None

Name of yaml file to save params of phonopy and optionally force constants. Default is inferred from file_prefix.

force_consts_to_hdf5bool | None

Whether to save the force constants separately to an hdf5 file. Default is self.force_consts_to_hdf5.

force_consts_filePathLike | None

Name of hdf5 file to save force constants. Unused if force_consts_to_hdf5 is False. Default is inferred from file_prefix.

write_pdos(*, pdos_file: str | Path | None = None, plot_to_file: bool | None = None, plot_file: str | Path | None = None) None[source]

Write results of PDOS calculation.

Parameters:
pdos_filePathLike | None

Name of file to save the calculated PDOS. Default is inferred from file_prefix.

plot_to_filebool | None

Whether to save plot to file. Default is self.plot_to_file.

plot_filePathLike | None

Name of svg file if saving plot of the calculated PDOS. Default is inferred from file_prefix.

write_thermal_props(thermal_file: str | Path | None = None) None[source]

Write results of thermal properties calculations.

Parameters:
thermal_filePathLike | None

Name of data file to save thermal properties. Default is inferred from file_prefix.

janus_core.calculations.single_point module

Prepare and perform single point calculations.

class janus_core.calculations.single_point.SinglePoint(*, struct: Atoms | Sequence[Atoms] | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, properties: Literal['energy', 'stress', 'forces', 'hessian'] | Sequence[Literal['energy', 'stress', 'forces', 'hessian']] = (), write_results: bool = False, write_kwargs: OutputKwargs | None = None)[source]

Bases: BaseCalculation

Prepare and perform single point calculations.

Parameters:
structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for single point calculations. Default is “mace_mp”.

deviceDevices

Device to run model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is “:”.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

propertiesMaybeSequence[Properties]

Physical properties to calculate. If not specified, “energy”, “forces”, and “stress” will be returned.

write_resultsbool

True to write out structure with results of calculations. Default is False.

write_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}.

Attributes:
resultsCalcResults

Dictionary of calculated results, with keys from properties.

Methods

run()

Run single point calculations.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__init__(*, struct: Atoms | Sequence[Atoms] | None = None, struct_path: str | Path | None = None, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None, properties: Literal['energy', 'stress', 'forces', 'hessian'] | Sequence[Literal['energy', 'stress', 'forces', 'hessian']] = (), write_results: bool = False, write_kwargs: OutputKwargs | None = None) None[source]

Read the structure being simulated and attach an MLIP calculator.

Parameters:
structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

archArchitectures

MLIP architecture to use for single point calculations. Default is “mace_mp”.

deviceDevices

Device to run MLIP model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

read_kwargsASEReadArgs | None

Keyword arguments to pass to ase.io.read. By default, read_kwargs[“index”] is “:”.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is None.

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

propertiesMaybeSequence[Properties]

Physical properties to calculate. If not specified, “energy”, “forces”, and “stress” will be returned.

write_resultsbool

True to write out structure with results of calculations. Default is False.

write_kwargsOutputKwargs | None

Keyword arguments to pass to ase.io.write if saving structure with results of calculations. Default is {}.

__module__ = 'janus_core.calculations.single_point'
_abc_impl = <_abc._abc_data object>
_calc_hessian(struct: Atoms) ndarray[source]

Calculate analytical Hessian for a given structure.

Parameters:
structAtoms

Structure to calculate Hessian for.

Returns:
ndarray

Analytical Hessian.

_get_forces() ndarray | list[ndarray][source]

Calculate forces using MLIP.

Returns:
MaybeList[ndarray]

Forces of structure(s).

_get_hessian() ndarray | list[ndarray][source]

Calculate hessian using MLIP.

Returns:
MaybeList[ndarray]

Hessian of structure(s).

_get_potential_energy() float | list[float][source]

Calculate potential energy using MLIP.

Returns:
MaybeList[float]

Potential energy of structure(s).

_get_stress() ndarray | list[ndarray][source]

Calculate stress using MLIP.

Returns:
MaybeList[ndarray]

Stress of structure(s).

property properties: Sequence[Literal['energy', 'stress', 'forces', 'hessian']]

Physical properties to be calculated.

Returns:
Sequence[Properties]

Physical properties.

run() CalcResults[source]

Run single point calculations.

Returns:
CalcResults

Dictionary of calculated results, with keys from properties.

janus_core.cli.descriptors module

Set up MLIP descriptors commandline interface.

janus_core.cli.descriptors.descriptors(ctx: ~typer.models.Context, struct: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f963560de80>], invariants_only: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473ed50>] = True, calc_per_element: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473ede0>] = False, calc_per_atom: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473ee70>] = False, arch: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963615eae0>] = 'mace_mp', device: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473d7f0>] = 'cpu', model_path: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473dc10>] = None, out: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473ef00>] = None, read_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473dca0>] = None, calc_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473ddf0>] = None, write_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473de80>] = None, log: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e6c0>] = None, tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473efc0>] = True, summary: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e750>] = None, *, config: str = <typer.models.OptionInfo object>) None[source]

Calculate MLIP descriptors for the given structure(s).

Parameters:
ctxContext

Typer (Click) Context. Automatically set.

structPath

Path of structure to simulate.

invariants_onlybool

Whether only the invariant descriptors should be returned. Default is True.

calc_per_elementbool

Whether to calculate mean descriptors for each element. Default is False.

calc_per_atombool

Whether to calculate descriptors for each atom. Default is False.

archOptional[str]

MLIP architecture to use for single point calculations. Default is “mace_mp”.

deviceOptional[str]

Device to run model on. Default is “cpu”.

model_pathOptional[str]

Path to MLIP model. Default is None.

outOptional[Path]

Path to save structure with calculated results. Default is inferred from name of the structure file.

read_kwargsOptional[dict[str, Any]]
Keyword arguments to pass to ase.io.read. By default,

read_kwargs[“index”] is “:”.

calc_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to the selected calculator. Default is {}.

write_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to ase.io.write when saving results. Default is {}.

logOptional[Path]

Path to write logs to. Default is inferred from the name of the structure file.

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file.

configOptional[Path]

Path to yaml configuration file to define the above options. Default is None.

janus_core.cli.eos module

Set up eos commandline interface.

janus_core.cli.eos.eos(ctx: ~typer.models.Context, struct: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f963560de80>], min_volume: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f963473f230>] = 0.95, max_volume: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f963473f2c0>] = 1.05, n_volumes: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f963473f470>] = 7, eos_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f963473f500>] = 'birchmurnaghan', minimize: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473f590>] = True, minimize_all: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473f620>] = False, fmax: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f963473f6b0>] = 0.1, minimize_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e270>] = None, write_structures: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473f770>] = False, write_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473de80>] = None, plot_to_file: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473fad0>] = False, arch: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963615eae0>] = 'mace_mp', device: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473d7f0>] = 'cpu', model_path: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473dc10>] = None, read_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473dd60>] = None, calc_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473ddf0>] = None, file_prefix: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473fce0>] = None, log: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e6c0>] = None, tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f963473fda0>] = True, summary: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e750>] = None, *, config: str = <typer.models.OptionInfo object>) None[source]

Calculate equation of state and write out results.

Parameters:
ctxContext

Typer (Click) Context. Automatically set.

structPath

Path of structure to simulate.

min_volumefloat

Minimum volume scale factor. Default is 0.95.

max_volumefloat

Maximum volume scale factor. Default is 1.05.

n_volumesint

Number of volumes to use. Default is 7.

eos_typeOptional[str]

Type of fit for equation of state. Default is “birchmurnaghan”.

minimizebool

Whether to minimize initial structure before calculations. Default is True.

minimize_allbool

Whether to optimize geometry for all generated structures. Default is False.

fmaxfloat

Set force convergence criteria for optimizer in units eV/Å. Default is 0.1.

minimize_kwargsOptional[dict[str, Any]]

Other keyword arguments to pass to geometry optimizer. Default is {}.

write_structuresbool

True to write out all genereated structures. Default is False.

write_kwargsOptional[dict[str, Any]],

Keyword arguments to pass to ase.io.write to save generated structures. Default is {}.

plot_to_filebool

Whether to save plot equation of state to svg. Default is False.

archOptional[str]

MLIP architecture to use for geometry optimization. Default is “mace_mp”.

deviceOptional[str]

Device to run model on. Default is “cpu”.

model_pathOptional[str]

Path to MLIP model. Default is None.

read_kwargsOptional[dict[str, Any]]
Keyword arguments to pass to ase.io.read. By default,

read_kwargs[“index”] is -1.

calc_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to the selected calculator. Default is {}.

file_prefixOptional[PathLike]

Prefix for output filenames. Default is inferred from structure name, or chemical formula.

logOptional[Path]

Path to write logs to. Default is inferred from the name of the structure file.

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file.

configOptional[Path]

Path to yaml configuration file to define the above options. Default is None.

janus_core.cli.geomopt module

Set up geomopt commandline interface.

janus_core.cli.geomopt._set_minimize_kwargs(minimize_kwargs: dict[str, Any], traj: str | None, opt_cell_lengths: bool, pressure: float) None[source]

Set minimize_kwargs dictionary values.

Parameters:
minimize_kwargsdict[str, Any]

Other keyword arguments to pass to geometry optimizer.

trajOptional[str]

Path if saving optimization frames.

opt_cell_lengthsbool

Whether to optimize cell vectors, as well as atomic positions, by setting hydrostatic_strain in the filter function.

pressurefloat

Scalar pressure when optimizing cell geometry, in GPa. Passed to the filter function if either opt_cell_lengths or opt_cell_fully is True.

janus_core.cli.geomopt.geomopt(ctx: ~typer.models.Context, struct: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f963560de80>], optimizer: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f9634740140>] = 'LBFGS', fmax: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347401d0>] = 0.1, steps: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634740260>] = 1000, arch: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963615eae0>] = 'mace_mp', device: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473d7f0>] = 'cpu', model_path: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473dc10>] = None, opt_cell_lengths: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f96347402f0>] = False, opt_cell_fully: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634740380>] = False, filter_func: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f9634740410>] = None, pressure: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347404a0>] = 0.0, symmetrize: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634740530>] = False, symmetry_tolerance: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347405c0>] = 0.001, out: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f96347406b0>] = None, traj: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f9634740740>] = None, read_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473dd60>] = None, calc_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473ddf0>] = None, minimize_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e270>] = None, write_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473de80>] = None, log: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e6c0>] = None, tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f96347407d0>] = True, summary: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e750>] = None, *, config: str = <typer.models.OptionInfo object>) None[source]

Perform geometry optimization and save optimized structure to file.

Parameters:
ctxContext

Typer (Click) Context. Automatically set.

structPath

Path of structure to simulate.

optimizerOptional[str]

Name of optimization function from ase.optimize. Default is LBFGS.

fmaxfloat

Set force convergence criteria for optimizer, in eV/Å. Default is 0.1.

stepsint

Set maximum number of optimization steps to run. Default is 1000.

archOptional[str]

MLIP architecture to use for geometry optimization. Default is “mace_mp”.

deviceOptional[str]

Device to run model on. Default is “cpu”.

model_pathOptional[str]

Path to MLIP model. Default is None.

opt_cell_lengthsbool

Whether to optimize cell vectors, as well as atomic positions, by setting hydrostatic_strain in the filter function. Default is False.

opt_cell_fullybool

Whether to fully optimize the cell vectors, angles, and atomic positions. Default is False.

filter_funcOptional[str]

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.

pressurefloat

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.

symmetrizebool

Whether to refine symmetry after geometry optimization. Default is False.

symmetry_tolerancefloat

Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001.

outOptional[Path]

Path to save optimized structure, or last structure if optimization did not converge. Default is inferred from name of structure file.

trajOptional[str]

Path if saving optimization frames. Default is None.

read_kwargsOptional[dict[str, Any]]
Keyword arguments to pass to ase.io.read. By default,

read_kwargs[“index”] is -1.

calc_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to the selected calculator. Default is {}.

minimize_kwargsOptional[dict[str, Any]]

Other keyword arguments to pass to geometry optimizer. Default is {}.

write_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to ase.io.write when saving optimized structure. Default is {}.

logOptional[Path]

Path to write logs to. Default is inferred from the name of the structure file.

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file.

configOptional[Path]

Path to yaml configuration file to define the above options. Default is None.

janus_core.cli.janus module

Set up commandline interface.

janus_core.cli.janus.print_version(version: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f96347456d0>] = None) False[source]

Print current janus-core version and exit.

Parameters:
versionbool

Whether to print the current janus-core version.

janus_core.cli.md module

Set up md commandline interface.

janus_core.cli.md.md(ctx: ~typer.models.Context, ensemble: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f96347412b0>], struct: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f963560de80>], steps: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634741370>] = 0, timestep: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634741430>] = 1.0, temp: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347414c0>] = 300.0, thermostat_time: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634741550>] = 50.0, barostat_time: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347415e0>] = 75.0, bulk_modulus: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347416d0>] = 2.0, pressure: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347416a0>] = 0.0, friction: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f96347417c0>] = 0.005, ensemble_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e4b0>] = None, arch: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963615eae0>] = 'mace_mp', device: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473d7f0>] = 'cpu', model_path: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473dc10>] = None, read_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473dd60>] = None, calc_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473ddf0>] = None, equil_steps: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f96347419d0>] = 0, minimize: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634741a90>] = False, minimize_every: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634741b20>] = -1, minimize_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e270>] = None, rescale_velocities: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634741bb0>] = False, remove_rot: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634741c40>] = False, rescale_every: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634741d00>] = 10, file_prefix: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f9634741dc0>] = None, restart: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634741e80>] = False, restart_auto: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634741f40>] = True, restart_stem: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f9634742000>] = None, restart_every: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f96347420c0>] = 1000, rotate_restart: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634742180>] = False, restarts_to_keep: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634742240>] = 4, final_file: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f9634742360>] = None, stats_file: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f9634742450>] = None, stats_every: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634742510>] = 100, traj_file: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f96347425d0>] = None, traj_append: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634742690>] = False, traj_start: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634742750>] = 0, traj_every: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f96347427e0>] = 100, temp_start: ~typing.Annotated[float | None, <typer.models.OptionInfo object at 0x7f96347429f0>] = None, temp_end: ~typing.Annotated[float | None, <typer.models.OptionInfo object at 0x7f9634742ae0>] = None, temp_step: ~typing.Annotated[float | None, <typer.models.OptionInfo object at 0x7f9634742ba0>] = None, temp_time: ~typing.Annotated[float | None, <typer.models.OptionInfo object at 0x7f9634742c60>] = None, write_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473de80>] = None, post_process_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e630>] = None, seed: ~typing.Annotated[int | None, <typer.models.OptionInfo object at 0x7f9634742d20>] = None, log: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e6c0>] = None, tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634742de0>] = True, summary: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e750>] = None, *, config: str = <typer.models.OptionInfo object>) None[source]

Run molecular dynamics simulation, and save trajectory and statistics.

Parameters:
ctxContext

Typer (Click) Context. Automatically set.

ensemblestr

Name of thermodynamic ensemble.

structPath

Path of structure to simulate.

stepsint

Number of steps in simulation. Default is 0.

timestepfloat

Timestep for integrator, in fs. Default is 1.0.

tempfloat

Temperature, in K. Default is 300.

thermostat_timefloat

Thermostat time, in fs. Default is 50.0.

barostat_timefloat

Barostat time, in fs. Default is 75.0.

bulk_modulusfloat

Bulk modulus, in GPa. Default is 2.0.

pressurefloat

Pressure, in GPa. Default is 0.0.

frictionfloat

Friction coefficient in fs^-1. Default is 0.005.

ensemble_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to ensemble initialization. Default is {}.

archOptional[str]

MLIP architecture to use for molecular dynamics. Default is “mace_mp”.

deviceOptional[str]

Device to run model on. Default is “cpu”.

model_pathOptional[str]

Path to MLIP model. Default is None.

read_kwargsOptional[dict[str, Any]]
Keyword arguments to pass to ase.io.read. By default,

read_kwargs[“index”] is -1.

calc_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to the selected calculator. Default is {}.

equil_stepsint

Maximum number of steps at which to perform optimization and reset velocities. Default is 0.

minimizebool

Whether to minimize structure during equilibration. Default is False.

minimize_everyint

Frequency of minimizations. Default is -1, which disables minimization after beginning dynamics.

minimize_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to geometry optimizer. Default is {}.

rescale_velocitiesbool

Whether to rescale velocities. Default is False.

remove_rotbool

Whether to remove rotation. Default is False.

rescale_everyint

Frequency to rescale velocities. Default is 10.

file_prefixOptional[PathLike]

Prefix for output filenames. Default is inferred from structure, ensemble, and temperature.

restartbool

Whether restarting dynamics. Default is False.

restart_autobool

Whether to infer restart file name if restarting dynamics. Default is True.

restart_stemstr

Stem for restart file name. Default inferred from file_prefix.

restart_everyint

Frequency of steps to save restart info. Default is 1000.

rotate_restartbool

Whether to rotate restart files. Default is False.

restarts_to_keepint

Restart files to keep if rotating. Default is 4.

final_fileOptional[PathLike]

File to save final configuration at each temperature of similation. Default inferred from file_prefix.

stats_fileOptional[PathLike]

File to save thermodynamical statistics. Default inferred from file_prefix.

stats_everyint

Frequency to output statistics. Default is 100.

traj_fileOptional[PathLike]

Trajectory file to save. Default inferred from file_prefix.

traj_appendbool

Whether to append trajectory. Default is False.

traj_startint

Step to start saving trajectory. Default is 0.

traj_everyint

Frequency of steps to save trajectory. Default is 100.

temp_startOptional[float]

Temperature to start heating, in K. Default is None, which disables heating.

temp_endOptional[float]

Maximum temperature for heating, in K. Default is None, which disables heating.

temp_stepOptional[float]

Size of temperature steps when heating, in K. Default is None, which disables heating.

temp_timeOptional[float]

Time between heating steps, in fs. Default is None, which disables heating.

write_kwargsOptional[dict[str, Any]],

Keyword arguments to pass to output_structs when saving trajectory and final files. Default is {}.

post_process_kwargsOptional[PostProcessKwargs]

Kwargs to pass to post-processing.

seedOptional[int]

Random seed used by numpy.random and random functions, such as in Langevin. Default is None.

logOptional[Path]

Path to write logs to. Default is inferred from the name of the structure file.

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file.

configOptional[Path]

Path to yaml configuration file to define the above options. Default is None.

janus_core.cli.phonons module

Set up phonons commandline interface.

janus_core.cli.phonons.phonons(ctx: ~typer.models.Context, struct: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f963560de80>], supercell: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f96347430e0>] = '2 2 2', displacement: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634743170>] = 0.01, displacement_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e5a0>] = None, mesh: ~typing.Annotated[tuple[int, int, int], <typer.models.OptionInfo object at 0x7f9634743200>] = (10, 10, 10), bands: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743290>] = False, n_qpoints: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f9634743320>] = 51, qpoint_file: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f9634743410>] = None, dos: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f96347433b0>] = False, dos_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e300>] = None, pdos: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743680>] = False, pdos_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e420>] = None, thermal: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f96347438f0>] = False, temp_min: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634743980>] = 0.0, temp_max: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634743a10>] = 1000.0, temp_step: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634743ad0>] = 50, symmetrize: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743b90>] = False, minimize: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743c80>] = False, fmax: ~typing.Annotated[float, <typer.models.OptionInfo object at 0x7f9634743d40>] = 0.1, minimize_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473e270>] = None, hdf5: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743e00>] = True, plot_to_file: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743ec0>] = False, write_full: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634743f80>] = True, arch: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963615eae0>] = 'mace_mp', device: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473d7f0>] = 'cpu', model_path: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473dc10>] = None, read_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473dd60>] = None, calc_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473ddf0>] = None, file_prefix: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f9634744080>] = None, log: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e6c0>] = None, tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634744140>] = True, summary: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e750>] = None, *, config: str = <typer.models.OptionInfo object>) None[source]

Perform phonon calculations and write out results.

Parameters:
ctxContext

Typer (Click) Context. Automatically set.

structPath

Path of structure to simulate.

supercellstr

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.

displacementfloat

Displacement for force constants calculation, in A. Default is 0.01.

displacement_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to generate_displacements. Default is {}.

meshtuple[int, int, int]

Mesh for sampling. Default is (10, 10, 10).

bandsbool

Whether to calculate and save the band structure. Default is False.

n_qpointsint

Number of q-points to sample along generated path, including end points. Unused if qpoint_file is specified. Default is 51.

qpoint_fileOptional[PathLike]

Path to yaml file with info to generate a path of q-points for band structure. Default is None.

dosbool

Whether to calculate and save the DOS. Default is False.

dos_kwargsOptional[dict[str, Any]]

Other keyword arguments to pass to run_total_dos. Default is {}.

pdosbool

Whether to calculate and save the PDOS. Default is False.

pdos_kwargsOptional[dict[str, Any]]

Other keyword arguments to pass to run_projected_dos. Default is {}.

thermalbool

Whether to calculate thermal properties. Default is False.

temp_minfloat

Start temperature for thermal calculations, in K. Unused if thermal is False. Default is 0.0.

temp_maxfloat

End temperature for thermal calculations, in K. Unused if thermal is False. Default is 1000.0.

temp_stepfloat

Temperature step for thermal calculations, in K. Unused if thermal is False. Default is 50.0.

symmetrizebool

Whether to symmetrize force constants. Default is False.

minimizebool

Whether to minimize structure before calculations. Default is False.

fmaxfloat

Set force convergence criteria for optimizer in units eV/Å. Default is 0.1.

minimize_kwargsOptional[dict[str, Any]]

Other keyword arguments to pass to geometry optimizer. Default is {}.

hdf5bool

Whether to save force constants in hdf5 format. Default is True.

plot_to_filebool

Whether to plot. Default is False.

write_fullbool

Whether to maximize information written in various output files. Default is True.

archOptional[str]

MLIP architecture to use for geometry optimization. Default is “mace_mp”.

deviceOptional[str]

Device to run model on. Default is “cpu”.

model_pathOptional[str]

Path to MLIP model. Default is None.

read_kwargsOptional[dict[str, Any]]
Keyword arguments to pass to ase.io.read. By default,

read_kwargs[“index”] is 0.

calc_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to the selected calculator. Default is {}.

file_prefixOptional[PathLike]

Prefix for output filenames. Default is inferred from structure name, or chemical formula.

logOptional[Path]

Path to write logs to. Default is inferred from the name of the structure file.

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file.

configOptional[Path]

Path to yaml configuration file to define the above options. Default is None.

janus_core.cli.preprocess module

Set up MLIP preprocessing commandline interface.

janus_core.cli.preprocess.preprocess(mlip_config: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f96347443b0>], log: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f9634744440>] = PosixPath('preprocess-log.yml'), tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f96347444d0>] = True, summary: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f9634744560>] = PosixPath('preprocess-summary.yml'))[source]

Convert training data to hdf5 by passing a configuration file to the MLIP’s CLI.

Parameters:
mlip_configPath

Configuration file to pass to MLIP CLI.

logOptional[Path]

Path to write logs to. Default is Path(“preprocess-log.yml”).

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is Path(“preprocess-summary.yml”).

janus_core.cli.singlepoint module

Set up singlepoint commandline interface.

janus_core.cli.singlepoint.singlepoint(ctx: ~typer.models.Context, struct: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f963560de80>], arch: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963615eae0>] = 'mace_mp', device: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473d7f0>] = 'cpu', model_path: ~typing.Annotated[str | None, <typer.models.OptionInfo object at 0x7f963473dc10>] = None, properties: ~typing.Annotated[list[str] | None, <typer.models.OptionInfo object at 0x7f9634744800>] = None, out: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f96347448c0>] = None, read_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473dca0>] = None, calc_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473ddf0>] = None, write_kwargs: ~typing.Annotated[~janus_core.cli.types.TyperDict | None, <typer.models.OptionInfo object at 0x7f963473de80>] = None, log: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e6c0>] = None, tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634744f50>] = True, summary: ~typing.Annotated[~pathlib.Path | None, <typer.models.OptionInfo object at 0x7f963473e750>] = None, *, config: str = <typer.models.OptionInfo object>) None[source]

Perform single point calculations and save to file.

Parameters:
ctxContext

Typer (Click) Context. Automatically set.

structPath

Path of structure to simulate.

archOptional[str]

MLIP architecture to use for single point calculations. Default is “mace_mp”.

deviceOptional[str]

Device to run model on. Default is “cpu”.

model_pathOptional[str]

Path to MLIP model. Default is None.

propertiesOptional[list[str]]

Physical properties to calculate. Default is (“energy”, “forces”, “stress”).

outOptional[Path]

Path to save structure with calculated results. Default is inferred from name of the structure file.

read_kwargsOptional[dict[str, Any]]
Keyword arguments to pass to ase.io.read. By default,

read_kwargs[“index”] is “:”.

calc_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to the selected calculator. Default is {}.

write_kwargsOptional[dict[str, Any]]

Keyword arguments to pass to ase.io.write when saving results. Default is {}.

logOptional[Path]

Path to write logs to. Default is inferred from the name of the structure file.

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is inferred from the name of the structure file.

configOptional[Path]

Path to yaml configuration file to define the above options. Default is None.

janus_core.cli.train module

Set up MLIP training commandline interface.

janus_core.cli.train.train(mlip_config: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f9634745160>], fine_tune: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634745220>] = False, log: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f96347452b0>] = PosixPath('train-log.yml'), tracker: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f9634745340>] = True, summary: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f96347453d0>] = PosixPath('train-summary.yml')) None[source]

Run training for MLIP by passing a configuration file to the MLIP’s CLI.

Parameters:
mlip_configPath

Configuration file to pass to MLIP CLI.

fine_tunebool

Whether to fine-tune a foundational model. Default is False.

logOptional[Path]

Path to write logs to. Default is Path(“train-log.yml”).

trackerbool

Whether to save carbon emissions of calculation in log file and summary. Default is True.

summaryOptional[Path]

Path to save summary of inputs, start/end time, and carbon emissions. Default is Path(“train-summary.yml”).

janus_core.cli.types module

Module containing types used for Janus-Core CLI.

class janus_core.cli.types.TyperDict(value: str)[source]

Bases: object

Custom dictionary for typer.

Parameters:
valuestr

Value of string representing a dictionary.

__dict__ = mappingproxy({'__module__': 'janus_core.cli.types', '__doc__': '\n    Custom dictionary for typer.\n\n    Parameters\n    ----------\n    value : str\n        Value of string representing a dictionary.\n    ', '__init__': <function TyperDict.__init__>, '__str__': <function TyperDict.__str__>, '__dict__': <attribute '__dict__' of 'TyperDict' objects>, '__weakref__': <attribute '__weakref__' of 'TyperDict' objects>, '__annotations__': {}})
__init__(value: str) None[source]

Initialise class.

Parameters:
valuestr

Value of string representing a dictionary.

__module__ = 'janus_core.cli.types'
__str__() str[source]

Return string representation of class.

Returns:
str

Class name and value of string representing a dictionary.

__weakref__

list of weak references to the object

janus_core.cli.types.parse_dict_class(value: str | ASEReadArgs) TyperDict[source]

Convert string input into a dictionary.

Parameters:
valuestr | ASEReadArgs

String representing dictionary to be parsed.

Returns:
TyperDict

Parsed string as a dictionary.

janus_core.cli.utils module

Utility functions for CLI.

janus_core.cli.utils.carbon_summary(*, summary: Path, log: Path) None[source]

Calculate and write carbon tracking summary.

Parameters:
summaryPath

Path to summary file being saved.

logPath

Path to log file with carbon emissions saved.

janus_core.cli.utils.check_config(ctx: Context) None[source]

Check options in configuration file are valid options for CLI command.

Parameters:
ctxContext

Typer (Click) Context within command.

janus_core.cli.utils.dict_paths_to_strs(dictionary: dict) None[source]

Recursively iterate over dictionary, converting Path values to strings.

Parameters:
dictionarydict

Dictionary to be converted.

janus_core.cli.utils.dict_remove_hyphens(dictionary: dict) dict[source]

Recursively iterate over dictionary, replacing hyphens with underscores in keys.

Parameters:
dictionarydict

Dictionary to be converted.

Returns:
dict

Dictionary with hyphens in keys replaced with underscores.

janus_core.cli.utils.dict_tuples_to_lists(dictionary: dict) None[source]

Recursively iterate over dictionary, converting tuple values to lists.

Parameters:
dictionarydict

Dictionary to be converted.

janus_core.cli.utils.end_summary(summary: Path) None[source]

Write final time to summary and close.

Parameters:
summaryPath

Path to summary file being saved.

janus_core.cli.utils.parse_typer_dicts(typer_dicts: list[TyperDict]) list[dict][source]

Convert list of TyperDict objects to list of dictionaries.

Parameters:
typer_dictslist[TyperDict]

List of TyperDict objects to convert.

Returns:
list[dict]

List of converted dictionaries.

Raises:
ValueError

If items in list are not converted to dicts.

janus_core.cli.utils.save_struct_calc(*, inputs: dict, struct: MaybeSequence[Atoms], struct_path: Path, arch: Architectures, device: Devices, model_path: str, read_kwargs: ASEReadArgs, calc_kwargs: dict[str, Any], log: Path) None[source]

Add structure and calculator input information to a dictionary.

Parameters:
inputsdict

Inputs dictionary to add information to.

structMaybeSequence[Atoms]

Structure to be simulated.

struct_pathPath

Path of structure file.

archArchitectures

MLIP architecture.

deviceDevices

Device to run calculations on.

model_pathstr

Path to MLIP model.

read_kwargsASEReadArgs

Keyword arguments to pass to ase.io.read.

calc_kwargsdict[str, Any]]

Keyword arguments to pass to the calculator.

logPath

Path to log file.

janus_core.cli.utils.set_read_kwargs_index(read_kwargs: dict[str, Any]) None[source]

Set default read_kwargs[“index”] to final image and check its value is an integer.

To ensure only a single Atoms object is read, slices such as “:” are forbidden.

Parameters:
read_kwargsdict[str, Any]

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.

janus_core.cli.utils.start_summary(*, command: str, summary: Path, inputs: dict) None[source]

Write initial summary contents.

Parameters:
commandstr

Name of CLI command being used.

summaryPath

Path to summary file being saved.

inputsdict

Inputs to CLI command to save.

janus_core.cli.utils.yaml_converter_loader(config_file: str) dict[str, Any][source]

Load yaml configuration and replace hyphens with underscores.

Parameters:
config_filestr

Yaml configuration file to read.

Returns:
dict[str, Any]

Dictionary with loaded configuration.

janus_core.helpers.janus_types module

Module containing types used in Janus-Core.

class janus_core.helpers.janus_types.ASEOptArgs[source]

Bases: TypedDict

Main arguments for ase optimisers.

__annotations__ = {'logfile': ForwardRef('PathLike | None', module='janus_core.helpers.janus_types'), 'restart': ForwardRef('bool | None', module='janus_core.helpers.janus_types'), 'trajectory': ForwardRef('str | None', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'restart': ForwardRef('bool | None', module='janus_core.helpers.janus_types'), 'logfile': ForwardRef('PathLike | None', module='janus_core.helpers.janus_types'), 'trajectory': ForwardRef('str | None', module='janus_core.helpers.janus_types')}, '__doc__': 'Main arguments for ase optimisers.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'ASEOptArgs' objects>, '__weakref__': <attribute '__weakref__' of 'ASEOptArgs' objects>, '__required_keys__': frozenset(), '__optional_keys__': frozenset({'trajectory', 'restart', 'logfile'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'logfile', 'restart', 'trajectory'})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

logfile: str | Path | None
restart: bool | None
trajectory: str | None
class janus_core.helpers.janus_types.ASEReadArgs[source]

Bases: TypedDict

Main arguments for ase.io.read.

__annotations__ = {'do_not_split_by_at_sign': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'filename': ForwardRef('str | PurePath | IO', module='janus_core.helpers.janus_types'), 'format': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'index': ForwardRef('int | slice | str', module='janus_core.helpers.janus_types'), 'parallel': ForwardRef('bool', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'filename': ForwardRef('str | PurePath | IO', module='janus_core.helpers.janus_types'), 'index': ForwardRef('int | slice | str', module='janus_core.helpers.janus_types'), 'format': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'parallel': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'do_not_split_by_at_sign': ForwardRef('bool', module='janus_core.helpers.janus_types')}, '__doc__': 'Main arguments for ase.io.read.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'ASEReadArgs' objects>, '__weakref__': <attribute '__weakref__' of 'ASEReadArgs' objects>, '__required_keys__': frozenset(), '__optional_keys__': frozenset({'parallel', 'do_not_split_by_at_sign', 'index', 'format', 'filename'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'do_not_split_by_at_sign', 'filename', 'format', 'index', 'parallel'})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

do_not_split_by_at_sign: bool
filename: str | PurePath | IO
format: str | None
index: int | slice | str
parallel: bool
class janus_core.helpers.janus_types.ASEWriteArgs[source]

Bases: TypedDict

Main arguments for ase.io.write.

__annotations__ = {'append': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'filename': ForwardRef('str | PurePath | IO', module='janus_core.helpers.janus_types'), 'format': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'images': ForwardRef('MaybeSequence[Atoms]', module='janus_core.helpers.janus_types'), 'parallel': ForwardRef('bool', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'filename': ForwardRef('str | PurePath | IO', module='janus_core.helpers.janus_types'), 'images': ForwardRef('MaybeSequence[Atoms]', module='janus_core.helpers.janus_types'), 'format': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'parallel': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'append': ForwardRef('bool', module='janus_core.helpers.janus_types')}, '__doc__': 'Main arguments for ase.io.write.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'ASEWriteArgs' objects>, '__weakref__': <attribute '__weakref__' of 'ASEWriteArgs' objects>, '__required_keys__': frozenset(), '__optional_keys__': frozenset({'parallel', 'format', 'filename', 'images', 'append'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'append', 'filename', 'format', 'images', 'parallel'})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

append: bool
filename: str | PurePath | IO
format: str | None
images: Atoms | Sequence[Atoms]
parallel: bool
class janus_core.helpers.janus_types.CalcResults[source]

Bases: TypedDict

Return type from calculations.

__annotations__ = {'energy': ForwardRef('MaybeList[float]', module='janus_core.helpers.janus_types'), 'forces': ForwardRef('MaybeList[NDArray[np.float64]]', module='janus_core.helpers.janus_types'), 'stress': ForwardRef('MaybeList[NDArray[np.float64]]', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'energy': ForwardRef('MaybeList[float]', module='janus_core.helpers.janus_types'), 'forces': ForwardRef('MaybeList[NDArray[np.float64]]', module='janus_core.helpers.janus_types'), 'stress': ForwardRef('MaybeList[NDArray[np.float64]]', module='janus_core.helpers.janus_types')}, '__doc__': 'Return type from calculations.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'CalcResults' objects>, '__weakref__': <attribute '__weakref__' of 'CalcResults' objects>, '__required_keys__': frozenset(), '__optional_keys__': frozenset({'stress', 'forces', 'energy'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'energy', 'forces', 'stress'})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

energy: float | list[float]
forces: ndarray[Any, dtype[float64]] | list[ndarray[Any, dtype[float64]]]
stress: ndarray[Any, dtype[float64]] | list[ndarray[Any, dtype[float64]]]
class janus_core.helpers.janus_types.CorrelationKwargs[source]

Bases: TypedDict

Arguments for on-the-fly correlations <ab>.

__annotations__ = {'a': ForwardRef('Observable', module='janus_core.helpers.janus_types'), 'averaging': ForwardRef('int', module='janus_core.helpers.janus_types'), 'b': ForwardRef('Observable', module='janus_core.helpers.janus_types'), 'blocks': ForwardRef('int', module='janus_core.helpers.janus_types'), 'name': ForwardRef('str', module='janus_core.helpers.janus_types'), 'points': ForwardRef('int', module='janus_core.helpers.janus_types'), 'update_frequency': ForwardRef('int', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'a': ForwardRef('Observable', module='janus_core.helpers.janus_types'), 'b': ForwardRef('Observable', module='janus_core.helpers.janus_types'), 'name': ForwardRef('str', module='janus_core.helpers.janus_types'), 'blocks': ForwardRef('int', module='janus_core.helpers.janus_types'), 'points': ForwardRef('int', module='janus_core.helpers.janus_types'), 'averaging': ForwardRef('int', module='janus_core.helpers.janus_types'), 'update_frequency': ForwardRef('int', module='janus_core.helpers.janus_types')}, '__doc__': 'Arguments for on-the-fly correlations <ab>.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'CorrelationKwargs' objects>, '__weakref__': <attribute '__weakref__' of 'CorrelationKwargs' objects>, '__required_keys__': frozenset({'averaging', 'blocks', 'a', 'b', 'points', 'update_frequency', 'name'}), '__optional_keys__': frozenset(), '__total__': True})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({'a', 'averaging', 'b', 'blocks', 'name', 'points', 'update_frequency'})
__total__ = True
__weakref__

list of weak references to the object

a: Observable

observable a in <ab>, with optional args and kwargs

averaging: int

averaging between blocks

b: Observable

observable b in <ab>, with optional args and kwargs

blocks: int

blocks used in multi-tau algorithm

name: str

name used for correlation in output

points: int

points per block

update_frequency: int

frequency to update the correlation (steps)

class janus_core.helpers.janus_types.EoSResults[source]

Bases: TypedDict

Return type from calculations.

__annotations__ = {'bulk_modulus': ForwardRef('float', module='janus_core.helpers.janus_types'), 'e_0': ForwardRef('float', module='janus_core.helpers.janus_types'), 'eos': ForwardRef('EquationOfState', module='janus_core.helpers.janus_types'), 'v_0': ForwardRef('float', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'eos': ForwardRef('EquationOfState', module='janus_core.helpers.janus_types'), 'bulk_modulus': ForwardRef('float', module='janus_core.helpers.janus_types'), 'v_0': ForwardRef('float', module='janus_core.helpers.janus_types'), 'e_0': ForwardRef('float', module='janus_core.helpers.janus_types')}, '__doc__': 'Return type from calculations.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'EoSResults' objects>, '__weakref__': <attribute '__weakref__' of 'EoSResults' objects>, '__required_keys__': frozenset(), '__optional_keys__': frozenset({'eos', 'v_0', 'e_0', 'bulk_modulus'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'bulk_modulus', 'e_0', 'eos', 'v_0'})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

bulk_modulus: float
e_0: float
eos: EquationOfState
v_0: float
class janus_core.helpers.janus_types.LogLevel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Supported options for logger levels.

DEBUG = 10
ERROR = 40
INFO = 20
WARNING = 30
__module__ = 'janus_core.helpers.janus_types'
class janus_core.helpers.janus_types.OutputKwargs[source]

Bases: ASEWriteArgs

Main keyword arguments for output_structs.

__annotations__ = {'append': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'filename': ForwardRef('str | PurePath | IO', module='janus_core.helpers.janus_types'), 'format': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'images': ForwardRef('MaybeSequence[Atoms]', module='janus_core.helpers.janus_types'), 'invalidate_calc': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'parallel': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'properties': ForwardRef('Collection[Properties]', module='janus_core.helpers.janus_types'), 'set_info': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'write_results': ForwardRef('bool', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'filename': ForwardRef('str | PurePath | IO', module='janus_core.helpers.janus_types'), 'images': ForwardRef('MaybeSequence[Atoms]', module='janus_core.helpers.janus_types'), 'format': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'parallel': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'append': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'set_info': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'write_results': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'properties': ForwardRef('Collection[Properties]', module='janus_core.helpers.janus_types'), 'invalidate_calc': ForwardRef('bool', module='janus_core.helpers.janus_types')}, '__doc__': 'Main keyword arguments for `output_structs`.', '__dict__': <attribute '__dict__' of 'OutputKwargs' objects>, '__weakref__': <attribute '__weakref__' of 'OutputKwargs' objects>, '__orig_bases__': (<class 'janus_core.helpers.janus_types.ASEWriteArgs'>,), '__required_keys__': frozenset(), '__optional_keys__': frozenset({'parallel', 'format', 'append', 'images', 'properties', 'filename', 'invalidate_calc', 'write_results', 'set_info'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'append', 'filename', 'format', 'images', 'invalidate_calc', 'parallel', 'properties', 'set_info', 'write_results'})
__orig_bases__ = (<class 'janus_core.helpers.janus_types.ASEWriteArgs'>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

append: bool
filename: str | PurePath | IO
format: str | None
images: Atoms | Sequence[Atoms]
invalidate_calc: bool
parallel: bool
properties: Collection[Literal['energy', 'stress', 'forces', 'hessian']]
set_info: bool
write_results: bool
class janus_core.helpers.janus_types.PostProcessKwargs[source]

Bases: TypedDict

Main arguments for MD post-processing.

__annotations__ = {'rdf_by_elements': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'rdf_compute': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'rdf_elements': ForwardRef('MaybeSequence[str | int]', module='janus_core.helpers.janus_types'), 'rdf_nbins': ForwardRef('int', module='janus_core.helpers.janus_types'), 'rdf_output_file': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'rdf_rmax': ForwardRef('float', module='janus_core.helpers.janus_types'), 'rdf_start': ForwardRef('int', module='janus_core.helpers.janus_types'), 'rdf_step': ForwardRef('int', module='janus_core.helpers.janus_types'), 'rdf_stop': ForwardRef('int | None', module='janus_core.helpers.janus_types'), 'vaf_atoms': ForwardRef('Sequence[Sequence[int]]', module='janus_core.helpers.janus_types'), 'vaf_compute': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'vaf_fft': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'vaf_output_file': ForwardRef('PathLike | None', module='janus_core.helpers.janus_types'), 'vaf_start': ForwardRef('int', module='janus_core.helpers.janus_types'), 'vaf_step': ForwardRef('int', module='janus_core.helpers.janus_types'), 'vaf_stop': ForwardRef('int | None', module='janus_core.helpers.janus_types'), 'vaf_velocities': ForwardRef('bool', module='janus_core.helpers.janus_types')}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.janus_types', '__annotations__': {'rdf_compute': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'rdf_rmax': ForwardRef('float', module='janus_core.helpers.janus_types'), 'rdf_nbins': ForwardRef('int', module='janus_core.helpers.janus_types'), 'rdf_elements': ForwardRef('MaybeSequence[str | int]', module='janus_core.helpers.janus_types'), 'rdf_by_elements': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'rdf_start': ForwardRef('int', module='janus_core.helpers.janus_types'), 'rdf_stop': ForwardRef('int | None', module='janus_core.helpers.janus_types'), 'rdf_step': ForwardRef('int', module='janus_core.helpers.janus_types'), 'rdf_output_file': ForwardRef('str | None', module='janus_core.helpers.janus_types'), 'vaf_compute': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'vaf_velocities': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'vaf_fft': ForwardRef('bool', module='janus_core.helpers.janus_types'), 'vaf_atoms': ForwardRef('Sequence[Sequence[int]]', module='janus_core.helpers.janus_types'), 'vaf_start': ForwardRef('int', module='janus_core.helpers.janus_types'), 'vaf_stop': ForwardRef('int | None', module='janus_core.helpers.janus_types'), 'vaf_step': ForwardRef('int', module='janus_core.helpers.janus_types'), 'vaf_output_file': ForwardRef('PathLike | None', module='janus_core.helpers.janus_types')}, '__doc__': 'Main arguments for MD post-processing.', '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'PostProcessKwargs' objects>, '__weakref__': <attribute '__weakref__' of 'PostProcessKwargs' objects>, '__required_keys__': frozenset(), '__optional_keys__': frozenset({'rdf_nbins', 'vaf_compute', 'rdf_step', 'vaf_start', 'rdf_output_file', 'vaf_atoms', 'vaf_output_file', 'vaf_stop', 'rdf_elements', 'rdf_rmax', 'rdf_by_elements', 'rdf_stop', 'vaf_velocities', 'rdf_start', 'vaf_fft', 'vaf_step', 'rdf_compute'}), '__total__': False})
__module__ = 'janus_core.helpers.janus_types'
__optional_keys__ = frozenset({'rdf_by_elements', 'rdf_compute', 'rdf_elements', 'rdf_nbins', 'rdf_output_file', 'rdf_rmax', 'rdf_start', 'rdf_step', 'rdf_stop', 'vaf_atoms', 'vaf_compute', 'vaf_fft', 'vaf_output_file', 'vaf_start', 'vaf_step', 'vaf_stop', 'vaf_velocities'})
__orig_bases__ = (<function TypedDict>,)
__required_keys__ = frozenset({})
__total__ = False
__weakref__

list of weak references to the object

rdf_by_elements: bool
rdf_compute: bool
rdf_elements: str | int | Sequence[str | int]
rdf_nbins: int
rdf_output_file: str | None
rdf_rmax: float
rdf_start: int
rdf_step: int
rdf_stop: int | None
vaf_atoms: Sequence[Sequence[int]]
vaf_compute: bool
vaf_fft: bool
vaf_output_file: str | Path | None
vaf_start: int
vaf_step: int
vaf_stop: int | None
vaf_velocities: bool

janus_core.helpers.log module

Configure logger with yaml-styled format.

class janus_core.helpers.log.YamlFormatter(*args, **kwargs)[source]

Bases: Formatter

Custom formatter to convert multiline messages into yaml list.

Parameters:
fmtstr | None

A format string in the given style for the logged output as a whole. Default is defined by FORMAT.

datefmtstr | None

A format string in the given style for the date/time portion of the logged output. Default is taken from logging.Formatter.formatTime().

styleLiteral[‘%’, ‘{’, ‘$’]

Determines how the format string will be merged with its data. Can be one of ‘%’, ‘{’ or ‘$’. Default is ‘%’.

validatebool

If True, incorrect or mismatched fmt and style will raise a ValueError. Default is True.

defaultsdict[str, logging.Any] | None

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 = '\n- timestamp: %(asctime)s\n  level: %(levelname)s\n  message: %(message)s\n  trace: %(module)s\n  line: %(lineno)d\n'
__init__(*args, **kwargs) None[source]

Set default string format to yaml style.

Parameters:
*args

Arguments to pass to logging.Formatter.__init__.

**kwargs

Keyword arguments to pass to logging.Formatter.__init__.

__module__ = 'janus_core.helpers.log'
format(record: LogRecord) str[source]

Format log message to convert new lines into a yaml list.

Parameters:
recordlogging.LogRecord

Log record to be formatted.

Returns:
str

Formatted log message.

janus_core.helpers.log.config_logger(name: str, filename: str | None = None, level: LogLevel = 20, capture_warnings: bool = True, filemode: Literal['r', 'w', 'a', 'x', 'r+', 'w+', 'a+', 'x+'] = 'w', force: bool = True) Logger | None[source]

Configure logger with yaml-styled format.

Parameters:
namestr

Name of logger. Default is None.

filenamestr | None

Name of log file if writing logs. Default is None.

levelLogLevel

Threshold for logger. Default is logging.INFO.

capture_warningsbool

Whether to capture warnings in log. Default is True.

filemodestr

Mode of file to open. Default is “w”.

forcebool

If true, remove and close existing handlers attached to the root logger before configuration. Default is True.

Returns:
logging.Logger | None

Configured logger if filename has been specified.

janus_core.helpers.log.config_tracker(janus_logger: Logger | None, track_carbon: bool = True, *, country_iso_code: str = 'GBR', save_to_file: bool = False, log_level: Literal['debug', 'info', 'warning', 'error', 'critical'] = 'critical') OfflineEmissionsTracker | None[source]

Configure codecarbon tracker to log outputs.

Parameters:
janus_loggerlogging.Logger | None

Logger for codecarbon output.

track_carbonbool

Whether to track carbon emissions for calculation. Default is True.

country_iso_codestr

3 letter ISO Code of the country where the code is running. Default is “GBR”.

save_to_filebool

Whether to also output results to a csv file. Default is False.

log_levelLiteral[“debug”, “info”, “warning”, “error”, “critical”]

Log level of internal carbon tracker log. Default is “critical”.

Returns:
OfflineEmissionsTracker | None

Configured offline codecarbon tracker, if logger is specified.

janus_core.helpers.mlip_calculators module

Configure MLIP calculators.

Similar in spirit to matcalc and quacc approaches - https://github.com/materialsvirtuallab/matcalc - https://github.com/Quantum-Accelerators/quacc.git

janus_core.helpers.mlip_calculators._set_model_path(model_path: PathLike | None = None, kwargs: dict[str, Any] | None = None) PathLike | torch.nn.Module | None[source]

Set model_path.

Parameters:
model_pathPathLike | None

Path to MLIP file.

kwargsdict[str, Any] | None

Dictionary of additional keyword arguments passed to the selected calculator.

Returns:
PathLike | torch.nn.Module | None

Path to MLIP model file, loaded model, or None.

janus_core.helpers.mlip_calculators.check_calculator(calc: Calculator, attribute: str) None[source]

Ensure calculator has ability to calculate properties.

If the calculator is a SumCalculator that inlcudes the TorchDFTD3Calculator, this also sets the relevant function so that the MLIP component of the calculator is used for properties unrelated to dispersion.

Parameters:
calcCalculator

ASE Calculator to check.

attributestr

Attribute to check calculator for.

janus_core.helpers.mlip_calculators.choose_calculator(arch: Architectures = 'mace', device: Devices = 'cpu', model_path: PathLike | None = None, **kwargs) Calculator[source]

Choose MLIP calculator to configure.

Parameters:
archArchitectures

MLIP architecture. Default is “mace”.

deviceDevices

Device to run calculator on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP file.

**kwargs

Additional keyword arguments passed to the selected calculator.

Returns:
Calculator

Configured MLIP calculator.

Raises:
ModuleNotFoundError

MLIP module not correctly been installed.

ValueError

Invalid architecture specified.

janus_core.helpers.utils module

Utility functions for janus_core.

class janus_core.helpers.utils.FileNameMixin(struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, file_prefix: str | Path | None, *additional)[source]

Bases: ABC

Provide mixin functions for standard filename handling.

Parameters:
structMaybeSequence[Atoms]

Structure from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

file_prefixPathLike | None

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.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.utils', '__doc__': '\n    Provide mixin functions for standard filename handling.\n\n    Parameters\n    ----------\n    struct : MaybeSequence[Atoms]\n        Structure from which to derive the default name. If `struct` is a sequence,\n        the first structure will be used.\n    struct_path : PathLike | None\n        Path to file containing structures.\n    file_prefix : PathLike | None\n        Default prefix to use.\n    *additional\n        Components to add to default file_prefix (joined by hyphens).\n\n    Methods\n    -------\n    _get_default_prefix(file_prefix, struct)\n        Return a prefix from the provided file_prefix or from chemical formula of\n        struct.\n    _build_filename(suffix, *additional, filename, prefix_override)\n         Return a standard format filename if filename not provided.\n    ', '__init__': <function FileNameMixin.__init__>, '_get_default_prefix': <staticmethod(<function FileNameMixin._get_default_prefix>)>, '_build_filename': <function FileNameMixin._build_filename>, '__dict__': <attribute '__dict__' of 'FileNameMixin' objects>, '__weakref__': <attribute '__weakref__' of 'FileNameMixin' objects>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
__init__(struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, file_prefix: str | Path | None, *additional) None[source]

Provide mixin functions for standard filename handling.

Parameters:
structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file structures were read from. Used as default prefix is not None.

file_prefixPathLike | None

Default prefix to use.

*additional

Components to add to default file_prefix (joined by hyphens).

__module__ = 'janus_core.helpers.utils'
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
_build_filename(suffix: str, *additional, filename: str | Path | None = None, prefix_override: str | None = None) Path[source]

Set filename using the file prefix and suffix if not specified otherwise.

Parameters:
suffixstr

Default suffix to use if filename is not specified.

*additional

Extra components to add to suffix (joined with hyphens).

filenamePathLike | None

Filename to use, if specified. Default is None.

prefix_overridestr | None

Replace file_prefix if not None.

Returns:
Path

Filename specified, or default filename.

static _get_default_prefix(file_prefix: str | Path | None, struct: Atoms | Sequence[Atoms], struct_path: str | Path | None, *additional) str[source]

Determine the default prefix from the structure or provided file_prefix.

Parameters:
file_prefixPathLike | None

Given file_prefix.

structMaybeSequence[Atoms]

Structure(s) from which to derive the default name. If struct is a sequence, the first structure will be used.

struct_pathPathLike | None

Path to file containing structures.

*additional

Components to add to default file_prefix (joined by hyphens).

Returns:
str

File prefix.

janus_core.helpers.utils._dump_ascii(file: TextIO, header: list[str], columns: dict[str, Sequence[Any]], formats: Sequence[str]) None[source]

Dump data as an ASCII style table.

Parameters:
fileTextIO

File to dump to.

headerlist[str]

Column name information.

columnsdict[str, Sequence[Any]]

Column data by key (ordered with header info).

formatsSequence[str]

Python magic string formats to apply (must align with header info).

See also

write_table

Main entry function.

janus_core.helpers.utils._dump_csv(file: TextIO, header: list[str], columns: dict[str, Sequence[Any]], formats: Sequence[str]) None[source]

Dump data as a csv style table.

Parameters:
fileTextIO

File to dump to.

headerlist[str]

Column name information.

columnsdict[str, Sequence[Any]]

Column data by key (ordered with header info).

formatsSequence[str]

Python magic string formats to apply (must align with header info).

See also

write_table

Main entry function.

janus_core.helpers.utils.check_files_exist(config: dict, req_file_keys: Sequence[str | Path]) None[source]

Check files specified in a dictionary read from a configuration file exist.

Parameters:
configdict

Dictionary read from configuration file.

req_file_keysSequence[Pathlike]

Files that must exist if defined in the configuration file.

Raises:
FileNotFoundError

If a key from req_file_keys is in the configuration file, but the file corresponding to the configuration value do not exist.

janus_core.helpers.utils.none_to_dict(*dictionaries: Sequence[dict | None]) Generator[dict, None, None][source]

Ensure dictionaries that may be None are dictionaries.

Parameters:
*dictionariesSequence[dict | None]

Sequence of dictionaries that could be None.

Yields:
dict

Input dictionaries or {} if empty or None.

janus_core.helpers.utils.selector_len(slc: slice | range | int | tuple[int | None, int | None, int] | list, selectable_length: int) int[source]

Calculate the length of a selector applied to an indexable of a given length.

Parameters:
slcUnion[SliceLike, list]

The applied SliceLike or list for selection.

selectable_lengthint

The length of the selectable object.

Returns:
int

Length of the result of applying slc.

janus_core.helpers.utils.slicelike_to_startstopstep(index: slice | range | int | tuple[int | None, int | None, int]) tuple[int | None, int | None, int][source]

Standarize SliceLike`s into tuple of `start, stop, step.

Parameters:
indexSliceLike

SliceLike to standardize.

Returns:
StartStopStep

Standardized SliceLike as start, stop, step triplet.

janus_core.helpers.utils.track_progress(sequence: Sequence | Iterable, description: str) Iterable[source]

Track the progress of iterating over a sequence.

This is done by displaying a progress bar in the console using the rich library. The function is an iterator over the sequence, updating the progress bar each iteration.

Parameters:
sequenceIterable

The sequence to iterate over. Must support “len”.

descriptionstr

The text to display to the left of the progress bar.

Yields:
Iterable

An iterable of the values in the sequence.

janus_core.helpers.utils.validate_slicelike(maybe_slicelike: slice | range | int | tuple[int | None, int | None, int]) None[source]

Raise an exception if slc is not a valid SliceLike.

Parameters:
maybe_slicelikeSliceLike

Candidate to test.

Raises:
ValueError

If maybe_slicelike is not SliceLike.

janus_core.helpers.utils.write_table(fmt: Literal['ascii', 'csv'], file: TextIO | None = None, units: dict[str, str] | None = None, formats: dict[str, str] | None = None, *, print_header: bool = True, **columns) StringIO | None[source]

Dump a table in a standard format.

Table columns are passed as kwargs, with the column header being the keyword name and data the value.

Each header also supports an optional “<header>_units” or “<header>_format” kwarg to define units and format for the column. These can also be passed explicitly through the respective dictionaries where the key is the “header”.

Parameters:
fmt{‘ascii’, ‘csv’}

Format to write table in.

fileTextIO

File to dump to. If unspecified function returns io.StringIO object simulating file.

unitsdict[str, str]

Units as {key: unit}:

key

To align with those in columns.

unit

String defining unit.

Units which do not match any columns in columns are ignored.

formatsdict[str, str]

Output formats as {key: format}:

key

To align with those in columns.

format

Python magic format string to use.

print_headerbool

Whether to print the header or just append formatted data.

**columnsdict[str, Any]

Dictionary of columns names to data with optional “<header>_units”/”<header>_format” to define units/format.

See: Examples.

Returns:
StringIO | None

If no file given write columns to StringIO.

Notes

Passing “kwarg_units” or “kwarg_format” takes priority over those passed in the units/formats dicts.

Examples

>>> data = write_table(fmt="ascii", single=(1, 2, 3),
...                    double=(2,4,6), double_units="THz")
>>> print(*data, sep="", end="")
# single | double [THz]
1 2
2 4
3 6
>>> data = write_table(fmt="csv", a=(3., 5.), b=(11., 12.),
...                    units={'a': 'eV', 'b': 'Ha'})
>>> print(*data, sep="", end="")
a [eV],b [Ha]
3.0,11.0
5.0,12.0
>>> data = write_table(fmt="csv", a=(3., 5.), b=(11., 12.),
...                    formats={"a": ".3f"})
>>> print(*data, sep="", end="")
a,b
3.000,11.0
5.000,12.0
>>> data = write_table(fmt="ascii", single=(1, 2, 3),
...                    double=(2,4,6), double_units="THz",
...                    print_header=False)
>>> print(*data, sep="", end="")
1 2
2 4
3 6

janus_core.helpers.stats

Module that reads the md stats output timeseries.

class janus_core.helpers.stats.Stats(source: str | Path)[source]

Bases: object

Configure shared molecular dynamics simulation options.

Parameters:
sourcePathLike

File that contains the stats of a molecular dynamics simulation.

Attributes:
columns

Return number of columns.

data

Return the timeseries data.

data_tags

Return the labels and their units together.

labels

Return a list of labels for the columns in data.

rows

Return number of rows.

source

Return filename which is the source of data.

units

Return a list of units for the columns in data.

Methods

read()

Read MD stats and store them in data.

_(ind) ndarray[Any, dtype[float64]][source]
__dict__ = mappingproxy({'__module__': 'janus_core.helpers.stats', '__doc__': '\n    Configure shared molecular dynamics simulation options.\n\n    Parameters\n    ----------\n    source : PathLike\n        File that contains the stats of a molecular dynamics simulation.\n    ', '__init__': <function Stats.__init__>, '_getind': <functools.singledispatchmethod object>, '_': <function Stats._>, '__getitem__': <functools.singledispatchmethod object>, 'rows': <property object>, 'columns': <property object>, 'source': <property object>, 'labels': <property object>, 'units': <property object>, 'data': <property object>, 'data_tags': <property object>, 'read': <function Stats.read>, '__repr__': <function Stats.__repr__>, '__dict__': <attribute '__dict__' of 'Stats' objects>, '__weakref__': <attribute '__weakref__' of 'Stats' objects>, '__annotations__': {}})
__getitem__(ind) ndarray[Any, dtype[float64]][source]
__getitem__(ind: ellipsis) ndarray[Any, dtype[float64]]
__getitem__(ind: slice) ndarray[Any, dtype[float64]]
__getitem__(ind: int) ndarray[Any, dtype[float64]]
__getitem__(ind: tuple) ndarray[Any, dtype[float64]]
__getitem__(ind: list) ndarray[Any, dtype[float64]]
__getitem__(ind: str) ndarray[Any, dtype[float64]]

Get member of stats data by label or index.

Parameters:
indAny

Index or label to find.

Returns:
NDArray[float64]

Columns of data by label.

Raises:
IndexError

Invalid index type or label not found in labels.

__init__(source: str | Path) None[source]

Initialise MD stats reader.

Parameters:
sourcePathLike

File that contains the stats of a molecular dynamics simulation.

__module__ = 'janus_core.helpers.stats'
__repr__() str[source]

Summary of timeseries contained, units, headers.

Returns:
str

Summary of the data.

__weakref__

list of weak references to the object

_getind(lab: T) T[source]
_getind(lab: str) int

Convert an index label from str to int if present in labels.

Otherwise return the input.

Parameters:
labstr

Label to find.

Returns:
int

Index of label in self or input if not string.

Raises:
IndexError

Label not found in labels.

property columns: int

Return number of columns.

Returns:
int

Number of columns in data.

property data: ndarray[Any, dtype[float64]]

Return the timeseries data.

Returns:
NDArray[float64]

Data for timeseries in data.

property data_tags: Iterator[tuple[str, str]]

Return the labels and their units together.

Returns:
Iterator[tuple[str, str]]

Zipped labels and units.

property labels: tuple[str, ...]

Return a list of labels for the columns in data.

Returns:
tuple[str, …]

List of labels for the columns in data.

read() None[source]

Read MD stats and store them in data.

property rows: int

Return number of rows.

Returns:
int

Number of rows in data.

property source: str | Path

Return filename which is the source of data.

Returns:
PathLike

Filename for the source of data.

property units: tuple[str, ...]

Return a list of units for the columns in data.

Returns:
tuple[str, …]

List of units for the columns in data.

janus_core.helpers.struct_io

Module for functions for input and output of structures.

janus_core.helpers.struct_io.attach_calculator(struct: Atoms | Sequence[Atoms], *, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, calc_kwargs: dict[str, Any] | None = None) None[source]

Configure calculator and attach to structure(s).

Parameters:
structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to attach calculators to.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

janus_core.helpers.struct_io.input_structs(struct: Atoms | Sequence[Atoms] | None = None, *, struct_path: str | Path | None = None, read_kwargs: ASEReadArgs | None = None, sequence_allowed: bool = True, arch: Literal['mace', 'mace_mp', 'mace_off', 'm3gnet', 'chgnet', 'alignn', 'sevennet'] = 'mace_mp', device: Literal['cpu', 'cuda', 'mps', 'xpu'] = 'cpu', model_path: str | Path | None = None, calc_kwargs: dict[str, Any] | None = None, set_calc: bool | None = None, logger: Logger | None = None) Atoms | Sequence[Atoms][source]

Read input structures and/or attach MLIP calculators.

Parameters:
structMaybeSequence[Atoms] | None

ASE Atoms structure(s) to simulate. Required if struct_path is None. Default is None.

struct_pathPathLike | None

Path of structure to simulate. Required if struct is None. Default is None.

read_kwargsASEReadArgs

Keyword arguments to pass to ase.io.read. Default is {}.

sequence_allowedbool

Whether a sequence of Atoms objects is allowed. Default is True.

archArchitectures

MLIP architecture to use for calculations. Default is “mace_mp”.

deviceDevices

Device to run model on. Default is “cpu”.

model_pathPathLike | None

Path to MLIP model. Default is None.

calc_kwargsdict[str, Any] | None

Keyword arguments to pass to the selected calculator. Default is {}.

set_calcbool | None

Whether to set (new) calculators for structures. Default is True if struct_path is specified or struct is missing calculators, else default is False.

loggerlogging.Logger | None

Logger if log file has been specified. Default is None.

Returns:
MaybeSequence[Atoms]

Structure(s) with attached MLIP calculators.

janus_core.helpers.struct_io.output_structs(images: Atoms | Sequence[Atoms], *, struct_path: str | Path | None = None, set_info: bool = True, write_results: bool = False, properties: Collection[Literal['energy', 'stress', 'forces', 'hessian']] = (), invalidate_calc: bool = False, write_kwargs: ASEWriteArgs | None = None) None[source]

Copy or move calculated results to Atoms.info dict and/or write structures to file.

Parameters:
imagesMaybeSequence[Atoms]

Atoms object or a list of Atoms objects to interact with.

struct_pathPathLike | None

Path of structure being simulated. If specified, the file stem is added to the info dict under “system_name”. Default is None.

set_infobool

True to set info dict from calculated results. Default is True.

write_resultsbool

True to write out structure with results of calculations. Default is False.

propertiesCollection[Properties]

Properties to copy from calculated results to info dict. Default is ().

invalidate_calcbool

Whether to remove all calculator results after copying properties to info dict. Default is False.

write_kwargsASEWriteArgs | None

Keyword arguments passed to ase.io.write. Default is {}.

janus_core.helpers.struct_io.results_to_info(struct: Atoms, *, properties: Collection[Literal['energy', 'stress', 'forces', 'hessian']] = (), invalidate_calc: bool = False) None[source]

Copy or move MLIP calculated results to Atoms.info dict.

Parameters:
structAtoms

Atoms object to copy or move calculated results to info dict.

propertiesCollection[Properties]

Properties to copy from results to info dict. Default is ().

invalidate_calcbool

Whether to remove all calculator results after copying properties to info dict. Default is False.

janus_core.processing.correlator module

Module to correlate scalar data on-the-fly.

class janus_core.processing.correlator.Correlation(*, a: Observable, b: Observable, name: str, blocks: int, points: int, averaging: int, update_frequency: int)[source]

Bases: object

Represents a user correlation, <ab>.

Parameters:
aObservable

Observable for a.

bObservable

Observable for b.

namestr

Name of correlation.

blocksint

Number of correlation blocks.

pointsint

Number of points per block.

averagingint

Averaging window per block level.

update_frequencyint

Frequency to update the correlation, md steps.

Attributes:
update_frequency

Get update frequency.

Methods

get()

Get the correlation value and lags, averaging over atoms if applicable.

update(atoms)

Update a correlation.

__dict__ = mappingproxy({'__module__': 'janus_core.processing.correlator', '__doc__': '\n    Represents a user correlation, <ab>.\n\n    Parameters\n    ----------\n    a : Observable\n        Observable for a.\n    b : Observable\n        Observable for b.\n    name : str\n        Name of correlation.\n    blocks : int\n        Number of correlation blocks.\n    points : int\n        Number of points per block.\n    averaging : int\n        Averaging window per block level.\n    update_frequency : int\n        Frequency to update the correlation, md steps.\n    ', '__init__': <function Correlation.__init__>, 'update_frequency': <property object>, 'update': <function Correlation.update>, 'get': <function Correlation.get>, '__str__': <function Correlation.__str__>, '__dict__': <attribute '__dict__' of 'Correlation' objects>, '__weakref__': <attribute '__weakref__' of 'Correlation' objects>, '__annotations__': {}})
__init__(*, a: Observable, b: Observable, name: str, blocks: int, points: int, averaging: int, update_frequency: int) None[source]

Initialise a correlation.

Parameters:
aObservable

Observable for a.

bObservable

Observable for b.

namestr

Name of correlation.

blocksint

Number of correlation blocks.

pointsint

Number of points per block.

averagingint

Averaging window per block level.

update_frequencyint

Frequency to update the correlation, md steps.

__module__ = 'janus_core.processing.correlator'
__str__() str[source]

Return string representation of correlation.

Returns:
str

String representation.

__weakref__

list of weak references to the object

get() tuple[Iterable[float], Iterable[float]][source]

Get the correlation value and lags, averaging over atoms if applicable.

Returns:
correlationIterable[float]

The correlation values <a(t)b(t+t’)>.

lagsIterable[float]]

The correlation lag times t’.

update(atoms: Atoms) None[source]

Update a correlation.

Parameters:
atomsAtoms

Atoms object to observe values from.

property update_frequency: int

Get update frequency.

Returns:
int

Correlation update frequency.

class janus_core.processing.correlator.Correlator(*, blocks: int, points: int, averaging: int)[source]

Bases: object

Correlate scalar real values, <ab>.

Parameters:
blocksint

Number of correlation blocks.

pointsint

Number of points per block.

averagingint

Averaging window per block level.

Methods

get_lags()

Obtain the correlation lag times.

get_value()

Obtain the correlation value.

update(a, b)

Update the correlation, <ab>, with new values a and b.

__dict__ = mappingproxy({'__module__': 'janus_core.processing.correlator', '__doc__': '\n    Correlate scalar real values, <ab>.\n\n    Parameters\n    ----------\n    blocks : int\n        Number of correlation blocks.\n    points : int\n        Number of points per block.\n    averaging : int\n        Averaging window per block level.\n    ', '__init__': <function Correlator.__init__>, 'update': <function Correlator.update>, '_propagate': <function Correlator._propagate>, '_shifts_valid': <function Correlator._shifts_valid>, 'get_lags': <function Correlator.get_lags>, 'get_value': <function Correlator.get_value>, '__dict__': <attribute '__dict__' of 'Correlator' objects>, '__weakref__': <attribute '__weakref__' of 'Correlator' objects>, '__annotations__': {}})
__init__(*, blocks: int, points: int, averaging: int) None[source]

Initialise an empty Correlator.

Parameters:
blocksint

Number of correlation blocks.

pointsint

Number of points per block.

averagingint

Averaging window per block level.

__module__ = 'janus_core.processing.correlator'
__weakref__

list of weak references to the object

_propagate(a: float, b: float, block: int) None[source]

Propagate update down block hierarchy.

Parameters:
afloat

Newly observed value of left correland/average.

bfloat

Newly observed value of right correland/average.

blockint

Block in the hierachy being updated.

_shifts_valid(block: int, p_i: int, p_j: int) bool[source]

Return True if the shift registers have data.

Parameters:
blockint

Block to check the shift register of.

p_iint

Index i in the shift (left correland).

p_jint

Index j in the shift (right correland).

Returns:
bool

Whether the shift indices have data.

get_lags() Iterable[float][source]

Obtain the correlation lag times.

Returns:
Iterable[float]

The correlation lag times.

get_value() Iterable[float][source]

Obtain the correlation value.

Returns:
Iterable[float]

The correlation values <a(t)b(t+t’)>.

update(a: float, b: float) None[source]

Update the correlation, <ab>, with new values a and b.

Parameters:
afloat

Newly observed value of left correland.

bfloat

Newly observed value of right correland.

janus_core.processing.observables module

Module for built-in correlation observables.

class janus_core.processing.observables.ComponentMixin(components: dict[str, int])[source]

Bases: object

Mixin to handle Observables with components.

Parameters:
componentsdict[str, int]

Symbolic components mapped to indices.

Attributes:
components

Get the symbolic components of the observable.

__dict__ = mappingproxy({'__module__': 'janus_core.processing.observables', '__doc__': '\n    Mixin to handle Observables with components.\n\n    Parameters\n    ----------\n    components : dict[str, int]\n        Symbolic components mapped to indices.\n    ', '__init__': <function ComponentMixin.__init__>, '_indices': <property object>, 'components': <property object>, '__dict__': <attribute '__dict__' of 'ComponentMixin' objects>, '__weakref__': <attribute '__weakref__' of 'ComponentMixin' objects>, '__annotations__': {}})
__init__(components: dict[str, int])[source]

Initialise the mixin with components.

Parameters:
componentsdict[str, int]

Symbolic components mapped to indices.

__module__ = 'janus_core.processing.observables'
__weakref__

list of weak references to the object

property _indices: list[int]

Get indices associated with self.components.

Returns:
list[int]

The indices for each self.components.

property components: list[str]

Get the symbolic components of the observable.

Returns:
list[str]

The observables components.

class janus_core.processing.observables.Observable(atoms_slice: list[int] | SliceLike | None = None)[source]

Bases: ABC

Observable data that may be correlated.

Parameters:
atoms_slicelist[int] | SliceLike | None = None

A slice of atoms to observe.

Methods

__call__(atoms)

Signature for returning observed value from atoms.

__abstractmethods__ = frozenset({'__call__'})
__annotations__ = {}
abstract __call__(atoms: Atoms) list[float][source]

Signature for returning observed value from atoms.

Parameters:
atomsAtoms

Atoms object to extract values from.

Returns:
list[float]

The observed value, with dimensions atoms by self.dimension.

__dict__ = mappingproxy({'__module__': 'janus_core.processing.observables', '__doc__': '\n    Observable data that may be correlated.\n\n    Parameters\n    ----------\n    atoms_slice : list[int] | SliceLike | None = None\n        A slice of atoms to observe.\n    ', '__init__': <function Observable.__init__>, '__call__': <function Observable.__call__>, '__dict__': <attribute '__dict__' of 'Observable' objects>, '__weakref__': <attribute '__weakref__' of 'Observable' objects>, '__abstractmethods__': frozenset({'__call__'}), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
__init__(atoms_slice: list[int] | SliceLike | None = None)[source]

Initialise an observable with a given dimensionality.

Parameters:
atoms_slicelist[int] | SliceLike | None

A slice of atoms to observe. By default all atoms are included.

__module__ = 'janus_core.processing.observables'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
class janus_core.processing.observables.Stress(*, components: list[str], atoms_slice: list[int] | SliceLike | None = None, include_ideal_gas: bool = True)[source]

Bases: Observable, ComponentMixin

Observable for stress components.

Parameters:
componentslist[str]

Symbols for correlated tensor components, xx, yy, etc.

atoms_slicelist[int] | SliceLike | None = None

List or slice of atoms to observe velocities from.

include_ideal_gasbool

Calculate with the ideal gas contribution.

Attributes:
components

Get the symbolic components of the observable.

Methods

__call__(atoms)

Get the stress components.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__call__(atoms: Atoms) list[float][source]

Get the stress components.

Parameters:
atomsAtoms

Atoms object to extract values from.

Returns:
list[float]

The stress components in GPa units.

Raises:
ValueError

If atoms is not an Atoms object.

__dict__ = mappingproxy({'__module__': 'janus_core.processing.observables', '__doc__': '\n    Observable for stress components.\n\n    Parameters\n    ----------\n    components : list[str]\n        Symbols for correlated tensor components, xx, yy, etc.\n    atoms_slice : list[int] | SliceLike | None = None\n        List or slice of atoms to observe velocities from.\n    include_ideal_gas : bool\n        Calculate with the ideal gas contribution.\n    ', '__init__': <function Stress.__init__>, '__call__': <function Stress.__call__>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
__init__(*, components: list[str], atoms_slice: list[int] | SliceLike | None = None, include_ideal_gas: bool = True)[source]

Initialise the observable from a symbolic str component.

Parameters:
componentslist[str]

Symbols for tensor components, xx, yy, etc.

atoms_slicelist[int] | SliceLike | None = None

List or slice of atoms to observe velocities from.

include_ideal_gasbool

Calculate with the ideal gas contribution.

__module__ = 'janus_core.processing.observables'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
property _indices: list[int]

Get indices associated with self.components.

Returns:
list[int]

The indices for each self.components.

property components: list[str]

Get the symbolic components of the observable.

Returns:
list[str]

The observables components.

class janus_core.processing.observables.Velocity(*, components: list[str], atoms_slice: list[int] | SliceLike | None = None)[source]

Bases: Observable, ComponentMixin

Observable for per atom velocity components.

Parameters:
componentslist[str]

Symbols for velocity components, x, y, z.

atoms_slicelist[int] | SliceLike | None = None

List or slice of atoms to observe velocities from.

Attributes:
components

Get the symbolic components of the observable.

Methods

__call__(atoms)

Get the velocity components for correlated atoms.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__call__(atoms: Atoms) list[float][source]

Get the velocity components for correlated atoms.

Parameters:
atomsAtoms

Atoms object to extract values from.

Returns:
list[float]

The velocity values.

__dict__ = mappingproxy({'__module__': 'janus_core.processing.observables', '__doc__': '\n    Observable for per atom velocity components.\n\n    Parameters\n    ----------\n    components : list[str]\n        Symbols for velocity components, x, y, z.\n    atoms_slice : list[int] | SliceLike | None = None\n        List or slice of atoms to observe velocities from.\n    ', '__init__': <function Velocity.__init__>, '__call__': <function Velocity.__call__>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
__init__(*, components: list[str], atoms_slice: list[int] | SliceLike | None = None)[source]

Initialise the observable from a symbolic str component and atom index.

Parameters:
componentslist[str]

Symbols for tensor components, x, y, and z.

atoms_sliceUnion[list[int], SliceLike]

List or slice of atoms to observe velocities from.

__module__ = 'janus_core.processing.observables'
__slots__ = ()
__weakref__

list of weak references to the object

_abc_impl = <_abc._abc_data object>
property _indices: list[int]

Get indices associated with self.components.

Returns:
list[int]

The indices for each self.components.

property components: list[str]

Get the symbolic components of the observable.

Returns:
list[str]

The observables components.

janus_core.processing.post_process module

Module for post-processing trajectories.

janus_core.processing.post_process.compute_rdf(data: Atoms | Sequence[Atoms], ana: Analysis | None = None, /, *, filenames: str | Path | Sequence[str | Path] | None = None, by_elements: bool = False, rmax: float = 2.5, nbins: int = 50, elements: str | int | Sequence[str | int] | None = None, index: slice | range | int | tuple[int | None, int | None, int] = (0, None, 1), volume: float | None = None) ndarray[Any, dtype[float64]] | dict[tuple[str, str] | ndarray[Any, dtype[float64]]][source]

Compute the rdf of data.

Parameters:
dataMaybeSequence[Atoms]

Dataset to compute RDF of.

anaAnalysis | None

ASE Analysis object for data reuse.

filenamesMaybeSequence[PathLike] | None

Filenames to output data to. Must match number of RDFs computed.

by_elementsbool

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.

rmaxfloat

Maximum distance of RDF.

nbinsint

Number of bins to divide RDF.

elementsMaybeSequence[int | str] | None

Make partial RDFs. If by_elements is true will filter to only display pairs in list.

indexSliceLike

Images to analyze as: index if int, start, stop, step if tuple, slice if slice or range.

volumefloat | None

Volume of cell for normalisation. Only needs to be provided if aperiodic cell. Default is (2*rmax)**3.

Returns:
NDArray[float64] | dict[tuple[str, str] | NDArray[float64]]

If by_elements is true returns a dict of RDF by element pairs. Otherwise returns RDF of total system filtered by elements.

janus_core.processing.post_process.compute_vaf(data: Sequence[Atoms], filenames: str | Path | Sequence[str | Path] | None = None, *, use_velocities: bool = False, fft: bool = False, index: slice | range | int | tuple[int | None, int | None, int] = (0, None, 1), filter_atoms: int | None | Sequence[int | None] | Sequence[int | None | Sequence[int | None]] = (None,), time_step: float = 1.0) tuple[ndarray[Any, dtype[float64]], list[ndarray[Any, dtype[float64]]]][source]

Compute the velocity autocorrelation function (VAF) of data.

Parameters:
dataSequence[Atoms]

Dataset to compute VAF of.

filenamesMaybeSequence[PathLike] | None

If present, dump resultant VAF to file.

use_velocitiesbool

Compute VAF using velocities rather than momenta. Default is False.

fftbool

Compute the fourier transformed VAF. Default is False.

indexSliceLike

Images to analyze as start, stop, step. Default is all images.

filter_atomsMaybeSequence[MaybeSequence[int | None]]

Compute the VAF averaged over subsets of the system. Default is all atoms.

time_stepfloat

Time step for scaling lags to align with input data. Default is 1 (i.e. no scaling).

Returns:
lagsnumpy.ndarray

Lags at which the VAFs have been computed.

vafslist[numpy.ndarray]

Computed VAF(s).

Notes

filter_atoms is given as a series of sequences of atoms, where each element in the series denotes a VAF subset to calculate and each sequence determines the atoms (by index) to be included in that VAF.

E.g.

Would compute separate VAFs for each species.

By default, one VAF will be computed for all atoms in the structure.

janus_core.processing.symmetry module

Module for functions operating on structure symmetry.

janus_core.processing.symmetry.snap_symmetry(struct: Atoms, sym_tolerance: float = 0.001) None[source]

Symmetrize structure’s cell vectors and atomic positions.

Parameters:
structAtoms

Structure as an ase Atoms object.

sym_tolerancefloat

Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001.

janus_core.processing.symmetry.spacegroup(struct: Atoms, sym_tolerance: float = 0.001, angle_tolerance: float = -1.0) str[source]

Determine the spacegroup for a structure.

Parameters:
structAtoms

Structure as an ase Atoms object.

sym_tolerancefloat

Atom displacement tolerance for spglib symmetry determination, in Å. Default is 0.001.

angle_tolerancefloat

Angle precision for spglib symmetry determination, in degrees. Default is -1.0, which means an internally optimized routine is used to judge symmetry.

Returns:
str

Spacegroup name.

janus_core.training.preprocess module

Preprocess MLIP training data.

janus_core.training.preprocess.preprocess(mlip_config: str | Path, req_file_keys: Sequence[str | Path] = ('train_file', 'test_file', 'valid_file'), attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None) None[source]

Convert training data to hdf5 by passing a configuration file to the MLIP’s CLI.

Currently only supports MACE models, but this can be extended by replacing the argument parsing.

Parameters:
mlip_configPathLike

Configuration file to pass to MLIP.

req_file_keysSequence[PathLike]

List of files that must exist if defined in the configuration file. Default is (“train_file”, “test_file”, “valid_file”).

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.

janus_core.training.train module

Train MLIP.

janus_core.training.train.train(mlip_config: str | Path, req_file_keys: Sequence[str | Path] = ('train_file', 'test_file', 'valid_file', 'statistics_file'), attach_logger: bool = False, log_kwargs: dict[str, Any] | None = None, track_carbon: bool = True, tracker_kwargs: dict[str, Any] | None = None) None[source]

Run training for MLIP by passing a configuration file to the MLIP’s CLI.

Currently only supports MACE models, but this can be extended by replacing the argument parsing.

Parameters:
mlip_configPathLike

Configuration file to pass to MLIP.

req_file_keysSequence[PathLike]

List of files that must exist if defined in the configuration file. Default is (“train_file”, “test_file”, “valid_file”, “statistics_file”).

attach_loggerbool

Whether to attach a logger. Default is False.

log_kwargsdict[str, Any] | None

Keyword arguments to pass to config_logger. Default is {}.

track_carbonbool

Whether to track carbon emissions of calculation. Default is True.

tracker_kwargsdict[str, Any] | None

Keyword arguments to pass to config_tracker. Default is {}.