File: writegeom.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 (74 lines) | stat: -rw-r--r-- 1,849 bytes parent folder | download | duplicates (3)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

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

!BOP
! !ROUTINE: writegeom
! !INTERFACE:
subroutine writegeom(fnum)
! !USES:
use modmain
! !INPUT/OUTPUT PARAMETERS:
!   fnum : file number for writing output (in,integer)
! !DESCRIPTION:
!   Outputs the lattice vectors and atomic positions to file, in a format
!   which may be then used directly in {\tt elk.in}.
!
! !REVISION HISTORY:
!   Created January 2004 (JKD)
!EOP
!BOC
implicit none
! arguments
integer, intent(in) :: fnum
! local variables
integer is,ia,i
real(8) v1(3),v2(3)
write(fnum,*)
write(fnum,'("scale")')
write(fnum,'(" 1.0")')
write(fnum,*)
write(fnum,'("scale1")')
write(fnum,'(" 1.0")')
write(fnum,*)
write(fnum,'("scale2")')
write(fnum,'(" 1.0")')
write(fnum,*)
write(fnum,'("scale3")')
write(fnum,'(" 1.0")')
write(fnum,*)
write(fnum,'("avec")')
write(fnum,'(3G18.10)') avec(:,1)
write(fnum,'(3G18.10)') avec(:,2)
write(fnum,'(3G18.10)') avec(:,3)
if (molecule) then
  write(fnum,*)
  write(fnum,'("molecule")')
  write(fnum,'(" ",L1)') molecule
end if
write(fnum,*)
write(fnum,'("atoms")')
write(fnum,'(I4,T40," : nspecies")') nspecies
do is=1,nspecies
  write(fnum,'("''",A,"''",T40," : spfname")') trim(spfname(is))
  write(fnum,'(I4,T40," : natoms; atpos, bfcmt below")') natoms(is)
  do ia=1,natoms(is)
    if (molecule) then
! map lattice coordinates to [-0.5,0.5) and write as Cartesian coordinates
      v1(:)=atposl(:,ia,is)
      do i=1,3
        if (v1(i).gt.0.5d0) v1(i)=v1(i)-1.d0
      end do
      call r3mv(avec,v1,v2)
    else
! otherwise write lattice coordinates
      v2(:)=atposl(:,ia,is)
    end if
    write(fnum,'(3F14.8,"  ",3F12.8)') v2(:),bfcmt(:,ia,is)
  end do
end do
return
end subroutine
!EOC