The Elk Code
dmatls.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2019 J. K. Dewhurst, S. Sharma and E. K. U. Gross.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 subroutine dmatls(dmat,xl,xs)
7 use modmain
8 implicit none
9 ! arguments
10 complex(8), intent(in) :: dmat(lmmaxo,nspinor,lmmaxo,nspinor)
11 real(8), intent(out) :: xl(3),xs(3)
12 ! local variables
13 integer ispn,lm
14 ! automatic arrays
15 complex(8) zlflm(lmmaxo,3)
16 ! compute tr(LD)
17 xl(:)=0.d0
18 do ispn=1,nspinor
19  do lm=1,lmmaxo
20  call lopzflm(lmaxo,dmat(:,ispn,lm,ispn),lmmaxo,zlflm)
21  xl(:)=xl(:)+dble(zlflm(lm,:))
22  end do
23 end do
24 ! compute tr(sigma D)
25 xs(:)=0.d0
26 if (spinpol) then
27  do lm=1,lmmaxo
28  xs(1)=xs(1)+dble(dmat(lm,2,lm,1)+dmat(lm,1,lm,2))
29  xs(2)=xs(2)+dble(-zi*dmat(lm,2,lm,1)+zi*dmat(lm,1,lm,2))
30  xs(3)=xs(3)+dble(dmat(lm,1,lm,1)-dmat(lm,2,lm,2))
31  end do
32 ! S = 1/2 sigma
33  xs(:)=0.5d0*xs(:)
34 end if
35 end subroutine
36 
logical spinpol
Definition: modmain.f90:228
subroutine dmatls(dmat, xl, xs)
Definition: dmatls.f90:7
integer lmaxo
Definition: modmain.f90:201
complex(8), parameter zi
Definition: modmain.f90:1240
pure subroutine lopzflm(lmax, zflm, ld, zlflm)
Definition: lopzflm.f90:10