The Elk Code
writetdtm3.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2022 Leon Kerber, J. K. Dewhurst and S. Sharma.
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 writetdtm3
7 use modmain
8 use modtddft
9 use moddftu
10 implicit none
11 ! local variables
12 integer is,ia,ias,idu
13 integer l,p,k,r,t,i
14 real(8) t0
15 character(256) fname
16 ! automatic arrays
17 real(8) wkpr(-lmmaxdm:lmmaxdm)
18 ! loop over DFT+U entries
19 i=0
20 do idu=1,ndftu
21  is=isldu(1,idu)
22  l=isldu(2,idu)
23 ! scale factor for conventional normalisation
24  t0=sqrt(dble((2*l+1)*2))
25  do ia=1,natoms(is)
26  ias=idxas(ia,is)
27  do k=0,2*l
28  do p=0,1
29  do r=abs(k-p),k+p
30  i=i+1
31 ! decompose density matrix in 3-index tensor moment components
32  call dmtotm3(l,k,p,r,lmmaxdm,dmatmt(:,:,:,:,ias),wkpr)
33 ! construct the filename
34  write(fname,'("TMTD_S",I2.2,"_A",I3.3,"_L",I1,"_K",I1,"_P",I1,&
35  &"_R",I1,".OUT")') is,ia,l,k,p,r
36  if (itimes <= 1) then
37  open(50,file=trim(fname),form='FORMATTED')
38  else
39  open(50,file=trim(fname),form='FORMATTED',position='APPEND')
40  end if
41  write(50,'(20G18.10)') times(itimes),(t0*(wkpr(t)-wkpr0(t,i)),t=-r,r)
42  close(50)
43  end do
44  end do
45  end do
46  end do
47 end do
48 end subroutine
49 
integer, dimension(maxatoms, maxspecies) idxas
Definition: modmain.f90:42
complex(8), dimension(:,:,:,:,:), allocatable dmatmt
Definition: moddftu.f90:16
integer, dimension(2, maxdftu) isldu
Definition: moddftu.f90:40
integer ndftu
Definition: moddftu.f90:38
subroutine dmtotm3(l, k, p, r, ld, dm, wkpr)
Definition: dmtotm3.f90:10
integer, dimension(maxspecies) natoms
Definition: modmain.f90:36
real(8), dimension(:), allocatable times
Definition: modtddft.f90:48
integer itimes
Definition: modtddft.f90:46
real(8), dimension(:,:), allocatable wkpr0
Definition: moddftu.f90:86
subroutine writetdtm3
Definition: writetdtm3.f90:7