The Elk Code
mossbauer.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: mossbauer
8 ! !INTERFACE:
9 subroutine mossbauer
10 ! !USES:
11 use modmain
12 use modmpi
13 use modtest
14 ! !DESCRIPTION:
15 ! Computes the contact charge density and magnetic hyperfine field for each
16 ! atom and outputs the data to the file {\tt MOSSBAUER.OUT}.
17 ! See S. Bl\"{u}gel, H. Akai, R. Zeller, and P. H. Dederichs,
18 ! {\it Phys. Rev. B} {\bf 35}, 3271 (1987).
19 !
20 ! !REVISION HISTORY:
21 ! Created May 2004 (JKD)
22 ! Contact hyperfine field evaluated at the nuclear radius rather than averaged
23 ! over the Thomson sphere, June 2019 (JKD)
24 ! Added spin and orbital dipole terms, July 2019 (JKD)
25 !EOP
26 !BOC
27 implicit none
28 ! local variables
29 integer idm,is,ia,ias
30 integer nr,nri,nrn,nrt
31 real(8) r0,rn,rna,rt,rta
32 real(8) mn(3),mt(3),bn(3),bt(3)
33 real(8) cb,t1
34 ! allocatable arrays
35 real(8), allocatable :: fr(:)
36 ! spin dipole field prefactor
37 cb=gfacte/(4.d0*solsc)
38 ! initialise universal variables
39 call init0
40 call init1
41 ! read density and potentials from file
42 call readstate
43 ! generate the core wavefunctions and densities
44 call gencore
45 ! find the new linearisation energies
46 call linengy
47 ! generate the APW and local-orbital radial functions and integrals
48 call genapwlofr
49 ! read the eigenvalues and occupation numbers from file
50 call readevalsv
51 call readoccsv
52 ! calculate the density
53 call rhomag
54 ! calculate the dipole magnetic field if required
55 if (tbdip) call bdipole
56 ! allocate local arrays
57 allocate(fr(nrmtmax))
58 if (mp_mpi) then
59  open(50,file='MOSSBAUER.OUT',form='FORMATTED')
60 end if
61 ! loop over species
62 do is=1,nspecies
63  nr=nrmt(is)
64  nri=nrmti(is)
65  nrn=nrnucl(is)
66  nrt=nrtmsn(is)
67 ! loop over atoms
68  do ia=1,natoms(is)
69  ias=idxas(ia,is)
70  if (mp_mpi) then
71  write(50,*)
72  write(50,*)
73  write(50,'("Species : ",I4," (",A,"), atom : ",I4)') is,trim(spsymb(is)),&
74  ia
75  write(50,*)
76  write(50,'(" approximate nuclear radius : ",G18.10)') rnucl(is)
77  write(50,'(" number of mesh points to nuclear radius : ",I6)') nrn
78  write(50,'(" Thomson radius : ",G18.10)') rtmsn(is)
79  write(50,'(" number of mesh points to Thomson radius : ",I6)') nrt
80  end if
81 !--------------------------------!
82 ! contact charge density !
83 !--------------------------------!
84 ! extract the l = m = 0 component of the muffin-tin density
85  call rfmtlm(1,nr,nri,rhomt(:,ias),fr)
86 ! density at nuclear center
87  r0=fr(1)*y00
88 ! density at nuclear surface
89  rn=fr(nrn)*y00
90 ! average density in nuclear volume
91  t1=dot_product(wr2mt(1:nrn,is),fr(1:nrn))
92  rna=fourpi*y00*t1/volnucl(is)
93 ! density at Thomson radius
94  rt=fr(nrt)*y00
95 ! average density in Thomson volume
96  t1=dot_product(wr2mt(1:nrt,is),fr(1:nrt))
97  rta=fourpi*y00*t1/voltmsn(is)
98  if (mp_mpi) then
99  write(50,*)
100  write(50,'(" Contact density :")')
101  write(50,'(" at nuclear center : ",G18.10)') r0
102  write(50,'(" at nuclear surface : ",G18.10)') rn
103  write(50,'(" average in nuclear volume : ",G18.10)') rna
104  write(50,'(" at Thomson radius : ",G18.10)') rt
105  write(50,'(" average in Thomson volume : ",G18.10)') rta
106  end if
107 !----------------------------------!
108 ! magnetic hyperfine field !
109 !----------------------------------!
110  if (spinpol) then
111 ! contact term
112  do idm=1,ndmag
113 ! extract the l = m = 0 component of the muffin-tin magnetisation
114  call rfmtlm(1,nr,nri,magmt(:,ias,idm),fr)
115 ! average magnetisation in nuclear volume
116  t1=dot_product(wr2mt(1:nrn,is),fr(1:nrn))
117  mn(idm)=fourpi*y00*t1/volnucl(is)
118 ! average in Thomson volume
119  t1=dot_product(wr2mt(1:nrt,is),fr(1:nrt))
120  mt(idm)=fourpi*y00*t1/voltmsn(is)
121  end do
122  t1=8.d0*pi*cb/(3.d0*solsc)
123  bn(1:ndmag)=t1*mn(1:ndmag)
124  bt(1:ndmag)=t1*mt(1:ndmag)
125  if (mp_mpi) then
126  write(50,*)
127  write(50,'(" Contact average in nuclear volume :")')
128  write(50,'(" moment (mu_B) : ",3G18.10)') mn(1:ndmag)
129  write(50,'(" magnetic field : ",3G18.10)') bn(1:ndmag)
130  write(50,'(" tesla : ",3G18.10)') b_si*bn(1:ndmag)
131  write(50,*)
132  write(50,'(" Contact average in Thomson volume :")')
133  write(50,'(" moment (mu_B) : ",3G18.10)') mt(1:ndmag)
134  write(50,'(" magnetic field : ",3G18.10)') bt(1:ndmag)
135  write(50,'(" tesla : ",3G18.10)') b_si*bt(1:ndmag)
136  end if
137 ! spin and orbital dipole term
138  if (tbdip) then
139 ! extract the l = m = 0 component of the dipole field
140  do idm=1,3
141  call rfmtlm(1,nr,nri,bdmt(:,ias,idm),fr)
142 ! average dipole field in nuclear volume
143  t1=dot_product(wr2mt(1:nrn,is),fr(1:nrn))
144  bn(idm)=fourpi*y00*t1/(volnucl(is)*solsc)
145 ! average in Thomson volume
146  t1=dot_product(wr2mt(1:nrt,is),fr(1:nrt))
147  bt(idm)=fourpi*y00*t1/(voltmsn(is)*solsc)
148  end do
149  if (mp_mpi) then
150  write(50,*)
151  write(50,'(" Average dipole field in nuclear volume :")')
152  if (tjr) then
153  write(50,'(" spin and orbital : ",3G18.10)') bn
154  else
155  write(50,'(" spin : ",3G18.10)') bn
156  end if
157  write(50,'(" tesla : ",3G18.10)') b_si*bn
158  write(50,*)
159  write(50,'(" Average dipole field in Thomson volume :")')
160  if (tjr) then
161  write(50,'(" spin and orbital : ",3G18.10)') bt
162  else
163  write(50,'(" spin : ",3G18.10)') bt
164  end if
165  write(50,'(" tesla : ",3G18.10)') b_si*bt
166  end if
167 ! write to test file if required
168  call writetest(110,'hyperfine field',nv=3,tol=1.d-4,rva=bn)
169  end if
170  end if
171  end do
172 end do
173 if (mp_mpi) then
174  if (spinpol.and.tbdip) then
175  write(50,*)
176  write(50,'("Note that the contact term is implicitly included in the &
177  &spin dipole field")')
178  write(50,'(" but may not match exactly with the directly &
179  &calculated value.")')
180  end if
181  close(50)
182  write(*,*)
183  write(*,'("Info(mossbauer):")')
184  write(*,'(" Mossbauer parameters written to MOSSBAUER.OUT")')
185 end if
186 deallocate(fr)
187 end subroutine
188 !EOC
189 
real(8), dimension(maxspecies) rnucl
Definition: modmain.f90:85
subroutine writetest(id, descr, nv, iv, iva, tol, rv, rva, zv, zva)
Definition: modtest.f90:16
logical tjr
Definition: modmain.f90:620
logical mp_mpi
Definition: modmpi.f90:17
logical spinpol
Definition: modmain.f90:228
integer, dimension(maxatoms, maxspecies) idxas
Definition: modmain.f90:42
integer ndmag
Definition: modmain.f90:238
subroutine gencore
Definition: gencore.f90:10
real(8), dimension(:,:,:), allocatable bdmt
Definition: modmain.f90:638
real(8), dimension(:,:), pointer, contiguous rhomt
Definition: modmain.f90:614
subroutine rhomag
Definition: rhomag.f90:7
real(8), parameter pi
Definition: modmain.f90:1232
subroutine readoccsv
Definition: readoccsv.f90:7
subroutine genapwlofr
Definition: genapwlofr.f90:7
integer, dimension(maxspecies) nrtmsn
Definition: modmain.f90:95
subroutine linengy
Definition: linengy.f90:10
pure subroutine rfmtlm(lm, nr, nri, rfmt, fr)
Definition: rfmtlm.f90:10
real(8), dimension(:,:,:), pointer, contiguous magmt
Definition: modmain.f90:616
subroutine mossbauer
Definition: mossbauer.f90:10
subroutine bdipole
Definition: bdipole.f90:10
real(8), dimension(maxspecies) rtmsn
Definition: modmain.f90:91
real(8), parameter gfacte
Definition: modmain.f90:1277
real(8), dimension(maxspecies) voltmsn
Definition: modmain.f90:93
real(8) solsc
Definition: modmain.f90:1253
subroutine init1
Definition: init1.f90:10
integer, dimension(maxspecies) natoms
Definition: modmain.f90:36
Definition: modmpi.f90:6
integer, dimension(maxspecies) nrnucl
Definition: modmain.f90:89
real(8), parameter b_si
Definition: modmain.f90:1271
subroutine readstate
Definition: readstate.f90:10
logical tbdip
Definition: modmain.f90:643
integer nspecies
Definition: modmain.f90:34
subroutine init0
Definition: init0.f90:10
real(8), parameter fourpi
Definition: modmain.f90:1234
integer nrmtmax
Definition: modmain.f90:152
real(8), dimension(maxspecies) volnucl
Definition: modmain.f90:87
subroutine readevalsv
Definition: readevalsv.f90:7
integer, dimension(maxspecies) nrmti
Definition: modmain.f90:211
real(8), parameter y00
Definition: modmain.f90:1236
character(64), dimension(maxspecies) spsymb
Definition: modmain.f90:78
real(8), dimension(:,:), allocatable wr2mt
Definition: modmain.f90:183
integer, dimension(maxspecies) nrmt
Definition: modmain.f90:150