File: writechg.f90

package info (click to toggle)
elkcode 5.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 12,840 kB
  • sloc: f90: 48,415; fortran: 22,457; perl: 965; makefile: 384; sh: 369; python: 105; ansic: 67
file content (54 lines) | stat: -rw-r--r-- 1,759 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

! Copyright (C) 2002-2006 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
! This file is distributed under the terms of the GNU Lesser General Public
! License. See the file COPYING for license details.

subroutine writechg(fnum)
use modmain
implicit none
! arguments
integer, intent(in) :: fnum
! local variables
integer is,ia,ias
! write charges
write(fnum,*)
write(fnum,'("Charges :")')
write(fnum,'(" core",T30,": ",G18.10)') chgcrtot
write(fnum,'(" valence",T30,": ",G18.10)') chgval
write(fnum,'(" interstitial",T30,": ",G18.10)') chgir
write(fnum,'(" muffin-tins (core leakage)")')
do is=1,nspecies
  write(fnum,'("  species : ",I4," (",A,")")') is,trim(spsymb(is))
  do ia=1,natoms(is)
    ias=idxas(ia,is)
    write(fnum,'("   atom ",I4,T30,": ",G18.10," (",G18.10,")")') ia, &
     chgmt(ias),chgcrlk(ias)
  end do
end do
write(fnum,'(" total in muffin-tins",T30,": ",G18.10)') chgmttot
if (chgexs.ne.0.d0) then
  write(fnum,'(" excess",T30,": ",G18.10)') chgexs
end if
write(fnum,'(" total calculated charge",T30,": ",G18.10)') chgcalc
write(fnum,'(" total charge",T30,": ",G18.10)') chgtot
write(fnum,'(" error",T30,": ",G18.10)') abs(chgtot-chgcalc)
! write moments
if (spinpol) then
  write(fnum,*)
  write(fnum,'("Moments :")')
  write(fnum,'(" interstitial",T30,": ",3G18.10)') momir(1:ndmag)
  write(fnum,'(" muffin-tins")')
  do is=1,nspecies
    write(fnum,'("  species : ",I4," (",A,")")') is,trim(spsymb(is))
    do ia=1,natoms(is)
      ias=idxas(ia,is)
      write(fnum,'("   atom ",I4,T30,": ",3G18.10)') ia,mommt(1:ndmag,ias)
    end do
  end do
  write(fnum,'(" total in muffin-tins",T30,": ",3G18.10)') mommttot(1:ndmag)
  write(fnum,'(" total moment",T30,": ",3G18.10)') momtot(1:ndmag)
end if
flush(fnum)
return
end subroutine