Hi,
If you have a non-uniform J, then you will indeed need to make some tweaks, but there is an easier way. In that example, they used
p := Constvector(0,-1,0)
However, recall back on slide 41, that p = sign(alphaH) j cross n. So instead you can do something like
J=vector(-2e11,0,0)
nhat:= Constvector (0,0,-1)
p:= Cross(J,nhat)
aj := Const(1*(hbar/2.*alphaH/e/d/ms))
Basically the changes are: define p directly based on J, instead of being a constvector. There is a factor of J_SOT in aj the prefactor, so that needs to be set to 1 to avoid double counting the magnitude of J, as we are now setting J directly. If you replace these in the example workshop script session4_2a (and explicitly disable Zhangli/Slonczewski, just to compare to the example which did not have STT due to how things were defined), it should give identical results as the example.
For your script, you will want to adjust nhat and sign(alphaH) for your situation, and since you want STT, leave the relevant STT term(s) enabled. For the nonuniform J as in your case, instead of setting J=vector(-2e11,0,0) directly, you can do
J.Add("p4_5v.ovf",1)
(You can skip the newVectorMask part, the result of loadfile is already a slice, the same as NewVectormask, so it is redundant).
Cheers,
Josh L.