Simulation

#include "Spirit/Simulation.h"

This API of Spirit is used to run and monitor iterative calculation methods.

If many iterations are called individually, one should use the single shot simulation functionality. It avoids the allocations etc. involved when a simulation is started and ended and behaves like a regular simulation, except that the iterations have to be triggered manually.

Definition of solvers

Note that the VP and NCG Solvers are only meant for direct minimization and not for dynamics.

Solver_VP

Solver_VP          0

VP: Verlet-like velocity projection

Solver_SIB

Solver_SIB         1

SIB: Verlet-like velocity projection

Solver_Depondt

Solver_Depondt     2

Depondt: Verlet-like velocity projection

Solver_Heun

Solver_Heun        3

Heun: Verlet-like velocity projection

Solver_RungeKutta4

Solver_RungeKutta4 4

RK4: Verlet-like velocity projection

Start or stop a simulation

PREFIX


Monte Carlo

Simulation_LLG_Start

void Simulation_LLG_Start(State *state, int solver_type, int n_iterations=-1, int n_iterations_log=-1, bool singleshot=false, int idx_image=-1, int idx_chain=-1)

Landau-Lifshitz-Gilbert dynamics and energy minimisation

Simulation_GNEB_Start

void Simulation_GNEB_Start(State *state, int solver_type, int n_iterations=-1, int n_iterations_log=-1, bool singleshot=false, int idx_chain=-1)

Geodesic nudged elastic band method

Simulation_MMF_Start

void Simulation_MMF_Start(State *state, int solver_type, int n_iterations=-1, int n_iterations_log=-1, bool singleshot=false, int idx_image=-1, int idx_chain=-1)

Minimum mode following method

Simulation_EMA_Start

void Simulation_EMA_Start(State *state, int n_iterations=-1, int n_iterations_log=-1, bool singleshot=false, int idx_image=-1, int idx_chain=-1)

Eigenmode analysis

Simulation_SingleShot

void Simulation_SingleShot(State *state, int idx_image=-1, int idx_chain=-1)

Single iteration of a Method

If singleshot=true was passed to Simulation_..._Start before, this will perform one iteration. Otherwise, nothing will happen.

Simulation_Stop

void Simulation_Stop(State *state, int idx_image=-1, int idx_chain=-1)

Stop a simulation running on an image or chain

Simulation_Stop_All

void Simulation_Stop_All(State *state)

Stop all simulations

Get information

Simulation_Get_MaxTorqueComponent

float Simulation_Get_MaxTorqueComponent(State * state, int idx_image=-1, int idx_chain=-1)

Get maximum torque component.

If a MC, LLG, MMF or EMA simulation is running this returns the max. torque on the current image.

If a GNEB simulation is running this returns the max. torque on the current chain.

Simulation_Get_Chain_MaxTorqueComponents

void Simulation_Get_Chain_MaxTorqueComponents(State * state, float * torques, int idx_chain=-1)

Get maximum torque components on the images of a chain.

Will only work if a GNEB simulation is running.

Simulation_Get_IterationsPerSecond

float Simulation_Get_IterationsPerSecond(State *state, int idx_image=-1, int idx_chain=-1)

Returns the iterations per second (IPS).

If a MC, LLG, MMF or EMA simulation is running this returns the IPS on the current image.

If a GNEB simulation is running this returns the IPS on the current chain.

Simulation_Get_Iteration

int Simulation_Get_Iteration(State *state, int idx_image=-1, int idx_chain=-1)

Returns the number of iterations performed by the current simulation so far.

Simulation_Get_Time

float Simulation_Get_Time(State *state, int idx_image=-1, int idx_chain=-1)

Get time passed by the simulation [ps]

Returns:

  • if an LLG simulation is running returns the cumulatively summed time steps dt
  • otherwise returns 0

Simulation_Get_Wall_Time

int Simulation_Get_Wall_Time(State *state, int idx_image=-1, int idx_chain=-1)

Get number of miliseconds of wall time since the simulation was started

Simulation_Get_Solver_Name

const char * Simulation_Get_Solver_Name(State *state, int idx_image=-1, int idx_chain=-1)

Get name of the currently used method.

If a MC, LLG, MMF or EMA simulation is running this returns the Solver name on the current image.

If a GNEB simulation is running this returns the Solver name on the current chain.

Simulation_Get_Method_Name

const char * Simulation_Get_Method_Name(State *state, int idx_image=-1, int idx_chain=-1)

Get name of the currently used method.

If a MC, LLG, MMF or EMA simulation is running this returns the Method name on the current image.

If a GNEB simulation is running this returns the Method name on the current chain.

Whether a simulation is running

Simulation_Running_On_Image

bool Simulation_Running_On_Image(State *state, int idx_image=-1, int idx_chain=-1)

Check if a simulation is running on specific image of specific chain

Simulation_Running_On_Chain

bool Simulation_Running_On_Chain(State *state, int idx_chain=-1)

Check if a simulation is running across a specific chain

Simulation_Running_Anywhere_On_Chain

bool Simulation_Running_Anywhere_On_Chain(State *state, int idx_chain=-1)

Check if a simulation is running on any or all images of a chain