I made a small script to install the MIRA software. It checks if yorick is installed, also optimpack and downloads them and installs them if they are missing.

You can downlad it here

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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#! /bin/bash
#******************************************************************************
# Install script for MIRA, inspired from the AMBER DRS installation scripts
#
# (c) 2010 F. Millour
#
# $Log: not supported by cvs2svn $
# $Log: installMira.sh,v $
# Revision 1.2 2010/07/27 14:45:29 fmillour
# Add yorickinstallation to the MIRA installation script
# + change to MIRA 0.9.10
#
# Latest versions of the different software needed
####################################################
yeti_URL=https://github.com/emmt/Yeti/archive
yeti_version=6.4.0
MIRA_version=1.1.1
MIRA_URL=https://github.com/emmt/MiRA/releases/download/release-${MIRA_version}
#OptimPack_URL=https://codeload.github.com/emmt/OptimPack/zip
#OptimPack_version=3.0.1
OptimPack_version=1.4.0
OptimPack_URL=https://github.com/emmt/OptimPackLegacy/releases/download/release-${OptimPack_version}
 
## TBD: last version of Mira is now 1.1.1 on github
## https://github.com/emmt/MiRA/archive/release-1.1.1.zip
####################################################
yorick_URL=http://github.com/dhmunro/yorick/archive
yorick_version=2_2_04
####################################################
 
####################################################
# Get kernel-name and hardware-platform
kernel=`uname -s`
if [ "$kernel" == "Darwin" ];
then
platform=`uname -p`
nbproc=`sysctl hw.ncpu | awk '{print $2}'`
else
platform=`uname -m`
nbproc=`nproc`
fi
 
echo -e "Installing MIRA on $kernel/$platform with $nbproc cores...\n"
 
# Get root directory
currDir=$PWD
 
################################################################################
# FIXME: here test all necessary software
hash make 2>/dev/null || { echo >&2 "I require make but it's not installed... Aborting. Try this on ubuntu: sudo apt-get install make"; exit 1; }
hash unzip 2>/dev/null || { echo >&2 "I require unzip but it's not installed... Aborting. Try this on ubuntu: sudo apt-get install unzip"; exit 1; }
 
# Set log file
logFile=$PWD/mira-install.log
rm -f $logFile
touch $logFile
if [ $? != 0 ]
then
echo "ERROR - could not access log file $logFile"
exit 1
fi
 
# Print usage
function printUsage () {
echo -e "Usage: `basename $0` [-h] [-y] [-C <dir>] [-F <dir>]";
echo -e "\t-h\tprint this help.";
exit 0;
}
 
# Parse command-line parameters
installOpts=""
while getopts "hyC:F:" option
do
case $option in
h ) # Help option
printUsage;
exit 0;;
y ) # Assume yes option
installOpts="$installOpts -$option";;
* ) # Unknown option
echo "Invalid option -- $option"
printUsage;
exit 1;;
esac
done
 
# test first if yorick is installed
echo -e "Checking for the yorick software..." ;
if test `which yorick`;
then
echo "write, Y_SITE; quit;" > /tmp/getY_site.i
INSTALL_DIR=`yorick -batch /tmp/getY_site.i`;
echo -e "yorick found! installation directory is ${INSTALL_DIR}" ;
else
echo -e "yorick not found! checking if INSTALL_DIR has been set..." ;
# Then test if the INSTALL_DIR directory is set by the user
if test ${INSTALL_DIR} ;
then
echo -e "Installation directory is ${INSTALL_DIR}" ;
# If INSTALL_DIR directory is set by the user but do not exist, create it
if test ! -d ${INSTALL_DIR} ;
then
echo " Creating ${INSTALL_DIR} ..."
mkdir ${INSTALL_DIR}
fi
# Download yorick
#cd ${INSTALL_DIR}
cd $currDir
echo -e "Downloading yorick, version $yorick_version at ${yorick_URL}/y_${yorick_version}.zip into ${PWD} ..."
wget -N ${yorick_URL}/y_${yorick_version}.zip >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
# Uncompress yorick
echo -e "Uncompressing the yorick package..."
unzip -o y_${yorick_version} >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
# Compile yorick
echo -e "Configuring yorick..."
cd yorick-y_${yorick_version}
./configure >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
echo -e "Compiling yorick..."
make -j$nbproc relocatable >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
# Install yorick
echo -e "Installing yorick to ${INSTALL_DIR}..."
mv yorick-y_${yorick_version}-04.tgz ${INSTALL_DIR}
cd ${INSTALL_DIR}
tar xzf yorick-y_${yorick_version}-04.tgz
export PATH=${INSTALL_DIR}/yorick-y_${yorick_version}/bin:${PATH}
export LD_LIBRARY_PATH=${INSTALL_DIR}/yorick-${yorick_version}-04/lib:${LD_LIBRARY_PATH}
echo -e "Done!\n"
 
# test if yorick is installed
echo -e "Checking yorick installed well..." ;
if test `which yorick`;
then
echo "write, Y_SITE; quit;" > /tmp/getY_site.i
INSTALL_DIR=`yorick -batch /tmp/getY_site.i`;
echo -e "yorick found! installation directory is ${INSTALL_DIR}. Please consider adding this path to your PATH variable in your .bashrc or .profile file:\nexport PATH=${INSTALL_DIR}bin/:\$PATH" ;
echo "Press <enter> key when you have understood the above message..."
read touche
case $touche in
*) echo "Continuing..."
;;
esac
else
echo -e "ERROR - yorick not found!"
exit ;
fi
 
else
echo -e "ERROR - INSTALL_DIR variable, defining the installation directory, is not set !\nTry setting it with the following commands:\nbash shell:\nexport INSTALL_DIR=<your installation directory>\ntcsh shell:\nsetenv INSTALL_DIR <replace with your installation directory>"
exit ;
fi
fi
 
# Get kernel-name and hardware-platform
kernel=`uname -s`
if [ "$kernel" == "Darwin" ];
then
platform=`uname -p`
else
platform=`uname -m`
fi
 
echo -e "Installing the MIRA software on $kernel/$platform...\n"
 
####################################################
cd $currDir
echo -e "Downloading yeti, version $yeti_version at ${yeti_URL}/v${yeti_version}.zip into ${PWD} ..."
wget -N ${yeti_URL}/v${yeti_version}.zip >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
 
####################################################
echo -e "Uncompressing yeti..."
unzip -o v${yeti_version} >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
 
####################################################
echo -e "Installing yeti..."
cd Yeti-${yeti_version}
yorick -batch ./config.i --with-regex \
--with-fftw --with-fftw-defs="-I/usr/local/include" \
--with-fftw-libs="-L/usr/local/lib -lrfftw -lfftw" \
--with-gsl --with-gsl-defs="-I/usr/local/include" \
--with-gsl-libs="-L/usr/local/lib -lgsl -lgslcblas"
# Tiff library not always installed on target machines
# --with-tiff --with-tiff-libs="-ltiff" >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
make -j$nbproc clean >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
make -j$nbproc >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
make -j$nbproc install >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
echo -e "\nDone..."
cd ..
 
####################################################
cd $currDir
echo -e "Downloading OptimPack, version $OptimPack_version at ${OptimPack_URL}/OptimPackLegacy-${OptimPack_version}.tar.bz2 into ${PWD} ..."
wget -N ${OptimPack_URL}/OptimPackLegacy-${OptimPack_version}.tar.bz2 >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
 
####################################################
echo -e "Uncompressing OptimPack..."
tar jxvf OptimPackLegacy-${OptimPack_version}.tar.bz2 >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
 
####################################################
echo -e "Installing OptimPack..."
cd OptimPackLegacy-${OptimPack_version}/yorick
yorick -batch make.i >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
make -j$nbproc >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
make -j$nbproc install >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
cd ../..
echo -e "Done!\n"
 
####################################################
cd $currDir
echo -e "Downloading MIRA, version $MIRA_version at ${MIRA_URL}/mira-${MIRA_version}.tar.bz2 into ${PWD}..."
wget -N ${MIRA_URL}/mira-${MIRA_version}.tar.bz2 >> $logFile 2>&1
if [ $? != 0 ]
then
echo -e "\nERROR - See log file '$logFile' for details."
exit 1;
fi
 
####################################################
echo -e "Uncompressing MIRA..."
echo $PWD
tar jxvf mira-${MIRA_version}.tar.bz2 >> $logFile 2>&1
cd mira-${MIRA_version}/src
echo "734c734
< good = ((amperr > 0.0)&(phierr > 0.0));
---
> good = ((amperr >= 0.0)&(phierr > 0.0)&(amperr < 0.1)&(phierr < 60));
770c770
< good = (vis2err > 0.0);
---
> good = ((vis2err > 0.0)&(vis2data / vis2err > 1.));
800c800
< good = ((amperr > 0.0)&(phierr > 0.0));
---
> good = ((amperr >= 0.0)&(phierr > 0.0)&(amperr < 0.1)&(phierr < 60));
2557a2558
> extern extra
" > mira.patch
patch -i mira.patch mira.i
cd ..
./configure
make install
echo -e "Moving MIRA files into yorick directory..."
mv -f -v src/*.i ${INSTALL_DIR}/i
echo -e "Done!\n"