The Elk Code
writetdlsj.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 writetdlsj
7 use modmain
8 use modtddft
9 use modmpi
10 implicit none
11 ! local variables
12 integer is,ia,ias
13 real(8) xl(3),xs(3)
14 character(256) fext
15 ! allocatable arrays
16 complex(8), allocatable :: dmat(:,:,:,:,:)
17 allocate(dmat(lmmaxo,nspinor,lmmaxo,nspinor,natmtot))
18 ! generate the density matrix in each muffin-tin
19 call gendmat(.false.,.false.,0,lmaxo,lmmaxo,dmat)
20 if (mp_mpi) then
21  write(fext,'("_TS",I8.8,".OUT")') itimes
22  open(50,file='LSJ'//trim(fext),form='FORMATTED')
23  do is=1,nspecies
24  write(50,*)
25  write(50,'("Species : ",I4," (",A,")")') is,trim(spsymb(is))
26  do ia=1,natoms(is)
27  ias=idxas(ia,is)
28 ! calculate the expectation value of L and S
29  call dmatls(dmat(:,:,:,:,ias),xl,xs)
30  write(50,'(" atom : ",I4)') ia
31  write(50,'(" L : ",3G18.10)') xl(:)
32  write(50,'(" S : ",3G18.10)') xs(:)
33  write(50,'(" J : ",3G18.10)') xl(:)+xs(:)
34  end do
35  end do
36  close(50)
37 end if
38 end subroutine
39 
logical mp_mpi
Definition: modmpi.f90:17
integer lmmaxo
Definition: modmain.f90:203
integer, dimension(maxatoms, maxspecies) idxas
Definition: modmain.f90:42
subroutine dmatls(dmat, xl, xs)
Definition: dmatls.f90:7
integer lmaxo
Definition: modmain.f90:201
subroutine gendmat(tspndg, tlmdg, lmin, lmax, ld, dmat)
Definition: gendmat.f90:7
integer nspinor
Definition: modmain.f90:267
integer, dimension(maxspecies) natoms
Definition: modmain.f90:36
subroutine writetdlsj
Definition: writetdlsj.f90:7
Definition: modmpi.f90:6
integer itimes
Definition: modtddft.f90:46
integer nspecies
Definition: modmain.f90:34
integer natmtot
Definition: modmain.f90:40
character(64), dimension(maxspecies) spsymb
Definition: modmain.f90:78