Warning! This is the API for mumax3.9c, which is no longer supported. If you like to use mumax3, we strongly recommend to use mumax3.10.
The mumax3 input syntax is a subset of Go's syntax, somewhat similar to C. It is case-independent however, so msat is the same as Msat or MSAT.
:=
. Variables have a fixed type, inferred from the declaration's right-hand-side. Assigning to existing variables is done using =
. E.g.:
i := 7 // defines a new variable i, type automatically detected to be int
print(i) // now we can use i
i = 5 // assign new value, don't use ':=' (attempt to re-declare)
str := "hello" // defines str, type automatically is string
//str = 1 // would fail, cannot assign int to string
x := pi*(3+4)/5
x = pow(x, 3)
x++
y := abs(cbrt(cosh(erf(erfc(gamma(J0(Y0(2))))))))
for i:=0; i<10; i++{
print(i)
}
RunWhile(func()bool)
, or all input parameters). In that case, and only in this case, the argument is implicitly converted to a function, which is re-evaluated each time it's needed. E.g.:
value := sin(pi*t) // value is a float64, RHS evaluated only once
Msat = value // time-independent Msat
versus:
Msat = sin(pi*t) // RHS converted to function, re-evaluted every time
Nx := 128
Ny := 64
Nz := 2
sizeX := 500e-9
sizeY := 250e-9
sizeZ := 10e-9
SetGridSize(Nx, Ny, Nz)
SetCellSize(sizeX/Nx, sizeY/Ny, sizeZ/Nz)
SetPBC(5, 0, 0) // 5 extra images on left and right sides.
SetGridSize(128, 64, 1)
SetCellSize(5e-9, 5e-9, 5e-9)
Setting a nonzero PBC value in a direction enables wrap-around in that direction. The precise value passed determines how many repetitions are seen by the demag field. E.g., in the above example the demag field behaves as if 5 repetitions are present to the left and to the right side. Choosing a large number may cause long initialization time.
SetCellSize(float64, float64, float64)
Sets the X,Y,Z cell size in meters
examples: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
SetGridSize(int, int, int)
Sets the number of cells for X,Y,Z
examples: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
SetMesh(int, int, int, float64, float64, float64, int, int, int)
Sets GridSize, CellSize and PBC in once
SetPBC(int, int, int)
Sets number of repetitions in X,Y,Z
SetGeom(cylinder(400e-9, 20e-9).RotX(45*pi/180).Transl(1e-6,0,0))
SetGeom(Shape)
Sets the geometry to a given shape
examples: [4] [6] [7] [8] [9] [11] [12] [14]
EdgeSmooth
Geometry edge smoothing with edgeSmooth^3 samples per cell, 0=staircase, ~8=very smooth
examples: [4]
Cell(int, int, int) Shape
Single cell with given integer index (i, j, k)
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
Circle(float64) Shape
2D Circle with diameter in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [4] [6] [7] [8] [12]
Cuboid(float64, float64, float64) Shape
Cuboid with sides in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [4]
Cylinder(float64, float64) Shape
3D Cylinder with diameter and height in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
Ellipse(float64, float64) Shape
2D Ellipse with axes in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [14]
Ellipsoid(float64, float64, float64) Shape
3D Ellipsoid with axes in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [4]
GrainRoughness(float64, float64, float64, int) Shape
Grainy surface with different heights per grain
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
ImageShape(string) Shape
Use black/white image as shape
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [4]
Layer(int) Shape
Single layer (along z), by integer index starting from 0
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
Layers(int, int) Shape
Part of space between cell layer1 (inclusive) and layer2 (exclusive), in integer indices
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [4]
Rect(float64, float64) Shape
2D rectangle with size in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [4] [6] [9] [11] [12] [15]
Square(float64) Shape
2D square with size in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
examples: [6]
Universe() Shape
Entire space
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
XRange(float64, float64) Shape
Part of space between x1 and x2, in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
YRange(float64, float64) Shape
Part of space between y1 and y2, in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
ZRange(float64, float64) Shape
Part of space between z1 and z2, in meter
methods: Add( Shape ) Intersect( Shape ) Inverse( ) Repeat( float64 float64 float64 ) RotX( float64 ) RotY( float64 ) RotZ( float64 ) Scale( float64 float64 float64 ) Sub( Shape ) Transl( float64 float64 float64 ) Xor( Shape )
regions
to verify whether each cell is assigned to the intended region. Each region can have its own material parameters, and we can output averages over each region. E.g.:
DefRegion(1, circle(1e-6))
DefRegion(0, circle(1e-6).Inverse()) // redundant
save(regions)
Msat.SetRegion(1, 800e6)
tableAdd(m.Region(1)) // add average m over region 1 to table
DefRegion(int, Shape)
Define a material region with given index (0-255) and shape
DefRegionCell(int, int, int, int)
Set a material region in one cell by index
regions
Outputs the region index for each cell
methods: Average( ) GetCell( int int int ) Gpu( ) HostArray( ) HostList( ) LoadFile( string ) SetCell( int int int int )
Config
to m, setting it in separate regions, or by loading a file directly.
m = uniform(1, 0, 0)
m.SetRegion(1, vortex(1, 1))
m.LoadFile("config.ovf")
m
Reduced magnetization (unit length)
methods: Average( ) Buffer( ) Comp( int ) GetCell( int int int ) LoadFile( string ) Region( int ) Set( Config ) SetArray( Slice ) SetCell( int int int data.Vector ) SetInShape( Shape Config ) SetRegion( int Config ) TableData( )
examples: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
Antivortex(int, int) Config
Antivortex magnetization with given circulation and core polarization
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
BlochSkyrmion(int, int) Config
Bloch skyrmion magnetization with given chirality and core polarization
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
examples: [5]
NeelSkyrmion(int, int) Config
Néél skyrmion magnetization with given charge and core polarization
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
examples: [5]
RandomMag() Config
Random magnetization
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
RandomMagSeed(int) Config
Random magnetization with given seed
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
TwoDomain(float64, float64, float64, float64, float64, float64, float64, float64, float64) Config
Twodomain magnetization with with given magnetization in left domain, wall, and right domain
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
Uniform(float64, float64, float64) Config
Uniform magnetization in given direction
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
examples: [1] [2] [5] [6] [7] [13] [14] [15]
Vortex(int, int) Config
Vortex magnetization with given circulation and core polarization
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
VortexWall(float64, float64, int, int) Config
Vortex wall magnetization with given mx in left and right domain and core circulation and polarization
methods: Add( float64 Config ) RotZ( float64 ) Scale( float64 float64 float64 ) Transl( float64 float64 float64 )
examples: [5]
Msat = 800e3
AnisU = vector(1, 0, 0)
When regions are defined, they can also be set region-wise:
Msat.SetRegion(0, 800e3)
Msat.SetRegion(1, 540e3)
Material parameters can be functions of time as well. E.g.:
f := 500e6
Ku1 = 500 * sin(2*pi*f*t)
Aex
Exchange stiffness (J/m)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
examples: [1] [2] [3] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
alpha
Landau-Lifshitz damping constant
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
examples: [1] [6] [7] [8] [10] [11] [12] [14] [15]
anisC1
Cubic anisotropy direction #1
methods: Average( ) Comp( int ) GetRegion( int ) IsUniform( ) Region( int ) SetRegion( int VectorFunction ) SetRegionFn( int func() [3]float64 )
examples: [12]
anisC2
Cubic anisotorpy directon #2
methods: Average( ) Comp( int ) GetRegion( int ) IsUniform( ) Region( int ) SetRegion( int VectorFunction ) SetRegionFn( int func() [3]float64 )
examples: [12]
anisU
Uniaxial anisotropy direction
methods: Average( ) Comp( int ) GetRegion( int ) IsUniform( ) Region( int ) SetRegion( int VectorFunction ) SetRegionFn( int func() [3]float64 )
Dbulk
Bulk Dzyaloshinskii-Moriya strength (J/m2)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Dind
Interfacial Dzyaloshinskii-Moriya strength (J/m2)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
EpsilonPrime
Slonczewski secondairy STT term ε'
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
examples: [14]
FixedLayer
Slonczewski fixed layer polarization
methods: Average( ) Comp( int ) GetRegion( int ) IsUniform( ) Region( int ) SetRegion( int VectorFunction ) SetRegionFn( int func() [3]float64 )
examples: [14]
frozenspins
Defines spins that should be fixed
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Kc1
1st order cubic anisotropy constant (J/m3)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
examples: [12]
Kc2
2nd order cubic anisotropy constant (J/m3)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Kc3
3rd order cubic anisotropy constant (J/m3)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Ku1
1st order uniaxial anisotropy constant (J/m3)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Ku2
2nd order uniaxial anisotropy constant (J/m3)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Lambda
Slonczewski Λ parameter
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
examples: [14]
Msat
Saturation magnetization (A/m)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
examples: [1] [2] [3] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
NoDemagSpins
Disable magnetostatic interaction per-spin (set to 1 to disable)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Pol
Electrical current polarization
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
Temp
Temperature (K)
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
xi
Non-adiabaticity of spin-transfer-torque
methods: Average( ) GetRegion( int ) IsUniform( ) Region( int ) Set( float64 ) SetRegion( int ScalarFunction ) SetRegionFuncGo( int func() float64 ) SetRegionValueGo( int float64 )
B_ext = vector(0.01, 1e-6*sin(2*pi*f*t), 0)
B_ext.SetRegion(1, vector(0, 0, 0.1))
Additionally, an arbitrary number of time- and space-dependent vector fields of the form g(x,y,z) * f(t)
may be added. (E.g., to simulate the field of an antenna or an arbitrary current running through the magnet)
B_ext.Add(LoadFile("antenna.ovf"), sin(2*pi*f*t))
JPol.Add(LoadFile("current.ovf"), 1)
B_ext
Externally applied field (T)
methods: Add( Slice ScalarFunction ) AddGo( Slice func() float64 ) AddTo( Slice ) Average( ) Comp( int ) IsUniform( ) Region( int ) RemoveExtraTerms( ) Set( data.Vector ) SetRegion( int VectorFunction ) SetRegionFn( int func() [3]float64 )
J
Electrical current density (A/m2)
methods: Add( Slice ScalarFunction ) AddGo( Slice func() float64 ) AddTo( Slice ) Average( ) Comp( int ) IsUniform( ) Region( int ) RemoveExtraTerms( ) Set( data.Vector ) SetRegion( int VectorFunction ) SetRegionFn( int func() [3]float64 )
examples: [10] [11] [12] [13] [14] [15]
Index2Coord(int, int, int) data.Vector
Convert cell index to x,y,z coordinate in meter
methods: Add( data.Vector ) Cross( data.Vector ) Div( float64 ) Dot( data.Vector ) Len( ) MAdd( float64 data.Vector ) Mul( float64 ) Sub( data.Vector ) X( ) Y( ) Z( )
examples: [15]
LoadFile(string) Slice
Load a data file (ovf or dump)
methods: CPUAccess( ) Comp( int ) DevPtr( int ) Disable( ) Free( ) GPUAccess( ) Get( int int int int ) Host( ) HostCopy( ) Index( int int int ) IsNil( ) Len( ) MemType( ) Scalars( ) Set( int int int int float64 ) SetScalar( int int int float64 ) SetVector( int int int data.Vector ) Size( ) Tensors( ) Vectors( )
examples: [5]
NewSlice(int, int, int, int) Slice
Makes a 4D array of scalars with given ncomp,x,y,z size
methods: CPUAccess( ) Comp( int ) DevPtr( int ) Disable( ) Free( ) GPUAccess( ) Get( int int int int ) Host( ) HostCopy( ) Index( int int int ) IsNil( ) Len( ) MemType( ) Scalars( ) Set( int int int int float64 ) SetScalar( int int int float64 ) SetVector( int int int data.Vector ) Size( ) Tensors( ) Vectors( )
Mumax3 has built-in generation of MFM images from a 2D magnetization. The MFM tip lift can be freely chosen. By default the tip magnetization is modeled as a point monopole at the apex. This is sufficient for most situations. Nevertheless, it is also possible to model partially magnetized tips by setting MFMDipole to the magnetized portion of the tip, in meters. E.g., if only the first 20nm of the tip is (vertically) magnetized, set MFMDipole=20e-9.
MFM
MFM image
methods: Average( ) Region( int ) Set( Slice )
examples: [9]
MFMDipole
Height of vertically magnetized part of MFM tip
MFMLift
MFM lift height
examples: [9]
m // magnetization quantity
m.Comp(0) // x-component
m.Region(1) // magnetization in region 1 (0 elsewhere)
B_anis
Anisotropy field (T)
methods: AddTo( Slice ) Average( ) Comp( int ) Region( int ) Set( Slice )
B_demag
Magnetostatic field (T)
methods: Average( ) Comp( int ) Region( int ) Set( Slice )
B_eff
Effective field (T)
methods: Average( ) Comp( int ) Region( int ) Set( Slice )
B_exch
Exchange field (T)
methods: AddTo( Slice ) Average( ) Comp( int ) Region( int ) Set( Slice )
B_therm
Thermal field (T)
methods: AddTo( Slice )
dt
Time Step (s)
methods: Average( ) Get( )
E_anis
Anisotropy energy (uni+cubic) (J)
methods: Average( ) Get( )
E_demag
Magnetostatic energy (J)
methods: Average( ) Get( )
E_exch
Exchange energy (normal+DM) (J)
methods: Average( ) Get( )
E_therm
Thermal energy (J)
methods: Average( ) Get( )
E_total
Total energy (J)
methods: Average( ) Get( )
examples: [13]
E_Zeeman
Zeeman energy (J)
methods: Average( ) Get( )
Edens_anis
Anisotropy energy density (uni+cubic) (J/m3)
methods: AddTo( Slice ) Average( ) Region( int ) Set( Slice )
Edens_demag
Magnetostatic energy density (J/m3)
methods: AddTo( Slice ) Average( ) Region( int ) Set( Slice )
Edens_exch
Exchange energy density (normal+DM) (J/m3)
methods: AddTo( Slice ) Average( ) Region( int ) Set( Slice )
Edens_therm
Thermal energy density (J/m3)
methods: AddTo( Slice ) Average( ) Region( int ) Set( Slice )
Edens_total
Total energy density (J/m3)
methods: Average( ) Region( int ) Set( Slice )
Edens_Zeeman
Zeeman energy density (J/m3)
methods: AddTo( Slice ) Average( ) Region( int ) Set( Slice )
ExchCoupling
Average exchange coupling with neighbors (arb.)
methods: Average( ) Region( int ) Set( Slice )
examples: [12]
geom
Cell fill fraction (0..1)
methods: Average( ) Gpu( )
examples: [4] [6] [7] [8] [9] [11] [12] [14]
LastErr
Error of last step
methods: Average( ) Get( )
LLtorque
Landau-Lifshitz torque/γ0 (T)
methods: Average( ) Comp( int ) Region( int ) Set( Slice )
m_full
Unnormalized magnetization (A/m)
methods: Average( ) Comp( int ) Region( int ) Set( Slice )
MaxAngle
Maximum angle between neighboring spins (rad)
methods: Average( ) Get( )
maxTorque
Maximum torque/γ0, over all cells (T)
methods: Average( ) Get( )
NEval
Total number of torque evaluations
methods: Average( ) Get( )
PeakErr
Overall maxium error per step
methods: Average( ) Get( )
spinAngle
Angle between neighboring spins (rad)
methods: Average( ) Region( int ) Set( Slice )
STtorque
Spin-transfer torque/γ0 (T)
methods: AddTo( Slice ) Average( ) Comp( int ) Region( int ) Set( Slice )
torque
Total torque/γ0 (T)
methods: Average( ) Comp( int ) Region( int ) Set( Slice )
save(m) // save full magnetization
save(m.Comp(0)) // save only x-component
save(CropLayer(m, 13)) // save only layer 13
save(CropLayer(m.Comp(0), 13)) // save only x-component of layer 13
Or even:
mx := m.Comp(0)
mx13 := CropLayer(mx, 13)
save(mx13)
tableAdd(mx13)
Crop(Quantity, int, int, int, int, int, int) *cropped
Crops a quantity to cell ranges [x1,x2[, [y1,y2[, [z1,z2[
methods: Average( )
examples: [8]
CropLayer(Quantity, int) *cropped
Crops a quantity to a single layer
methods: Average( )
CropX(Quantity, int, int) *cropped
Crops a quantity to cell ranges [x1,x2[
methods: Average( )
CropY(Quantity, int, int) *cropped
Crops a quantity to cell ranges [y1,y2[
methods: Average( )
examples: [8]
CropZ(Quantity, int, int) *cropped
Crops a quantity to cell ranges [z1,z2[
methods: Average( )
TableAdd()
.
save(B_ext)
tableadd(B_ext)
tablesave()
Optionally, the output/averaging can be done over a single region:
save(m.Region(1))
TableAdd(m.Region(1))
User-defined variables can be added to the table with TableAddVar()
.
myField := 0.42
TableAddVar(myField, "B_extra", "T")
myField = ...
AutoSave(Quantity, float64)
Auto save space-dependent quantity every period (s).
examples: [1] [10] [11] [14] [15]
AutoSnapshot(Quantity, float64)
Auto save image of quantity every period (s).
FilenameFormat
printf formatting string for output filenames.
Fprintln(string, ...interface {})
Print to file
OutputFormat
Format for data files: OVF1_TEXT, OVF1_BINARY, OVF2_TEXT or OVF2_BINARY
OVF1_BINARY
OutputFormat = OVF1_BINARY sets binary OVF1 output
OVF1_TEXT
OutputFormat = OVF1_TEXT sets text OVF1 output
OVF2_BINARY
OutputFormat = OVF2_BINARY sets binary OVF2 output
OVF2_TEXT
OutputFormat = OVF2_TEXT sets text OVF2 output
Print(...interface {})
Print to standard output
examples: [2]
Save(Quantity)
Save space-dependent quantity once, with auto filename
examples: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
SaveAs(Quantity, string)
Save space-dependent with custom filename
Snapshot(Quantity)
Save image of quantity
SnapshotFormat
Image format for snapshots: jpg, png or gif.
sprint(...interface {}) string
Print all arguments to string with automatic formatting
sprintf(string, ...interface {}) string
Print to string with C-style formatting.
TableAdd(TableData)
Add quantity as a column to the data table.
TableAddVar(ScalarFunction, string, string)
Add user-defined variable + name + unit to data table.
TableAutoSave(float64)
Auto-save the data table every period (s). Zero disables save.
TablePrint(...interface {})
Print anyting in the data table
TableSave()
Save the data table right now (appends one line).
Run(time)
runs the simulation for a given time in seconds, using sensible error settings.
Run(1e-9)
More fine-grained control is provided by RunWhile(condition)
, which runs as long as an arbitrary condition is met. E.g.:
mx := m.comp(0)
RunWhile(mx.average() < 0) // search for switching field during reversal
Optionally, the solver accuracy may be fine-tuned. E.g.:
MaxDt = 1e-12
MinDt = 1e-15
MaxErr = 1e-6
Optionally, a different solver may be chosen (at any point) with SetSolver(int)
. Currently available solver types:
5
: RK45 (Dormand-Prince) solver (the default). An accurate solver, very fast for magnetization dynamics at the cost of some memory usage. 4
: Classical 4th-order Runge-Kutta method. Intended for simulations where a fixed, relatively large time step is desired.3
: RK23 (Bogacki-Shampine) solver. A robust and reasonably fast solver with low memory requirements. Typically outperforms RK45 when relaxing the magnetization with little dynamics, so it used internally by Relax()
. 2
: Adaptive Heun solver. Robust and uses very little memory but takes smaller time steps than the higher-order solvers. Also suited when a fixed, relatively small time step is desired. 1
: Euler solver (requires FixDt = ...
, ignores other settings). Only useful in exceptional situations or for debugging. SetSolver(2) // Heun
FixDt = 1e-15
Relax()
tries to evolve the magnetization as closely as possible to the minimum energy state. This function assumes all excitations have been turned off (temperature, electrical current, time-dependent magnetic fields). During relax precession is disabled and the time t
does not increase. There is no need to set high damping.
In general it is difficult to be sure the minimum energy state has been truly reached. Hence, relax may occasionally return after the energy has reached a local minimum, a saddle point, or a rather flat valley in the energy landscape.
Minimize()
is like Relax, but uses the conjugate gradient method to find the energy minimum. It is usually much faster than Relax, but is a bit less robust against divergence. E.g., a random starting configuration can be Relaxed, but may fail with Minimize. Minimize is very well suited for hysteresis calculations, where we are never far away from the ground state.
Minimize()
Use steepest conjugate gradient method to minimize the total energy
Relax()
Try to minimize the total energy
examples: [1] [2] [3] [9] [10] [11]
Run(float64)
Run the simulation for a time in seconds
examples: [1] [7] [10] [11] [12] [14] [15]
RunWhile(func() bool)
Run while condition function is true
Steps(int)
Run the simulation for a number of time steps
FixDt
Set a fixed time step, 0 disables fixed step
Headroom
Solver headroom
MaxDt
Maximum time step the solver can take (s)
MaxErr
Maximum error per step the solver can tolerate
MinDt
Minimum time step the solver can take (s)
MinimizerSamples
Number of max dM to collect for Minimize convergence check.
MinimizerStop
Stopping max dM for Minimize
examples: [3]
step
Total number of time steps taken
t
Total simulated time (s)
examples: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
SetSolver(int)
Set solver type. 1:Euler, 2:Heun
ext_centerwall(0)
ext_rmSurfaceCharge(0, -1, 1)
TableAdd(TotalShift)
will try to keep mx
(component 0, counting from 0) close to zero. If desired, one can override which "new" magnetization is inserted from the sides by setting ShiftMagL
and ShiftMagR
, though the default behaviour is usually OK.
Shift(int)
Shifts the simulation by +1/-1 cells along X
examples: [15]
ShiftGeom
Whether Shift() acts on geometry
ShiftM
Whether Shift() acts on magnetization
examples: [15]
ShiftMagL
Upon shift, insert this magnetization from the left
methods: Add( data.Vector ) Cross( data.Vector ) Div( float64 ) Dot( data.Vector ) Len( ) MAdd( float64 data.Vector ) Mul( float64 ) Sub( data.Vector ) X( ) Y( ) Z( )
ShiftMagR
Upon shift, insert this magnetization from the right
methods: Add( data.Vector ) Cross( data.Vector ) Div( float64 ) Dot( data.Vector ) Len( ) MAdd( float64 data.Vector ) Mul( float64 ) Sub( data.Vector ) X( ) Y( ) Z( )
examples: [15]
ShiftRegions
Whether Shift() acts on regions
TotalShift
Amount by which the simulation has been shifted (m).
ext_bubbledist
Bubble traveled distance (m)
methods: Average( ) Get( )
ext_bubblepos
Bubble core position (m)
methods: Average( ) Get( )
ext_bubblespeed
Bubble velocity (m/s)
methods: Average( ) Get( )
ext_centerWall(int)
centerWall(c) shifts m after each step to keep m_c close to zero
ext_corepos
Vortex core position (x,y) + polarization (z) (m)
methods: Average( ) Get( )
ext_dwpos
Position of the simulation window while following a domain wall (m)
methods: Average( ) Get( )
examples: [11]
ext_dwspeed
Speed of the simulation window while following a domain wall (m/s)
methods: Average( ) Get( )
ext_dwtilt
PMA domain wall tilt (rad)
methods: Average( ) Get( )
ext_EnableUnsafe()
Allow potentially unsafe features, at your own risk.
ext_makegrains(float64, int, int)
Voronoi tesselation (grain size, num regions)
ext_rmSurfaceCharge(int, float64, float64)
Compensate magnetic charges on the left and right sides of an in-plane magnetized wire. Arguments: region, mx on left and right side, resp.
examples: [11]
ext_ScaleExchange(int, int, float64)
Re-scales exchange coupling between two regions.
ext_topologicalcharge
2D topological charge
methods: Average( ) Get( )
ext_topologicalchargedensity
2D topological charge density m·(m/∂x ❌ ∂m/∂y) (1/m2)
methods: Average( ) Region( int ) Set( Slice )
EnableDemag
Enables/disables demag (default=true)
Expect(string, float64, float64, float64)
Used for automated tests: checks if a value is close enough to the expected value
ExpectV(string, data.Vector, data.Vector, float64)
Used for automated tests: checks if a vector is close enough to the expected value
abs(float64) float64
acos(float64) float64
acosh(float64) float64
asin(float64) float64
asinh(float64) float64
atan(float64) float64
atan2(float64, float64) float64
atanh(float64) float64
cbrt(float64) float64
ceil(float64) float64
cos(float64) float64
cosh(float64) float64
DemagAccuracy
Controls accuracy of demag kernel
DisableSlonczewskiTorque
Disables Slonczewski torque (default=false)
DisableZhangLiTorque
Disables Zhang-Li torque (default=false)
DoPrecess
Enables LL precession (default=true)
DotProduct(Quantity, Quantity) *dotProduct
Dot product of two vector quantities
methods: Average( )
DUMP
OutputFormat = DUMP sets text DUMP output
erf(float64) float64
erfc(float64) float64
Exit()
Exit from the program
exp(float64) float64
examples: [15]
exp2(float64) float64
expm1(float64) float64
false
floor(float64) float64
Flush()
Flush all pending output to disk.
gamma(float64) float64
GammaLL
Gyromagnetic ratio in rad/Ts
heaviside(float64) float64
hypot(float64, float64) float64
ilogb(float64) int
examples: [2]
inf
isInf(float64, int) bool
isNaN(float64) bool
j0(float64) float64
j1(float64) float64
jn(int, float64) float64
ldexp(float64, int) float64
log(float64) float64
log10(float64) float64
log1p(float64) float64
log2(float64) float64
logb(float64) float64
examples: [2]
max(float64, float64) float64
min(float64, float64) float64
mod(float64, float64) float64
Mu0
Permittivity of vaccum (Tm/A)
examples: [2]
NewScalarMask(int, int, int) Slice
Makes a 3D array of scalars
methods: CPUAccess( ) Comp( int ) DevPtr( int ) Disable( ) Free( ) GPUAccess( ) Get( int int int int ) Host( ) HostCopy( ) Index( int int int ) IsNil( ) Len( ) MemType( ) Scalars( ) Set( int int int int float64 ) SetScalar( int int int float64 ) SetVector( int int int data.Vector ) Size( ) Tensors( ) Vectors( )
NewVectorMask(int, int, int) Slice
Makes a 3D array of vectors
methods: CPUAccess( ) Comp( int ) DevPtr( int ) Disable( ) Free( ) GPUAccess( ) Get( int int int int ) Host( ) HostCopy( ) Index( int int int ) IsNil( ) Len( ) MemType( ) Scalars( ) Set( int int int int float64 ) SetScalar( int int int float64 ) SetVector( int int int data.Vector ) Size( ) Tensors( ) Vectors( )
examples: [15]
norm(float64) float64
Standard normal distribution
now() time.Time
Returns the current time
methods: Add( time.Duration ) AddDate( int int int ) After( time.Time ) Before( time.Time ) Clock( ) Date( ) Day( ) Equal( time.Time ) Format( string ) GobEncode( ) Hour( ) ISOWeek( ) In( *time.Location ) IsZero( ) Local( ) Location( ) MarshalBinary( ) MarshalJSON( ) MarshalText( ) Minute( ) Month( ) Nanosecond( ) Round( time.Duration ) Second( ) Sub( time.Time ) Truncate( time.Duration ) UTC( ) Unix( ) UnixNano( ) Weekday( ) Year( ) YearDay( ) Zone( )
pi
examples: [4] [5] [6] [11] [13] [14] [15]
pow(float64, float64) float64
pow10(int) float64
rand() float64
Random number between 0 and 1
randExp() float64
Exponentially distributed random number between 0 and +inf, mean=1
randInt(int) int
Random non-negative integer
randNorm() float64
Standard normal random number
examples: [12]
randSeed(int)
Sets the random number seed
remainder(float64, float64) float64
Sign(float64) float64
Signum function
sin(float64) float64
examples: [5] [6] [13] [14] [15]
sinc(float64) float64
since(time.Time) time.Duration
Returns the time elapsed since argument
methods: Hours( ) Minutes( ) Nanoseconds( ) Seconds( )
sinh(float64) float64
sqrt(float64) float64
examples: [2]
tan(float64) float64
tanh(float64) float64
ThermSeed(int)
Set a random seed for thermal noise
true
trunc(float64) float64
Vector(float64, float64, float64) data.Vector
Constructs a vector with given components
methods: Add( data.Vector ) Cross( data.Vector ) Div( float64 ) Dot( data.Vector ) Len( ) MAdd( float64 data.Vector ) Mul( float64 ) Sub( data.Vector ) X( ) Y( ) Z( )
examples: [1] [3] [5] [7] [10] [11] [12] [14] [15]
y0(float64) float64
y1(float64) float64
yn(int, float64) float64