The Elk Code
momentu.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2018 T. Mueller, 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 momentu
7 use modmain
8 use modulr
9 use modtest
10 implicit none
11 ! local variables
12 integer idm,is,ias
13 integer nrc,nrci,ifq,ir
14 real(8) t1
15 ! automatic arrays
16 real(8) rfft(nqpt)
17 complex(8) zfft(nfqrz)
18 ! external functions
19 complex(8), external :: zfmtint
20 if (.not.spinpol) return
21 ! calculate muffin-tin moments
22 mommttot(:)=0.d0
23 do idm=1,ndmag
24  do ias=1,natmtot
25  is=idxis(ias)
26  nrc=nrcmt(is)
27  nrci=nrcmti(is)
28  do ifq=1,nfqrz
29  zfft(ifq)=zfmtint(nrc,nrci,wr2cmt(:,is),magqmt(:,ias,idm,ifq))
30  end do
31  mommt(idm,ias)=zfft(1)%re
32  mommttot(idm)=mommttot(idm)+mommt(idm,ias)
33  call rzfftifc(3,ngridq,1,rfft,zfft)
34  mommtru(idm,ias,1:nqpt)=rfft(1:nqpt)
35 ! store the muffin-tin moments in Q-space
36  mommtqu(idm,ias,1:nfqrz)=zfft(1:nfqrz)
37  end do
38 end do
39 ! calculate the interstitial and total moments
40 t1=omega/ngtc
41 do idm=1,ndmag
42  do ifq=1,nfqrz
43  zfft(ifq)=t1*sum(magqir(1:ngtc,idm,ifq)*cfrc(1:ngtc))
44  end do
45  momir(idm)=zfft(1)%re
46  momtot(idm)=mommttot(idm)+momir(idm)
47  call rzfftifc(3,ngridq,1,rfft,zfft)
48  do ir=1,nqpt
49  momirru(idm,ir)=rfft(ir)
50  momtotru(idm,ir)=sum(mommtru(idm,1:natmtot,ir))+momirru(idm,ir)
51  end do
52 ! store the interstitial moments in Q-space
53  momirqu(idm,1:nfqrz)=zfft(1:nfqrz)
54 ! store the total moments in Q-space
55  do ifq=1,nfqrz
56  momtotqu(idm,ifq)=sum(mommtqu(idm,1:natmtot,ifq))+momirqu(idm,ifq)
57  end do
58 end do
59 ! total moment magnitude
60 momtotm=merge(norm2(momtot(1:3)),abs(momtot(1)),ncmag)
61 ! write the muffin-tin moments to test file
62 call writetest(770,'ULR total moments',nv=ndmag*nqpt,tol=2.d-2,rva=momtotru)
63 end subroutine
64 
subroutine writetest(id, descr, nv, iv, iva, tol, rv, rva, zv, zva)
Definition: modtest.f90:16
real(8), dimension(:,:), allocatable mommt
Definition: modmain.f90:747
real(8), dimension(3) momtot
Definition: modmain.f90:741
complex(8), dimension(:,:,:), allocatable mommtqu
Definition: modulr.f90:63
integer ngtc
Definition: modmain.f90:395
logical spinpol
Definition: modmain.f90:230
integer ndmag
Definition: modmain.f90:240
real(8) momtotm
Definition: modmain.f90:743
real(8), dimension(3) mommttot
Definition: modmain.f90:749
real(8) omega
Definition: modmain.f90:20
subroutine momentu
Definition: momentu.f90:7
complex(8), dimension(:,:,:,:), allocatable magqmt
Definition: modulr.f90:60
complex(8), dimension(:,:,:), allocatable magqir
Definition: modulr.f90:60
real(8), dimension(:,:), allocatable momirru
Definition: modulr.f90:57
real(8), dimension(3) momir
Definition: modmain.f90:745
integer, dimension(3) ngridq
Definition: modmain.f90:518
real(8), dimension(:,:), allocatable wr2cmt
Definition: modmain.f90:191
integer, dimension(maxatoms *maxspecies) idxis
Definition: modmain.f90:44
real(8), dimension(:,:,:), allocatable mommtru
Definition: modulr.f90:57
complex(8), dimension(:,:), allocatable momirqu
Definition: modulr.f90:63
subroutine rzfftifc(nd, n, sgn, r, z)
integer natmtot
Definition: modmain.f90:40
real(8), dimension(:), allocatable cfrc
Definition: modmain.f90:441
integer, dimension(maxspecies) nrcmt
Definition: modmain.f90:175
integer, dimension(maxspecies) nrcmti
Definition: modmain.f90:213
Definition: modulr.f90:6
logical ncmag
Definition: modmain.f90:242
complex(8), dimension(:,:), allocatable momtotqu
Definition: modulr.f90:63
real(8), dimension(:,:), allocatable momtotru
Definition: modulr.f90:57