# MIF 2.1
# MIF Example File: spinvalve-af.mif
# Description: Spin valve example, with anti-ferromagnetic exchange
#  coupling between the layers.
#
set pi [expr {4*atan(1.0)}]
set mu0 [expr {4*$pi*1e-7}]

Specify Oxs_MultiAtlas:atlas {
    atlas { Oxs_BoxAtlas {
	name top
	xrange {0 400e-9}
	yrange {0 200e-9}
	zrange {6e-9 9e-9}
    } }
    atlas { Oxs_BoxAtlas {
        name spacer
        xrange {0 400e-9}
        yrange {0 200e-9}
        zrange {3e-9 6e-9}
    } }
    atlas { Oxs_BoxAtlas {
        name bottom
        xrange {0 400e-9}
        yrange {0 200e-9}
        zrange {0 3e-9}
    } }
}

Specify Oxs_RectangularMesh:mesh {
  cellsize {5e-9 5e-9 3e-9}
  atlas :atlas
}

Specify Oxs_Exchange6Ngbr {
  atlas :atlas
  default_A 30e-12
  A  {
    spacer spacer 0
    spacer top 0
    spacer bottom 0
  }
}

# Add 50 mT (approx. 40 kA/m) biasing field to bottom layer.
Specify Oxs_FixedZeeman:Bias [subst {
  multiplier [expr {0.001/$mu0}]
  field { Oxs_AtlasVectorField {
    atlas :atlas
    default_value {0. 0. 0.}
    values {
	bottom  {50 0. 0.}
    }
  }}
}]

# Add antiferromagnetic exchange coupling across top-bottom layers.  The
# sign and strength of the bilinear coupling is determined by the value
# of "sigma".  Uncomment sigma2 to enable biquadratic coupling.
Specify Oxs_LinearScalarField:zheight {
 vector {0 0 1}
 norm   1.0
}
Specify Oxs_TwoSurfaceExchange:AF {
 sigma -1e-4
 comment {sigma2 -1e-4}
 surface1 {
         atlas  :atlas
        region  bottom
   scalarfield  :zheight
   scalarvalue  3e-9
    scalarside  -
 }
 surface2 {
         atlas  :atlas
        region  top
   scalarfield  :zheight
   scalarvalue  6e-9
    scalarside  +
 }
}

# Stepped applied field
Specify Oxs_UZeeman [subst {
  multiplier [expr {0.001/$mu0}]
  Hrange {
     {    0  0  0   500  5  0   25 }
     {  500  5  0  -500 -5  0   25 }
     { -500 -5  0   500  5  0   25 }
  }
}]

Specify Oxs_Demag {}

Specify Oxs_RungeKuttaEvolve:evolve {
  alpha 0.5
}

Specify Oxs_TimeDriver {
 basename spinvalve-af
 evolver :evolve
 comment {1 deg/ns = 17453293 rad/sec; If Ms=8.6e5, and lambda is small,
         then mxh=1e-6 translates into dm/dt = 2e5 rad/sec = 0.01 deg/ns}
 stopping_dm_dt .01
 mesh :mesh
 Ms  { Oxs_AtlasScalarField {
     atlas :atlas
     default_value 0
     values {
        top 1400e3
        bottom 1400e3
     }
 }}
 m0 {10 1 0}
}
