The Elk Code
 
Loading...
Searching...
No Matches
readdmatmt.f90
Go to the documentation of this file.
1
2! Copyright (C) 2008 F. Bultmark, F. Cricchio and L. Nordstrom.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6subroutine readdmatmt
7use modmain
8use moddftu
9implicit none
10! local variables
11integer is,ia,ias,ispn,jspn,idu
12integer is_,ia_,ispn_,jspn_
13integer l,ll,m1,m2,lm1,lm2
14integer l_,m1_,m2_
15real(8) a,b
16! zero the density matrix
17dmatmt(:,:,:,:,:)=0.d0
18! read density matrix from DMATMT.OUT
19open(50,file='DMATMT'//trim(filext),form='FORMATTED')
20do idu=1,ndftu
21 is=isldu(1,idu)
22 l=isldu(2,idu)
23 ll=l*(l+1)+1
24 do ia=1,natoms(is)
25 ias=idxas(ia,is)
26 read(50,*)
27 read(50,*)
28 read(50,*) is_,ia_,l_
29 if ((is /= is_).or.(ia /= ia_).or.(l /= l_)) then
30 write(*,*)
31 write(*,'("Error(readdmatmt): differing is, ia or l")')
32 write(*,'(" current : ",3I4)') is,ia,l
33 write(*,'(" DMATMT.OUT : ",3I4)') is_,ia_,l_
34 write(*,*)
35 stop
36 end if
37 do ispn=1,nspinor
38 do jspn=1,nspinor
39 read(50,*)
40 read(50,*) ispn_,jspn_
41 if ((ispn /= ispn_).or.(jspn /= jspn_)) then
42 write(*,*)
43 write(*,'("Error(readdmatmt): differing ispn or jspn")')
44 write(*,'(" current : ",2I4)') ispn,jspn
45 write(*,'(" DMATMT.OUT : ",2I4)') ispn_,jspn_
46 write(*,*)
47 stop
48 end if
49 do m1=-l,l
50 lm1=ll+m1
51 do m2=-l,l
52 lm2=ll+m2
53 read(50,*) m1_,m2_,a,b
54 if ((m1 /= m1_).or.(m2 /= m2_)) then
55 write(*,*)
56 write(*,'("Error(readdmatmt): differing m1 or m2")')
57 write(*,'(" current : ",2I6)') m1,m2
58 write(*,'(" DMATMT.OUT : ",2I6)') m1_,m2_
59 write(*,*)
60 stop
61 end if
62 dmatmt(lm1,ispn,lm2,jspn,ias)=cmplx(a,b,8)
63 end do
64 end do
65 end do
66 end do
67 end do
68end do
69close(50)
70end subroutine
71
integer ndftu
Definition moddftu.f90:38
integer, dimension(2, maxdftu) isldu
Definition moddftu.f90:40
complex(8), dimension(:,:,:,:,:), allocatable dmatmt
Definition moddftu.f90:16
integer nspinor
Definition modmain.f90:267
integer, dimension(maxspecies) natoms
Definition modmain.f90:36
character(256) filext
Definition modmain.f90:1300
integer, dimension(maxatoms, maxspecies) idxas
Definition modmain.f90:42
subroutine readdmatmt
Definition readdmatmt.f90:7