The Elk Code
 
Loading...
Searching...
No Matches
bfcqinit.f90
Go to the documentation of this file.
1
2! Copyright (C) 2025 Wenhan Chen, 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
6subroutine bfcqinit
7use modmain
8use modulr
9use modrandom
10implicit none
11! local variables
12integer ifq,idm,ias
13real(8) cb,t1
14! coupling constant of the external field (g_e/4c)
15cb=gfacte/(4.d0*solsc)
16! zero the external magnetic fields
17bfcq(1:ndmag,1:nfqrz)=0.d0
18bfcmtq(1:natmtot,1:ndmag,1:nfqrz)=0.d0
19! read the external fields from file if required
20if (trdbfcr) call readbfcr
21! add random numbers to magnetic fields if required
22if (abs(rndbfcu) > 0.d0) then
23 t1=cb*rndbfcu
24 do ifq=1,nfqrz
25 do idm=1,ndmag
26 bfcq(idm,ifq)=bfcq(idm,ifq)+t1*cmplx(randomu()-0.5d0,randomu()-0.5d0,8)
27 do ias=1,natmtot
28 bfcmtq(ias,idm,ifq)=bfcmtq(ias,idm,ifq) &
29 +t1*cmplx(randomu()-0.5d0,randomu()-0.5d0,8)
30 end do
31 end do
32 end do
33 bfcq(1:ndmag,1)=dble(bfcq(1:ndmag,1))
34 bfcmtq(1:natmtot,1:ndmag,1)=dble(bfcmtq(1:natmtot,1:ndmag,1))
35end if
36! add the global external magnetic field
37do idm=1,ndmag
38 if (ncmag) then
39 t1=cb*bfieldcu(idm)
40 else
41 t1=cb*bfieldcu(3)
42 end if
43 bfcq(idm,1)=bfcq(idm,1)+t1
44 bfcmtq(1:natmtot,idm,1)=bfcmtq(1:natmtot,idm,1)+t1
45end do
46! write the external magnetic fields to file if required
47if (.not.trdbfcr) call writebfcr
48end subroutine
49
subroutine bfcqinit
Definition bfcqinit.f90:7
real(8), parameter gfacte
Definition modmain.f90:1276
logical ncmag
Definition modmain.f90:240
integer nfqrz
Definition modmain.f90:539
integer natmtot
Definition modmain.f90:40
real(8) solsc
Definition modmain.f90:1252
integer ndmag
Definition modmain.f90:238
real(8) function randomu()
Definition modrandom.f90:18
complex(8), dimension(:,:), allocatable bfcq
Definition modulr.f90:70
real(8), dimension(3) bfieldcu
Definition modulr.f90:74
logical trdbfcr
Definition modulr.f90:68
real(8) rndbfcu
Definition modulr.f90:86
complex(8), dimension(:,:,:), allocatable bfcmtq
Definition modulr.f90:72
subroutine readbfcr
Definition readbfcr.f90:7
subroutine writebfcr
Definition writebfcr.f90:7