Simulation

This module 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.

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

spirit.simulation.METHOD_EMA = 4

Eigenmode analysis.

Applies eigenmodes to the spins of a system. Depending on parameters, this can be used to calculate the change of a spin configuration through such a mode or to get a “dynamical” chain of images corresponding to the movement of the system under the mode.

spirit.simulation.METHOD_GNEB = 2

Geodesic nudged elastic band.

Runs on the entire chain.

As this is a minimisation method, the dynamical solvers perform worse than those designed for minimisation.

spirit.simulation.METHOD_LLG = 1

Landau-Lifshitz-Gilbert.

Can be either a dynamical simulation or an energy minimisation. Note: the VP solver can only minimise.

spirit.simulation.METHOD_MC = 0

Monte Carlo.

Standard implementation.

spirit.simulation.METHOD_MMF = 3

Minimum mode following.

As this is a minimisation method, the dynamical solvers perform worse than those designed for minimisation.

spirit.simulation.SOLVER_DEPONDT = 2

Depondt’s Heun-like method.

spirit.simulation.SOLVER_HEUN = 3

Heun’s method.

spirit.simulation.SOLVER_LBFGS_Atlas = 6

Limited memory Broyden-Fletcher-Goldfarb-Shannon, using stereographic transforms

spirit.simulation.SOLVER_LBFGS_OSO = 5

Limited memory Broyden-Fletcher-Goldfarb-Shannon, using exponential transforms.

spirit.simulation.SOLVER_RK4 = 4

4th order Runge-Kutta method.

spirit.simulation.SOLVER_SIB = 1

Semi-implicit midpoint method B.

spirit.simulation.SOLVER_VP = 0

Verlet-like velocity projection method.

spirit.simulation.SOLVER_VP_OSO = 7

Verlet-like velocity projection method, using exponential transforms.

spirit.simulation.get_iterations_per_second(p_state, idx_image=-1, idx_chain=-1)

Returns the current estimation of the number of iterations per second.

spirit.simulation.get_max_torque_norm(p_state, idx_image=-1, idx_chain=-1)

Returns the current maximum norm of the torque acting on any spin.

spirit.simulation.get_time(p_state, idx_image=-1, idx_chain=-1)

If an LLG simulation is running returns the cumulatively summed time steps dt, otherwise returns 0

spirit.simulation.get_wall_time(p_state, idx_image=-1, idx_chain=-1)

Returns the current maximum norm of the torque acting on any spin.

spirit.simulation.n_shot(p_state, N, idx_image=-1, idx_chain=-1)

Perform a single iteration.

In order to use this, a single shot simulation must be running on the corresponding image or chain.

spirit.simulation.running_anywhere_on_chain(p_state, idx_chain=-1)

Check if any simulation running on any image of - or the entire - chain.

spirit.simulation.running_on_chain(p_state, idx_chain=-1)

Check if a simulation is running across a specific chain.

spirit.simulation.running_on_image(p_state, idx_image=-1, idx_chain=-1)

Check if a simulation is running on a specific image.

spirit.simulation.single_shot(p_state, idx_image=-1, idx_chain=-1)

Perform a single iteration.

In order to use this, a single shot simulation must be running on the corresponding image or chain.

spirit.simulation.start(p_state, method_type, solver_type=None, n_iterations=-1, n_iterations_log=-1, single_shot=False, idx_image=-1, idx_chain=-1)

Start any kind of iterative calculation method.

  • method_type: one of the integers defined above
  • solver_type: only used for LLG, GNEB and MMF methods (default: None)
  • n_iterations: the maximum number of iterations that will be performed (default: take from parameters)
  • n_iterations_log: the number of iterations after which to log the status and write output (default: take from parameters)
  • single_shot: if set to True, iterations have to be triggered individually
  • idx_image: the image on which to run the calculation (default: active image). Not used for GNEB
spirit.simulation.stop(p_state, idx_image=-1, idx_chain=-1)

Stop the simulation running on an image or chain.

spirit.simulation.stop_all(p_state)

Stop all simulations running anywhere.