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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
subroutine begin
c***************************************************************************
c This routine simply starts up MOOG
c THIS VERSION IS FOR LINUX REDHAT MACHINES
c***************************************************************************
implicit real*8 (a-h,o-z)
include 'Atmos.com'
include 'Pstuff.com'
character*80 line, systemcall
integer num
integer nargs
logical fexist
c*****define the number of text screen lines for silent mode;
c this number is hardwired, since it is not really needed at run time.
if (silent == 'y') then
maxline = 24
write (*,*) 'maxline', maxline
pause
go to 10
endif
c*****define the number of lines available on the text screen for
c interactive mode; this number is discovered from the "stty -a"
c command, for which the output format is unique to the operating
c system.
write (systemcall,*) 'uname -s > /tmp/moog.tmpuname'
call system (systemcall)
open (99,file='/tmp/moog.tmpuname')
read (99,1010,end=15) line
machine = line
close(99,status='delete')
write (systemcall,*) 'rm -f /tmp/moog.tmpuname'
call system (systemcall)
write (systemcall,*) 'stty -a > /tmp/moog.tmpsize'
call system (systemcall)
open (99,file='/tmp/moog.tmpsize')
5 read (99,1010,end=15) line
do i=1,77
if (line(i:i+3) == 'rows') then
if (machine == 'Linux') then
read (line(i+4:i+6),1011) maxline
elseif (machine == 'Darwin') then
read (line(i-4:i-2),1011) maxline
elseif (machine == 'Solaris') then
read (line(i+6:i+8),1011) maxline
endif
go to 10
endif
enddo
go to 5
15 array = 'SCREEN ROW COUNT UNKNOWN; USE 24 ([y]/n)? '
nchars = 42
ikount = 2
call getasci (nchars,ikount)
choice = chinfo(1:1)
if (choice=='y' .or. nchars<=0) then
go to 10
else
call finish (0)
endif
10 close (99,status='delete')
write (systemcall,*) 'rm -f /tmp/moog.tmpsize'
call system (systemcall)
if (maxline < 10) then
maxline = 24
else
maxline = maxline - 2
endif
c*****clear the text screen
write (systemcall,*) 'clear'
call system (systemcall)
c*****open data files carried with the source code: Barklem damping
nfbarklem = 35
num = 60
call getcount (num,moogpath)
if (moogpath(num:num) /= '/') then
num = num + 1
moogpath(num:num) = '/'
endif
fbarklem(1:num) = moogpath(1:num)
fbarklem(num+1:num+11) = 'Barklem.dat'
open (nfbarklem,file=fbarklem)
c*****open data files carried with the source code: Barklem UV damping
nfbarklemUV = 36
num = 60
call getcount (num,moogpath)
if (moogpath(num:num) /= '/') then
num = num + 1
moogpath(num:num) = '/'
endif
fbarklemUV(1:num) = moogpath(1:num)
fbarklemUV(num+1:num+13) = 'BarklemUV.dat'
open (nfbarklemUV,file=fbarklemUV)
c write a header and find the appropriate parameter file, and exit normally
write (array,1001)
istat = ivwrite (1,1,array,79)
write (array,1004)
istat = ivwrite (2,1,array,79)
array = 'MOOG PARAMETERS? '
nchars = 15
nfparam = 50
lscreen = 4
nargs = command_argument_count()
if (nargs > 0) then
call get_command_argument(1, fparam)
else
if (silent == 'y') then
fparam = 'batch.par'
else
fparam = 'no_filename_given'
endif
endif
if (fparam /= 'no_filename_given') then
inquire(FILE=fparam, EXIST=fexist)
if (.NOT. fexist) then
write(0,*) "Input file does not exist"
call exit(1)
endif
endif
call infile ('input ',nfparam,'formatted ',0,nchars,
. fparam,lscreen)
read (nfparam,1002) control
write (array,1003) control
istat = ivwrite (2,1,array,58)
write (array,1001)
istat = ivwrite (3,1,array,79)
return
c*****format statements
1001 format (79('*'))
1002 format (a7)
1003 format (22x,'MOOG IS CONTROLLED BY DRIVER ',a7)
1004 format (25(' '),'MOOG LTE VERSION (NOV 2019)',26(' '))
1010 format (a80)
1011 format (i3)
end
|