
! Copyright (C) 2018 T. Mueller, J. K. Dewhurst, S. Sharma and E. K. U. Gross.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

subroutine writechgu(fnum)
use modmain
use modulr
implicit none
! arguments
integer, intent(in) :: fnum
! local variables
integer is,ia,ias
! write moments
if (spinpol) then
  write(fnum,*)
  write(fnum,'("Moments averaged over ultracell :")')
  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,mommtu(1:ndmag,ias)
    end do
  end do
end if
return
end subroutine

