# Switching with Intentional Modification

The switching of a rectangular shaped thin film with perpendicular magnetic anisotropy (PMA) is simulated. Therefore an external field is applied perpendicular to the plane and antiparallel to the magnetization. A nucleation site with reduced anisotropy constant is located within the thin film.

## Code

from magnum import *
from magnum.tools import frange
from math import sin, cos

# Define material with perpendicular magnetic anisotropy
PMA = Material({
'id': 'PMA',
'Ms': 500e3,
'alpha': 0.2,
'A': 30e-12,
'axis1': (0,0,1),
'axis2': (0,1,0),
'k_uniaxial': 400e3,
'k_cubic': 0.0})

# Define a world with a circular nucleation site
world = World(
RectangularMesh((200, 80, 1), (2.5e-9, 2.5e-9, 7.68e-9)),
Body('all', PMA),
Body('nucleation_site', PMA, Cylinder(
(100e-9, 100e-9, 0), (100e-9, 100e-9, 7.68e-9), 50e-9)))

# Initialize Simulation and set the magnetization
create_solver(world,
[StrayField, ExchangeField,ExternalField, AnisotropyField],log=True)
solver.state.M=(0,0,-5e5)

# Reduce the anisotropy in the nucleation site to 60%
solver.state["nucleation_site"].k_uniaxial=0.6*PMA.k_uniaxial
solver.state["nucleation_site"].axis1 = (0,0,1)

# Add step handlers to save the simulation data
VTKStorage("ms_60_r_50nm", "M"), Condition.everyNthStep(100))
DataTableLog("ms_60_r_50nm/data.odt"), Condition.everyNthStep(10))

# Perform hysteresis: Sweep external field and simulate until relaxation
for Hx_sweep in frange(0.001, 0.600, 0.001):
solver.state.H_ext_offs =
((Hx_sweep/MU0*sin(0.052), 0.0,Hx_sweep/MU0*cos(0.052)))
solver.solve(Condition.time(1e-13+solver.state.t))
solver.solve(Condition.relaxed(20.0,20))


## Results

Due to the reduction of the anisotropy constant in the nucleation site the onset of the rotation of the magnetic moments is located in this intentional modification. The reversal process then proceeds through the rest of the thin film. The switching field is much lower than in comparable thin films without a nucleation site.

The time evolution of the magnetization rendered with ParaView