
! Copyright (C) 2024 J. K. Dewhurst and S. Sharma.
! This file is distributed under the terms of the GNU General Public License.
! See the file COPYING for license details.

subroutine writew90amn
use modmain
use modw90
use modrandom
implicit none
! local variables
integer ik,ist,i
real(8) a,b
character(256) fname
fname=trim(seedname)//'.amn'
open(50,file=trim(fname),action='WRITE',form='FORMATTED')
write(50,'("Generated by Elk version ",I0,".",I0,".",I0)') version
write(50,'(3I6)') num_bands,nkptnr,num_wann
do ik=1,nkptnr
  do i=1,num_wann
    do ist=1,num_bands
      a=0.5d0-randomu()
      b=0.5d0-randomu()
      write(50,'(3I8,2G18.10)') ist,i,ik,a,b
    end do
  end do
end do
close(50)
write(*,*)
write(*,'("Info(writew90amn): created file ",A)') trim(fname)
end subroutine

