mythos.simulators.base

Base class for a simulation.

Classes

SimulatorOutput

Output container for simlators.

Simulator

Base class for a simulation.

InputDirSimulator

A base class for simulators that run based on an input directory.

Module Contents

class mythos.simulators.base.SimulatorOutput[source]

Output container for simlators.

observables: list[Any]
state: dict[str, Any]
class mythos.simulators.base.Simulator[source]

Base class for a simulation.

name: str
exposed_observables: ClassVar[list[str]] = ['trajectory']
run(*_args, opt_params: dict[str, Any], **_kwargs) SimulatorOutput[source]

Run the simulation.

exposes() list[str][source]

Get the list of exposed observables.

classmethod create_n(n: int, name: str | None = None, **kwargs) list[Simulator][source]

Create N simulators with unique names.

class mythos.simulators.base.InputDirSimulator[source]

Bases: Simulator, abc.ABC

A base class for simulators that run based on an input directory.

This class handles copying the input directory to a temporary location unless overwrite_input is set to True.

Subclasses must implement the run_simulation method, which runs the simulation logic given the provided input directory.

Parameters:
  • input_dir – Path to the input directory.

  • overwrite_input – Whether to overwrite the input directory or copy it. If this is False (default), the contents of the input_dir will be copied to a temporary directory for running the simulation to avoid overwriting input.

input_dir: str
overwrite_input: bool = False
run(*args, **kwargs) SimulatorOutput[source]

Run the simulation.

copy_inputs(temp_dir: str) None[source]

Copy input files to temporary directory.

abstractmethod run_simulation(input_dir: pathlib.Path, *args, **kwargs) SimulatorOutput[source]

Run the simulation in the given input directory.