The Elk Code
 
Loading...
Searching...
No Matches
modvars.f90
Go to the documentation of this file.
1
2! Copyright (C) 2011 J. K. Dewhurst, S. Sharma and E. K. U. Gross
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6module modvars
7
8! if wrtvars is .true. then variables are written to VARIABLES.OUT
9logical wrtvars
10! if batch is .true. then Elk will run in batch mode
11logical batch
12
13contains
14
15subroutine writevars(vname,n1,n2,n3,n4,n5,n6,nv,iv,iva,rv,rva,zv,zva,sv,sva)
16implicit none
17! arguments
18character(*), intent(in) :: vname
19integer, optional, intent(in) :: n1,n2,n3,n4,n5,n6
20integer, optional, intent(in) :: nv,iv,iva(*)
21real(8), optional, intent(in) :: rv,rva(*)
22complex(8), optional, intent(in) :: zv,zva(*)
23character(*), optional, intent(in) :: sv,sva(*)
24! local variables
25integer i
26if (present(iva).or.present(rva).or.present(zva).or.present(sva)) then
27 if (.not.present(nv)) then
28 write(*,*)
29 write(*,'("Error(writevars): missing argument nv")')
30 write(*,*)
31 stop
32 else
33 if (nv < 0) then
34 write(*,*)
35 write(*,'("Error(writevars): nv < 0 : ",I8)') nv
36 write(*,*)
37 stop
38 end if
39 end if
40end if
41open(95,file='VARIABLES.OUT',form='FORMATTED',action='WRITE',position='APPEND')
42write(95,*)
43write(95,'(A)',advance='NO') trim(vname)
44if (present(n1)) write(95,'(I8)',advance='NO') n1
45if (present(n2)) write(95,'(I8)',advance='NO') n2
46if (present(n3)) write(95,'(I8)',advance='NO') n3
47if (present(n4)) write(95,'(I8)',advance='NO') n4
48if (present(n5)) write(95,'(I8)',advance='NO') n5
49if (present(n6)) write(95,'(I8)',advance='NO') n6
50write(95,*)
51if (present(iv)) then
52 write(95,'(2I8)') 1,1
53 write(95,'(I8)') iv
54else if (present(rv)) then
55 write(95,'(2I8)') 2,1
56 write(95,'(G24.14)') rv
57else if (present(zv)) then
58 write(95,'(2I8)') 3,1
59 write(95,'(2G24.14)') dble(zv),aimag(zv)
60else if (present(sv)) then
61 write(95,'(2I8)') 4,1
62 write(95,'(A)') trim(sv)
63else if (present(iva)) then
64 write(95,'(2I8)') 1,nv
65 do i=1,nv
66 write(95,'(I8)') iva(i)
67 end do
68else if (present(rva)) then
69 write(95,'(2I8)') 2,nv
70 do i=1,nv
71 write(95,'(G24.14)') rva(i)
72 end do
73else if (present(zva)) then
74 write(95,'(2I8)') 3,nv
75 do i=1,nv
76 write(95,'(2G24.14)') dble(zva(i)),aimag(zva(i))
77 end do
78else if (present(sva)) then
79 write(95,'(2I8)') 4,nv
80 do i=1,nv
81 write(95,'(A)') trim(sva(i))
82 end do
83end if
84close(95)
85end subroutine
86
87end module
88
subroutine writevars(vname, n1, n2, n3, n4, n5, n6, nv, iv, iva, rv, rva, zv, zva, sv, sva)
Definition modvars.f90:16
logical batch
Definition modvars.f90:11
logical wrtvars
Definition modvars.f90:9