The Elk Code
writechg.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2006 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU Lesser General Public
4 ! License. See the file COPYING for license details.
5 
6 subroutine writechg(fnum)
7 use modmain
8 implicit none
9 ! arguments
10 integer, intent(in) :: fnum
11 ! local variables
12 integer is,ia,ias
13 ! write charges
14 write(fnum,*)
15 write(fnum,'("Charges :")')
16 write(fnum,'(" core",T30,": ",G18.10)') chgcrtot
17 write(fnum,'(" valence",T30,": ",G18.10)') chgval
18 write(fnum,'(" interstitial",T30,": ",G18.10)') chgir
19 write(fnum,'(" muffin-tins (core leakage)")')
20 do is=1,nspecies
21  write(fnum,'(" species : ",I4," (",A,")")') is,trim(spsymb(is))
22  do ia=1,natoms(is)
23  ias=idxas(ia,is)
24  write(fnum,'(" atom ",I4,T30,": ",G18.10," (",G18.10,")")') ia, &
25  chgmt(ias),chgcrlk(ias)
26  end do
27 end do
28 write(fnum,'(" total in muffin-tins",T30,": ",G18.10)') chgmttot
29 if (chgexs /= 0.d0) then
30  write(fnum,'(" excess",T30,": ",G18.10)') chgexs
31 end if
32 write(fnum,'(" total calculated charge",T30,": ",G18.10)') chgcalc
33 write(fnum,'(" total charge",T30,": ",G18.10)') chgtot
34 write(fnum,'(" error",T30,": ",G18.10)') abs(chgtot-chgcalc)
35 flush(fnum)
36 end subroutine
37 
integer, dimension(maxatoms, maxspecies) idxas
Definition: modmain.f90:42
real(8), dimension(:), allocatable chgmt
Definition: modmain.f90:732
real(8) chgcrtot
Definition: modmain.f90:718
real(8) chgir
Definition: modmain.f90:730
real(8), dimension(:), allocatable chgcrlk
Definition: modmain.f90:720
integer, dimension(maxspecies) natoms
Definition: modmain.f90:36
real(8) chgcalc
Definition: modmain.f90:728
real(8) chgmttot
Definition: modmain.f90:734
subroutine writechg(fnum)
Definition: writechg.f90:7
real(8) chgval
Definition: modmain.f90:722
integer nspecies
Definition: modmain.f90:34
real(8) chgtot
Definition: modmain.f90:726
real(8) chgexs
Definition: modmain.f90:724
character(64), dimension(maxspecies) spsymb
Definition: modmain.f90:78