Skip to content

Conversation

@stekajack
Copy link
Contributor

@stekajack stekajack commented Oct 23, 2025

Magnetodynamics Overview

Magnetodynamics refers to the ability to evolve the degrees of freedom of a dipole moment using a defined set of rules (a model), such that magnetic relaxation is not strictly tied to the Brownian relaxation of a particle.

There are three relevant internal relaxation mechanisms for magnetic nanoparticles (on timescales typically interesting for MD simulations):

  • Brownian relaxation ($\tau_B$)
  • Néel relaxation ($\tau_N$)
  • Rotational diffusion of the dipole moment ($\tau_D$)

Thermal Stoner–Wohlfarth Model

The thermal Stoner–Wohlfarth (SW) model provides a state-of-the-art, scalable method for including Néel relaxation in simulations of single-domain magnetic nanoparticles.

Broadly speaking, the model:

  1. Finds the critical points of the magnetic energy of a Stoner–Wohlfarth particle.
  2. Based on the relative orientation of the local magnetic field and the particle’s director, determines the correct orientation for the dipole moment.
  3. Computes the probability of the dipole moment flipping its orientation with respect to the easy axis (i.e. Néel relaxation), derived from the energy barrier between critical points.
  4. Executes a kinetic Monte Carlo move according to that probability.

Implementation Details

The feature is implemented under the compile-time flag:
THERMAL_STONER_WOHLFARTH

If enabled, the following particle properties become available:

/** Flag indicating if the particle is real and its director should be used */
bool sw_real = false;

/** Flag indicating if the particle is virtual and its dipole moment should be evolved */
bool sw_virt = false;

/** Angle between the director and dipole moment of a SW particle */
double phi0 = 0.0;

/** Saturation magnetization of the particle */
double sat_mag = 0.0;

/** 
 * Hk = 2 * K1 / (mu0 * Ms)
 *  -> anisotropy field [A/m], where K1 is the magnetic anisotropy constant [kg/(m·s²)].
 * On the particle, we store the inverse of Hk (Hkinv) in reduced units.
 */
double Hkinv = 0.0;

/** Energy units parameter for the kinetic MC step */
double kT_KVm_inv = 0.0;

/** Time units parameters for the kinetic MC step */
double tau0_inv = 0.0;
double tau_trans_inv = 0.0;

/** Time between kinetic MC steps */
double dt_incr = 0.0;

References
• Publication: Phys. Rev. B 111, 014438 (2025)
• Optimization Library: NLopt (used to find critical points in magnetic energy)

Notes

This method relies on the DIPOLE_FIELD_TRACKING feature of ESPResSo to correctly incorporate dipole interactions.
For interacting systems, it should only be used with magnetostatic actors that support this feature.

Tasks:

  • replace marsenne-twister with philox
    • NOTE: now using rng state from thermostat
  • replace sw_real/sw_virtual flags with single enable_magnetodynamics=true on virtual
  • group magnetodynamics particle params in a typed enum magnetodynamics (similar to swimmers)
  • enable access to RNG seed via script interface
    • NOTE: seed and step are taken directly from thermostat, so no need for extra interface
  • sw_main refactor:
    • for_each loop over virtual particles
    • separate external field summation
    • separate main into smaler clearer steps
  • improve docstrings:
    • write out SW abbreviations
    • annotate equation numbers from reference paper in code
    • docstrings for minimization helpers

stekajack and others added 30 commits November 29, 2022 17:03
Description of changes:
- use modern CMake and enable ccache for CUDA files
- document all CMake options of the ESPResSo project
- fix regressions in the python documentation that will become errors in future Sphinx and autopep versions
- rewrite and unit test the config file generator
   - bugfix: compiler errors are no longer ignored when parsing `myconfig-final.hpp` and `cmake_config.hpp`
   - bugfix: external features mismatch between `features.def` and `cmake_config.cmakein` now throws errors
RudolfWeeber
RudolfWeeber previously approved these changes Nov 28, 2025
@RudolfWeeber
Copy link
Contributor

Thank you Deniz! @jngrad from my side, this PR is ready. Can you please take over for the merge?

@jngrad jngrad self-assigned this Nov 28, 2025
Copy link
Member

@jngrad jngrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me and can go in the 5.0 release. I'll try to sort out the NLopt installation step as soon as possible.

@jngrad jngrad added this to the ESPResSo 5.0 milestone Dec 1, 2025
@jngrad jngrad merged commit d7811f0 into espressomd:python Dec 2, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants