Simulation Engine: Interface¶
- class mlip.simulation.simulation_engine.SimulationEngine(atoms: Atoms, force_field: ForceField, config: SimulationConfig)¶
Abstract base class of a simulation engine that can be implemented by different backends and can, in principle, run many types of simulations (e.g., MD or energy minimizations).
- __init__(atoms: Atoms, force_field: ForceField, config: SimulationConfig) None ¶
Constructor that initializes the simulation state and an empty list of loggers. Engine-specific initialization is then delegated to
._initialize()
- Parameters:
atoms – The atoms of the system to simulate.
force_field – The force field to use in the simulation.
config – The configuration/settings of the simulation.
- abstract run() None ¶
Runs the simulation and populates the simulation state during the run. Note that this method should only be called once and its behaviour will not be defined if called a second time.
- attach_logger(logger: Callable[[SimulationState], None]) None ¶
Adds a logger to the list of loggers of the simulation engine.
The logger function must only take in a single argument, the simulation state, and it shall not return anything.
- Parameters:
logger – The logger to add.
- abstract _initialize(atoms: Atoms, force_field: ForceField, config: SimulationConfig) None ¶
Subclasses should implement this method to handle their specific initialization.
- Parameters:
atoms – The atoms of the system to simulate.
force_field – The force field to use in the simulation.
config – The configuration/settings of the simulation.