1 | #!/bin/tcsh |
---|
2 | set GSASDIR="$0" |
---|
3 | # translate a link, if needed |
---|
4 | set link=`readlink $GSASDIR` |
---|
5 | if ($link != "") then |
---|
6 | set GSASDIR=$link |
---|
7 | endif |
---|
8 | set GSASDIR=$GSASDIR:h |
---|
9 | setenv PGPLOT_XW_WIDTH 0.75 |
---|
10 | setenv PGPLOT_DIR $GSASDIR/pgl |
---|
11 | setenv gsas $GSASDIR |
---|
12 | setenv ATOMDATA $GSASDIR/data/atmdata.dat |
---|
13 | setenv ATMXSECT $GSASDIR/data/atmxsect.dat |
---|
14 | setenv LENPAGE 80 |
---|
15 | set GSASEXE="$GSASDIR/exe" |
---|
16 | set pgms = `/bin/ls $GSASEXE` |
---|
17 | set history = 100 |
---|
18 | alias upcase $GSASDIR/upcase |
---|
19 | alias count $GSASDIR/count |
---|
20 | if ( $#argv > 0 ) then |
---|
21 | set expnam = `upcase $argv[1]` |
---|
22 | set gcmmd = "" |
---|
23 | else |
---|
24 | set expnam = "" |
---|
25 | set gcmmd = "next" |
---|
26 | endif |
---|
27 | onintr interrupt |
---|
28 | @ ntrrpt = 0 |
---|
29 | echo ' ' |
---|
30 | echo ' Welcome to GSAS' |
---|
31 | echo ' The General Structure Analysis System' |
---|
32 | echo ' ' |
---|
33 | echo ' Copyright, 1985-2001, The Regents of the University of California' |
---|
34 | echo ' ' |
---|
35 | echo 'Enter "help" for a listing of possible commands' |
---|
36 | echo ' ' |
---|
37 | while ( "$gcmmd" != "quit" ) |
---|
38 | if ( $#gcmmd == 0 ) then |
---|
39 | goto ncmmd |
---|
40 | endif |
---|
41 | @ np = 1 |
---|
42 | while ( $np <= $#pgms ) |
---|
43 | if ( "$gcmmd" == $pgms[$np] ) then |
---|
44 | $GSASEXE/$gcmmd $expnam |
---|
45 | @ ntrrpt = 0 |
---|
46 | goto ncmmd |
---|
47 | endif |
---|
48 | @ np ++ |
---|
49 | end |
---|
50 | switch ("$gcmmd[1]") |
---|
51 | case gsas: |
---|
52 | echo "gsas not to be run inside gsas" |
---|
53 | breaksw |
---|
54 | case expnam: |
---|
55 | if ( $#gcmmd > 1 ) then |
---|
56 | set inpline = $gcmmd[2] |
---|
57 | else |
---|
58 | echo -n "Enter experiment name: " |
---|
59 | set inpline = $<:q |
---|
60 | endif |
---|
61 | set expnam = `upcase $inpline[1]` |
---|
62 | breaksw |
---|
63 | case help: |
---|
64 | echo "The available GSAS commands are:" |
---|
65 | ls -C $GSASEXE |
---|
66 | echo "utilities: atom next prev elst slst tlst dlst" |
---|
67 | echo " dexp texp lsexp pagelen cnvfile" |
---|
68 | echo '"expnam" to set an experiment name' |
---|
69 | echo '"quit" to leave GSAS & "help" for this help' |
---|
70 | breaksw |
---|
71 | case tlst: |
---|
72 | less $expnam.LST |
---|
73 | breaksw |
---|
74 | case dlst: |
---|
75 | rm $expnam.LST |
---|
76 | breaksw |
---|
77 | case elst: |
---|
78 | emacs $expnam.LST |
---|
79 | breaksw |
---|
80 | case slst: |
---|
81 | if ( $#gcmmd < 2 ) then |
---|
82 | echo -n "Enter search string: " |
---|
83 | set inpline = $<:q |
---|
84 | else |
---|
85 | set inpline = "$gcmmd[2-$#gcmmd]" |
---|
86 | endif |
---|
87 | set sstr = ($inpline) |
---|
88 | while ( $#sstr > 0 ) |
---|
89 | grep -i $sstr[1] $expnam.LST |
---|
90 | shift sstr |
---|
91 | end |
---|
92 | breaksw |
---|
93 | case texp: |
---|
94 | less $expnam.EXP |
---|
95 | breaksw |
---|
96 | case sexp: |
---|
97 | if ( $#gcmmd < 2 ) then |
---|
98 | echo -n "Enter search string: " |
---|
99 | set inpline = $<:q |
---|
100 | else |
---|
101 | set inpline = "$gcmmd[2-$#gcmmd]" |
---|
102 | endif |
---|
103 | set sstr = ($inpline) |
---|
104 | while ( $#sstr > 0 ) |
---|
105 | grep -i $sstr[1] $expnam.EXP |
---|
106 | shift sstr |
---|
107 | end |
---|
108 | breaksw |
---|
109 | case edexp: |
---|
110 | emacs $expnam.EXP |
---|
111 | breaksw |
---|
112 | case atom: |
---|
113 | if ( $#gcmmd < 2 ) then |
---|
114 | echo -n "Enter element symbol: " |
---|
115 | set inpline = `upcase $<:q` |
---|
116 | else |
---|
117 | set inpline = `upcase "$gcmmd[2]"` |
---|
118 | endif |
---|
119 | if ( `count "$inpline"` == 3 ) then |
---|
120 | awk 'substr($0,4,2) == "'$inpline'"' $ATOMDATA |
---|
121 | else if ( `count "$inpline"` == 2 ) then |
---|
122 | awk 'substr($0,4,2) == " '$inpline'"' $ATOMDATA |
---|
123 | else |
---|
124 | echo "Improper element name $inpline" |
---|
125 | endif |
---|
126 | breaksw |
---|
127 | case dexp: |
---|
128 | ls $expnam.* |
---|
129 | echo -n "Are you sure you want to clean out $expnam (y/<n>)? " |
---|
130 | set iyn = $<:q |
---|
131 | if ( $iyn == 'y' ) then |
---|
132 | rm $expnam.[A-D]* $expnam.[F-Q]* $expnam.[T-Z]* |
---|
133 | rm $expnam.R* $expnam.P* |
---|
134 | echo "Files for experiment $expnam removed" |
---|
135 | endif |
---|
136 | breaksw |
---|
137 | case lsexp: |
---|
138 | ls -C $expnam.* |
---|
139 | breaksw |
---|
140 | case prev: |
---|
141 | set sstr = `ls *.EXP | sort -r` |
---|
142 | goto search |
---|
143 | case next: |
---|
144 | set sstr = `ls *.EXP` |
---|
145 | if ( $#sstr == 0 ) then |
---|
146 | goto ncmmd |
---|
147 | endif |
---|
148 | search: |
---|
149 | set temp = $sstr[1]:t ;set saveexp = $temp:r |
---|
150 | while ( $#sstr > 0 ) |
---|
151 | set temp = $sstr[1]:t ;set testexp = $temp:r |
---|
152 | if ( $testexp == $expnam ) then |
---|
153 | shift sstr |
---|
154 | goto found |
---|
155 | endif |
---|
156 | shift sstr |
---|
157 | end |
---|
158 | found: |
---|
159 | if ( $#sstr == 0 ) then |
---|
160 | set expnam = $saveexp |
---|
161 | else |
---|
162 | set temp = $sstr[1]:t ;set expnam = $temp:r |
---|
163 | endif |
---|
164 | breaksw |
---|
165 | case pagelen: |
---|
166 | if ( $#gcmmd < 2 ) then |
---|
167 | echo -n "Enter pagelength: " |
---|
168 | set inpline = $<:q |
---|
169 | else |
---|
170 | set inpline = "$gcmmd[2]" |
---|
171 | endif |
---|
172 | unsetenv LENPAGE |
---|
173 | setenv LENPAGE $inpline |
---|
174 | breaksw |
---|
175 | default: |
---|
176 | if ( "$gcmmd" != "quit" ) then |
---|
177 | $gcmmd |
---|
178 | endif |
---|
179 | breaksw |
---|
180 | endsw |
---|
181 | goto ncmmd |
---|
182 | interrupt: |
---|
183 | if ( $ntrrpt > 2 ) then |
---|
184 | exit |
---|
185 | else |
---|
186 | @ ntrrpt ++ |
---|
187 | endif |
---|
188 | ncmmd: |
---|
189 | if ( $expnam == "" ) then |
---|
190 | echo "No experiment name given" |
---|
191 | else |
---|
192 | ls -l $expnam.EXP |
---|
193 | echo "The experiment name is $expnam" |
---|
194 | endif |
---|
195 | echo -n "`hostname` GSAS Command: " |
---|
196 | set inpline = $<:q |
---|
197 | set gcmmd = ($inpline) |
---|
198 | endif |
---|
199 | end |
---|
200 | exit |
---|