# Spin dependent calculations

## General description

This section contains information on extracting the XMCD signal and a description of the SPXAS technique, as well as example input files.

Spin-dependent calculations have been automated in FEFF9. All spin-dependent calculations require that the SPIN card be present in 'feff.inp’ (see the SPIN card for additional details on its use). The method one uses to extract the signal depends on the value of the paramter nspx, which is found in the header file ‘dim.h’.

In order for the final result to be contained in ‘xmu.dat’, feff must be compiled with nspx = 2 to take care of both the spin-up and spin-down calculations. This will also add the contribution from spin-flip processes (which we find typically very small), but may require up to 4 times the memory and 8 times the execution time for the XANES region. Thus, in general, nspx = 2 will not always be feasible.

With nspx=1, the code must be run twice, once for spin-up and once for spin-down. An additional simple program ‘spin.f’ is useful for taking care of the different normalizations and giving the final results in XMCD or SPXAS. ‘spin.f’ is printed below, and may also be found on the FEFF website.

In the monolithic source code, all instances of nspx = 1 must be changed to nspx = 2 in order to automate the calculations. In the source tree, ‘dim.h’ is located in ‘src/HEADERS/’, and nspx can be changed there. Please contact the authors if you need help modifying the source code.

The same paths should be used for spin-up and spin-down calculations, otherwise the difference between two calculations may be due to different paths used. Typically the paths list in ‘paths.dat’ should be generated by running the usual EXAFS calculations and comparing with experiment (to make sure that all important paths are included). Then, when running with SPIN, turn off the pathfinder module using the CONTROL card.

‘spin.f’:

      implicit double precision (a-h,o-z)
c     This program read two xmu.dat files for spin -up and -down,
c     calculated with Feff8.20 for the SAME paths list.
c     spin-up file is fort.1, spin-down file is fort.2
c     Both have to be edited: All lines should be deleted except
c      1) line: xsedge+100, used to normalize mu 1.3953E-04
c         leave only on this line: 1.3953E-04
c      2) 6-column data lines
c     The output will be written in fort.3 in 6 columns
c     E+shift1 E(edge)+shift2 xk cmd_total cmd_background cmd_fs
c     where total = atomic background + fine structure
c     There are 3 possibilities
c     case 1) you want XMCD signal and used SPIN \pm 1
c     case 2) you want XMCD signal and used SPIN \pm 2, in order
c       to use non-relativistic formula for XMCD
c       factor li/2j+1 which was not convenient to do in a program
c     case 3) you want SPXAFS and used SPIN \pm 2
c     ENTER your case here (icase is positive integer only)
icase = 2
c     if icase=2 ENTER factor=(-1)**(L+1/2-J) * L/(2*J+1)
c     where L,J are for your edge (ex. for L3 L=1 J=3/2, for L2 L=1 J=1/2)
c     for L3
factor = 0.25
c     for L2
c     factor = -0.5
c     ENTER the energy shift you want for columns 1 and 2 in xmu.dat

shift1 = 0
shift2 = 0

c     everything below is automated further
xnorm = 0.5 *(ap+am)
3     read(1,*,end=10) x1, x2, ek, y1, y2, y3
read(2,*,end=10) x1, x2, ek, z1, z2, z3
if (icase.eq.1) then
c           no xafs in this case:xfs - atomic part of XMCD
t1 = (y1*ap + z1*am)/xnorm
t2 = (y2*ap + z2*am)/xnorm
t3 = (y3*ap + z3*am) /xnorm

elseif (icase.eq.2) then
t1 = (y1*ap - z1*am)*factor /xnorm
t2 = (y2*ap - z2*am)*factor /xnorm
t3 = (y3*ap - z3*am)*factor /xnorm

elseif (icase.eq.3) then
c           factor=0.5 always for SPXAFS
t1 = (y1*ap - z1*am)/2.0/xnorm
t2 = (y2*ap - z2*am)/2.0/xnorm
t3 = (y3*ap - z3*am)/2.0/xnorm
c           you may want average total XAS as output in last column
c           t3 = (y1*ap + z1*am)/2.0/xnorm
endif
x1 =x1 + shift1
x2 =x2 + shift2
write(3,5) x1, x2, ek, t1, t2, t3
5     format (6e13.5)
goto 3
10  continue
stop
end


### Calculation Strategies and Examples

Spin dependent calculations

1. General description
2. XMCD
3. SPXAS