The Elk Code
 
Loading...
Searching...
No Matches
writebfcr.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 writebfcr
7use modmain
8use modulr
9implicit none
10! local variables
11integer idm,i1,i2,i3,ir
12real(8) v(3)
13! automatic arrays
14real(8) bfcr(nqpt,ndmag)
15complex(8) zfft(nfqrz)
16! Fourier transform external magnetic field from Q-space to real-space
17do idm=1,ndmag
18 zfft(1:nfqrz)=bfcq(idm,1:nfqrz)
19 call rzfftifc(3,ngridq,1,bfcr(:,idm),zfft)
20end do
21! write the real-space magnetic field in Cartesian coordinates to file
22open(50,file='BFCR.OUT',form='FORMATTED')
23write(50,'(3I6," : grid size")') ngridq
24ir=0
25do i3=1,ngridq(3)
26 do i2=1,ngridq(2)
27 do i1=1,ngridq(1)
28 ir=ir+1
29 if (ncmag) then
30 v(1:3)=bfcr(ir,1:3)
31 else
32 v(1:2)=0.d0
33 v(3)=bfcr(ir,1)
34 end if
35 write(50,'(3I6,3G18.10)') i1,i2,i3,v
36 end do
37 end do
38end do
39close(50)
40end subroutine
41
logical ncmag
Definition modmain.f90:240
integer, dimension(3) ngridq
Definition modmain.f90:515
complex(8), dimension(:,:), allocatable bfcq
Definition modulr.f90:70
subroutine writebfcr
Definition writebfcr.f90:7
subroutine rzfftifc(nd, n, sgn, r, z)