The Xf_STT class was created to enable simulation of the injection of multiple spin currents into a ferromagnet in OOMMF.

The spin torque equation derived by Slonczewski [1] and modified by Xiao [2] is written as (as implemented in OOMMF):

\frac{\partial\textbf{m}}{\partial t} = -|\gamma|\textbf{m}\times\textbf{H}_\text{EFF}+\alpha\textbf{m}\times\frac{\partial\textbf{m}}{\partial t}+\textbf{m}\times\textbf{STT}
\textbf{m}\times\textbf{STT} = \left|\gamma\right|\beta \left( \epsilon \left( \textbf{m}\times \textbf{m}_{p} \times \textbf{m} \right) - \epsilon'\left(\textbf{m}\times\textbf{m}_{p}\right) \right)
\textbf{STT} = \left|\gamma\right|\beta \left( \epsilon \left( \textbf{m}_{p} \times \textbf{m} \right) - \epsilon'\textbf{m}_{p} \right)
\textbf{H}_\text{STT} = \beta \left( \epsilon \left( \textbf{m} \times \textbf{m}_{p} \right) + \epsilon'\textbf{m}_{p} \right)

According to the OOMMF user guide:

\textbf{m}=\text{reduced magnetization,} \frac{\textbf{M}}{M_{sat}}
\gamma=\text{Gilbert gyromagnetic ratio}
\textbf{m}_{p}=\text{(unit) electron polarization direction}

\gamma has a default value of -2.211\times{}10^{5}~\text{m/A}\cdot\text{s}. In the definition of \beta, \hbar is the reduced Planck’s constant, e is the electronic charge in C, J is the current density exerting spin-torque in \text{A/m}^{2}, t is the thickness of the free layer in meters in the direction which the current density is flowing, and M_{sat} is the saturation magnetization in \text{A/m}. Note that \beta may be rewritten as,


where I is the current flowing homogeneously into the magnetic cell in A, and Vol is the volume of the magnetic cell in \text{m}^{3}.

\epsilon and \epsilon' gives the in-plane and out-of-plane spin-torque terms, respectively. As implemented in OOMMF,

q_{\pm}=P_{fixed}\Lambda_{fixed}^2\sqrt{\frac{\Lambda_{free}^2+1}{\Lambda_{fixed}^2+1}}\pm P_{free}\Lambda_{free}^2\sqrt{\frac{\Lambda_{fixed}^2-1}{\Lambda_{free}^2-1}}
A_{\pm}=\sqrt{\left(\Lambda_{fixed}^2\pm 1\right)\left(\Lambda_{free}^2\pm 1\right)}

In the case where P_{fixed}=P_{free} and \Lambda_{fixed}=\Lambda_{free}, \epsilon reduces to


The Specify block for the Xf_STT class has the form

\text{Specify Xf\_STT:}\textit{name}~\{

The spin-transfer torque term does not actually change the energy in this implementation in OOMMF, and its implementation as a derivation from Oxs_Energy class is technically illegal. However, the spin-transfer torque term as an equivalent H-field in OOMMF using the Oxs_Energy class gives the flexibility to model the injection of multiple spin currents into one region in the ferromagnet.

The default values for P and Lambda are 0.4 and 2, respectively. If preferred, values for the fixed and free layers may be instead specified separately, through P_fixed, P_free, Lambda_fixed, and Lambda_free. Otherwise P_fixed = P_free = P and
Lambda_fixed = Lambda_free = Lambda. Lambda must be larger than or equal to 1; set Lambda=1 to remove the dependence of \epsilon on \textbf{m}\cdot\textbf{m}_{p}. If you want non-zero \epsilon', it is set directly as eps_prime.

Current density J and unit polarization direction mp are required. The units on J are \text{A/m}^{2}. Positive J produces torque that tends to align \textbf{m} towards \textbf{m}_p.

Simulation of domain-wall dynamics under current-induced spin-torque is enabled by setting propogate_mp to 1. The setting propogate_mp is 0 (disabled) by default. When propogate_mp is enabled, mp is actually \Delta_{x}\times\frac{\partial\textbf{m}}{\partial x} , where x is the flow direction and \Delta_{x} is the cell dimension in that direction. The flow direction may be set by setting J_direction as one of six options:
-z, +z, -y, +y, -x, +x. The default is -z. The direction changes the mp used to calculate the spin torque at each cell site.

Parameters J, mp, P, Lambda, and eps_prime may all be varied pointwise (by specifying them as Oxs_ScalarField objects), but are fixed with respect to time. However, J can be multiplied by a time varying “profile,” to model current rise times, pulses, etc. Use the J_profile and J_profile_args options to enable this feature. The Jprofile_script should be a Tcl script that returns a single scalar. Jprofile_script_args should be a subset of {stage stage_time total_time }, to specify arguments appended to Jprofile_script on each time step. Default is the entire set, in the order as listed.

The Xf_STT module provides the scalar output “average J,” and the vector field outputs “Field” (which is |\gamma|\beta\left[\epsilon\left(\textbf{m}_{p}\times\textbf{m}\right)-\epsilon'\textbf{m}_{p}\right]) and “J*mp.”

10 comments on “Xf_STT
  1. Xiangjun Xing says:

    Dear Xuanyao,
    What is the difference between Xf_STT and Oxs_SpinXferEvolve? It seems that the former ties together the functions of the latter and the Anv_SpinTEvolve evolver.

    Xiangjun, Cheers>


    • xfong says:

      Xf_STT allows you to to include the effect of spin-transfer torque into any evolver class you want, since Xf_STT returns spin-transfer torque as an Oxs_Energy class. This allows you to simulate structures in which spin current may be injected into the same region from several different interfaces, each with a polarization factor and lambda.


  2. 李思民 says:

    Dear Xuanyao:
    I am a student in Beihang University, very grateful for your Xf_STT extension module in my simulation, it tackled an important issue in it. However, sometimes errors occured in the module. The error message goes like
    Unrecognized error thrown from inside “Oxs_Run” (Loop)
    can’t read “problem”: no such variable
    I recognized the problem after I added Xf_STT in my simulation.
    However, this can be solved by reloading the problems and sometimes it works, but sometimes it don’t. So each time I have to reload the problem many times to get in. The simulation is successful but I wonder if there’re any ways to kill the problem and are there any hidden problems in it.
    Thanks for your help!
    Yours, Simin Li


    • Dear Simin,
      If you can share your simulation file, it will make it easier for me to figure out what bugs there are in the code. Please email to kelvin.xy.fong@nus.edu.sg
      Kelvin FONG


      • Wen Zhao says:

        Dear Xuanyao,
        I’m a student from China, who has been doing micromagnetic simulation projects based on Oommf. First of all, thanks so much for providing us with such a powerful extension module.
        I’m writing to seek for assistance about this module, since I encountered the similar problem. The error message goes like “Unrecognized error thrown from inside “Oxs_Run” (Loop)”. Each time I have to reload the problem many times to get in. I’m not sure if there are any hidden problems here.
        I would appreciate it if you could give me some support and advice! Looking forward to your reply!
        Best regards,


      • Hi Wen Zhao,

        I recommend that you try using the 1.2a4 version of OOMMF with the module first. If the problems are still there, there is probably a compatibility issue with the module.

        Kelvin FONG


  3. 李思民 says:

    Dear Xuanyao:
    Thank you very much for your extension module and I’m currently working to get my results published. Do you require quoting any specific papers if I used your extension module in my simulation?


  4. Mark255 says:

    Dear Xuanyao,

    If I do not consider the fixed layer in my simulations, the polarization of the current is fixed by P and in that case it is not necessary to define P_free and P_fixed?



  5. Marcelo says:

    It is possible through this evolver to implement the case of non-adiabatic spin-transfer as the case of Anv_SpinTEvolve?.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Recent Posts
Recent Comments
%d bloggers like this: