-
Notifications
You must be signed in to change notification settings - Fork 8
/
setup_nmssmtools.sh
executable file
·140 lines (121 loc) · 3.52 KB
/
setup_nmssmtools.sh
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
#!/bin/sh
# directory of this script
BASEDIR=$(dirname $0)
# absolute path to this script
ABSBASEDIR=$(cd $BASEDIR; pwd)
enable_compile_nmssmtools=no
nmssmtools_dir=""
usage() {
cat <<EOF
Usage: ./`basename $0` [options]
Options:
--compile|-c compile NMSSMTools
--nmssmtools-dir= Path to NMSSMTools
--help|-h Print this message and exit
EOF
}
check_nmssmtools() {
if test "x${nmssmtools_dir}" = "x"; then
echo "Error: No NMSSMTools directory specified!"
echo " Please run with --nmssmtools-dir=/path/to/NMSSMTools"
exit 1
fi
if ! test -d "${nmssmtools_dir}"; then
echo "Error: Cannot find NMSSMTools directory \"${nmssmtools_dir}\""
exit 1
fi
if ! test -r "${nmssmtools_dir}/main/Makefile"; then
echo "Error: ${nmssmtools_dir}/main/Makefile does not exist."
exit 1
fi
if ! test -r "${nmssmtools_dir}/main/nmspec.f"; then
echo "Error: ${nmssmtools_dir}/main/nmspec.f does not exist."
exit 1
fi
}
create_run_script() {
printf "Creating NMSSMTools run script ..."
sed -e "s|@NMSSMTOOLS_PATH@|$nmssmtools_dir|" \
< ${BASEDIR}/softsusy_nmssmtools.x.in > ${BASEDIR}/softsusy_nmssmtools.x
if test "x$?" = "x0"; then
echo " done"
else
echo " Error: could non create softsusy_nmssmtools.x"
exit 1
fi
chmod +x ${BASEDIR}/softsusy_nmssmtools.x
}
copy_file() {
if test $# -ne 2 ; then
echo "Internal error: copy_file not called with two arguments"
fi
if test -r "$2"; then
printf "Backup file $2 to $2~ ..."
if cp "$2" "$2~"; then
echo " done"
else
echo " failed"
exit 1
fi
fi
printf "Copying $1 to $2 ..."
if cp "$1" "$2"; then
echo " done"
else
echo " failed"
exit 1
fi
}
copy_files() {
copy_file ${BASEDIR}/src/nmh_slhainp.f ${nmssmtools_dir}/main/nmh_slhainp.f
copy_file ${BASEDIR}/Makefile.nmssmtools ${nmssmtools_dir}/main/Makefile
}
compile_nmssmtools() {
printf "Compiling NMSSMTools ..."
$(cd ${nmssmtools_dir} && make init > ${ABSBASEDIR}/make.nmssmtools 2>&1 && make >> ${ABSBASEDIR}/make.nmssmtools 2>&1)
if test "x$?" = "x0"; then
echo " done"
else
echo " error"
exit 1
fi
}
if test $# -gt 0 ; then
while test ! "x$1" = "x" ; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case "$1" in
--compile|-c) enable_compile_nmssmtools=yes ;;
--nmssmtools-dir=*) nmssmtools_dir="$optarg" ;;
--help|-h) usage; exit 0 ;;
*) echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;;
esac
shift
done
fi
check_nmssmtools
copy_files
if test "x${enable_compile_nmssmtools}" = "xyes"; then
compile_nmssmtools
fi
create_run_script
echo ""
echo "====================="
echo "Finished successfully"
echo "====================="
if ! test "x${enable_compile_nmssmtools}" = "xyes"; then
echo ""
echo "Next steps: recompile NMSSMTools"
echo " $ cd ${nmssmtools_dir}"
echo " $ make init"
echo " $ make"
echo ""
echo "Afterwards you can call softsusy_nmssmtools.x to calculate decays:"
echo " $ ./softsusy_nmssmtools.x leshouches < slha-input-file"
else
echo ""
echo "Now you can call softsusy_nmssmtools.x to calculate decays:"
echo " $ ./softsusy_nmssmtools.x leshouches < slha-input-file"
fi