Skyrmion in a disk#
In this example, we stabilize a single Skyrmion in a circular shaped thin film.
Simulation#
Import libraries#
[1]:
import pyvista as pv
from scipy import constants
import neuralmag as nm
pv.set_jupyter_backend("static")
2025-09-19 14:54:03 NeuralMag:INFO [NeuralMag] Version 0.9.3
Create mesh and state#
We create a 2D nodal mesh (mesh with just 1 layer of nodes in the z-direction) with \(50 \times 50\) cells with cell size \(2 \times 2 \times 0.6\,\text{nm}^3\).
[2]:
mesh = nm.Mesh((50, 50), (2e-9, 2e-9, 0.6e-9), (-50e-9, -50e-9, 0))
state = nm.State(mesh)
2025-09-19 14:54:03 NeuralMag:INFO [Mesh] 2D, 50 x 50 (size = 2e-09 x 2e-09 x 6e-10)
2025-09-19 14:54:04 NeuralMag:INFO [NeuralMag] Backend set to 'jax'.
2025-09-19 14:54:04 NeuralMag:INFO [NeuralMag] Set default device to 'TFRT_CPU_0'.
2025-09-19 14:54:04 NeuralMag:INFO [NeuralMag] Set default dtype to 'float32'.
2025-09-19 14:54:04 NeuralMag:INFO [State] Running on device: TFRT_CPU_0 (dtype = float32, backend = jax)
Set material parameters#
[3]:
state.material.Ms = 1.0 / constants.mu_0
state.material.A = 1.6e-11
state.material.Di = 4e-3
state.material.Di_axis = [0, 0, 1]
state.material.Ku = 510e3
state.material.Ku_axis = [0, 0, 1]
state.material.alpha = 0.1
Define circular geometry#
Initialize geometry by defining a circular domain with ID 1.
[4]:
x, y = state.coordinates()
state.add_domain(1, x**2.0 + y**2.0 < 50e-9**2.0)
Set initial magnetization#
[5]:
state.m = nm.VectorFunction(state).fill((0, 0, 1))
Register effective field#
The effective field comprises exchange, demag, interface DMI and uniaxial anisotropy contributions
[6]:
nm.ExchangeField().register(state, "exchange")
nm.DemagField().register(state, "demag")
nm.InterfaceDMIField().register(state, "dmi")
nm.UniaxialAnisotropyField().register(state, "aniso")
nm.TotalField("exchange", "demag", "dmi", "aniso").register(state)
2025-09-19 14:54:04 NeuralMag:INFO [ExchangeField] Register state methods (field: 'h_exchange', energy: 'E_exchange', energy density: 'e_exchange')
2025-09-19 14:54:04 NeuralMag:INFO [DemagField] Register state methods (field: 'h_demag', energy: 'E_demag', energy density: 'e_demag')
2025-09-19 14:54:04 NeuralMag:INFO [DemagField]: Set up demag tensor
2025-09-19 14:54:06 NeuralMag:INFO [InterfaceDMIField] Register state methods (field: 'h_dmi', energy: 'E_dmi', energy density: 'e_dmi')
2025-09-19 14:54:06 NeuralMag:INFO [UniaxialAnisotropyField] Register state methods (field: 'h_aniso', energy: 'E_aniso', energy density: 'e_aniso')
2025-09-19 14:54:06 NeuralMag:INFO [TotalField] Register state methods (field: 'h', energy: 'E', energy density: 'e')
Relax to skyrmion configuration#
[7]:
llg = nm.LLGSolver(state, scale_t=1e-12)
llg.relax(1e9)
state.write_vti(["m", "rho", "e"], "skyrmion-disk/m.vti")
2025-09-19 14:54:06 NeuralMag:INFO [LLGSolverJAX] Initialize RHS function
2025-09-19 14:54:06 NeuralMag:INFO [LLGSolverJAX] Relaxation started, initial energy E = -5.77e-19 J
2025-09-19 14:54:07 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 8.85105e+11) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 6.79921e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 5.37775e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 5.64878e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 4.86677e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 3.03321e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.90584e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.86546e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.16112e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.76105e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 3.85612e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 6.8187e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.24968e+11) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.48982e+11) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 5.67693e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.60393e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.67795e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.55931e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.4247e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.28628e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.15145e+10) 1/s
2025-09-19 14:54:09 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.02736e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 9.31324e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.72934e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.97034e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 4.44915e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 4.96538e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 4.64533e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 4.94813e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 3.11297e+10) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 9.68685e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.76109e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.40585e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 2.08952e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.81648e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.57754e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.36861e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.189e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation step (max dm/dt = 1.03094e+09) 1/s
2025-09-19 14:54:10 NeuralMag:INFO [LLGSolverJAX] Relaxation finished, final energy E = -1.47908e-18 J
Visualization#
We use pyvista to visualize the resulting skyrmion, using a threshold filte on state.rho in order to show only the magnetic region.
[8]:
grid = pv.read("skyrmion-disk/m.vti")
thresholded = grid.threshold(value=0.5, scalars="rho", preference="cell")
glyphs = thresholded.glyph(orient="m", scale="m", factor=1e-8)
# Plot
plotter = pv.Plotter()
plotter.add_mesh(glyphs, scalars="e", lighting=True, smooth_shading=True)
plotter.show()