forked from MQCPack/mqcPack
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmqc_script
More file actions
executable file
·616 lines (586 loc) · 20.6 KB
/
Copy pathmqc_script
File metadata and controls
executable file
·616 lines (586 loc) · 20.6 KB
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
#! /bin/bash
# To debug:#! /bin/bash -x
# Choose the FORTRAN to use.
# configure will use the FC environment variable for this.
export MQC_HOME="`pwd`"
mqc_tmpfile="${MQC_HOME}/.other_libs/build_fcns/tmp"
cd ${MQC_HOME}
#
# Regenerate the conventional Autotools outputs when their tracked inputs are
# newer or the generated support files are absent.
#
chmod 755 ${MQC_HOME}/.other_libs/build_fcns/chmod_all ${MQC_HOME}/.other_libs/build_fcns/cp_all ${MQC_HOME}/.other_libs/build_fcns/rm_all ${MQC_HOME}/.other_libs/build_fcns/remove_Gau_pid ${MQC_HOME}/.other_libs/build_fcns/remove_SCRDIR > ${mqc_tmpfile} 2>&1
if [ ! -f test-driver ] ||
[ ! -f install-sh ] ||
[ ! -f missing ] ||
[ ! -f depcomp ] ||
[ ! -f configure ] ||
[ ! -f Makefile.in ] ||
[ ! -f src/Makefile.in ] ||
[ ! -f examples/Build_Tests/Makefile.in ] ||
[ configure.ac -nt configure ] ||
[ Makefile.am -nt Makefile.in ] ||
[ examples/Build_Tests/Makefile.am -nt examples/Build_Tests/Makefile.in ] ||
[ src/Makefile.am -nt src/Makefile.in ]; then
if [ -f Makefile ]; then
make clean > ${mqc_tmpfile} 2>&1
fi
cd ${MQC_HOME}/src
${MQC_HOME}/.other_libs/build_fcns/rm_all .mod > ${mqc_tmpfile} 2>&1
cd ${MQC_HOME}
rm -rf autom4te.cache > ${mqc_tmpfile} 2>&1
autoreconf --install --force
fi
#
# Should we add MatrixFile ability to the MQCPack library?
#
echo "MatrixFile specific information"
echo ""
echo "MQCPack requires GauOpen to process MatrixFiles."
echo "(If you don't have it there are instructions"
echo "on how to obtain it below.)"
echo ""
MQC_Use_GauOpen="g"
while [ "$MQC_Use_GauOpen" = "g" ]
do
echo "Do you want to use and test the MatrixFile interface to MQCPack? [y or n]:"
read -n 1 INTERFACE
echo ""
if [ "$INTERFACE" = "y" ]; then
MQC_Use_GauOpen="y"
elif [ "$INTERFACE" = "n" ]; then
MQC_Use_GauOpen="n"
fi
done
export FC="g"
while [ "$FC" = "g" ]
do
echo "Please select a compiler. The case insenstive available options are:"
echo " G - GNU compilers (gfortran/gcc) "
echo " I - Intel compilers (ifort/icc) "
echo " N - NVidia compilers (nvfortran/gcc)"
read -n 1 MQC_Compiler
echo ""
if [ "${MQC_Compiler}" = "G" ] || [ "${MQC_Compiler}" = "g" ]; then
path_to_executable="`command -v gcc`"
if [ -x "${path_to_executable}" ] ; then
export CC="gcc"
path_to_executable="`command -v gfortran`"
if [ -x "${path_to_executable}" ] ; then
export FC="gfortran"
if [ "${Isize}" = "8" ]; then
MQC_INTEGER_Compiler_Flag="-fdefault-integer-8"
else
MQC_INTEGER_Compiler_Flag=" "
fi
MQC_Compiler="GNU"
else
echo "gfortran not found in path"
echo "Cannot use GNU option. gfortran not found in path"
fi
else
echo "gcc not found in path"
echo "Cannot use GNU option. gcc not found in path"
fi
elif [ "${MQC_Compiler}" = "N" ] || [ "${MQC_Compiler}" = "n" ]; then
export CC="g"
path_to_executable="`command -v gcc`"
if [ -x "${path_to_executable}" ] ; then
export CC="gcc"
else
echo "gcc not found in path"
path_to_executable="`command -v gcc`"
# if [ -x "${path_to_executable}" ] ; then
# export CC="gcc"
# echo "gcc will be used"
# else
# echo "Neither pgcc nor gcc found in path."
# echo "Not finding a C compiler in path."
# echo "Please fix path before you retry installing MQCPath"
# exit 1
# fi
echo "gcc not found in path."
echo "Not finding a C compiler in path."
echo "Please fix path before you retry installing MQCPath"
exit 1
fi
if [ "$CC" != "g" ]; then
path_to_executable="`command -v pgfortran`"
if [ -x "${path_to_executable}" ] ; then
export FC="pgfortran"
MQC_Compiler="NVidia"
if [ "${Isize}" = "8" ]; then
MQC_INTEGER_Compiler_Flag="-i8"
else
MQC_INTEGER_Compiler_Flag=" "
fi
else
echo "Cannot use NVidia option: nvfortran not found in path"
fi
fi
elif [ "${MQC_Compiler}" = "I" ] || [ "${MQC_Compiler}" = "i" ]; then
export CC="g"
path_to_executable="`command -v icc`"
if [ -x "${path_to_executable}" ] ; then
export CC="icc"
else
echo "pgcc not found in path"
path_to_executable="`command -v gcc`"
if [ -x "${path_to_executable}" ] ; then
export CC="gcc"
echo "icc not found. gcc will be used"
else
echo "Neither icc nor gcc found in path."
echo "Not finding a C compiler in path."
echo "Please fix path before you retry installing MQCPath"
exit 1
fi
fi
if [ "$CC" != "g" ]; then
path_to_executable="`command -v ifort`"
if [ -x "${path_to_executable}" ] ; then
export FC="ifort"
MQC_Compiler="Intel"
if [ "${Isize}" = "8" ]; then
MQC_INTEGER_Compiler_Flag="-integer-size 64"
else
MQC_INTEGER_Compiler_Flag=" "
fi
else
echo "Cannot use Intel option. ifort not found in path"
fi
fi
elif [ "${FC}" = "no" ]; then
echo ""
echo "Please specify either GNU or NVidia"
echo ""
fi
done
MQC_CLEAN="0"
chmod 755 install-sh
if [ -f ${MQC_HOME}/.other_libs/build_fcns/default_COMPILER ] &&
[ "`cat ${MQC_HOME}/.other_libs/build_fcns/default_COMPILER`" != "${MQC_Compiler}" ]; then
MQC_CLEAN="1"
elif [ -f ${MQC_HOME}/.other_libs/build_fcns/default_GauOpen ] &&
[ "`cat ${MQC_HOME}/.other_libs/build_fcns/default_GauOpen`" != "${MQC_Use_GauOpen}" ]; then
MQC_CLEAN="1"
fi
if [ "${MQC_CLEAN}" != "0" ]; then
echo ""
echo "Cleaning objects and module files."
echo ""
make clean > ${mqc_tmpfile} 2>&1
cd ${MQC_HOME}/src
${MQC_HOME}/.other_libs/build_fcns/rm_all .mod > ${mqc_tmpfile} 2>&1
${MQC_HOME}/.other_libs/build_fcns/rm_all .o > ${mqc_tmpfile} 2>&1
cd ${MQC_HOME}/examples/Build_Tests > ${mqc_tmpfile} 2>&1
${MQC_HOME}/.other_libs/build_fcns/rm_all .o > ${mqc_tmpfile} 2>&1
cd ${MQC_HOME}
fi
echo "${MQC_Use_GauOpen}" > ${MQC_HOME}/.other_libs/build_fcns/default_GauOpen
echo "${MQC_Compiler}" > ${MQC_HOME}/.other_libs/build_fcns/default_COMPILER
#
# configure always wants a directory where users can find software later.
# This just allows you to do this.
#
MQC_TEST="g"
export MQC_INSTALLATIONDIR="Not set"
while [ "$MQC_TEST" = "g" ]
do
if [ -f ${MQC_HOME}/.other_libs/build_fcns/default ]; then
echo "Please enter the desired Installation Directory"
echo "[default: `cat ${MQC_HOME}/.other_libs/build_fcns/default`]?"
else
echo "Please enter the desired Installation Directory"
echo "[default: /usr/local]?"
fi
read MQC_InstallationDir
if [ "${MQC_InstallationDir}a" = "a" ]; then
if [ -f ${MQC_HOME}/.other_libs/build_fcns/default ]; then
MQC_InstallationDir="`cat ${MQC_HOME}/.other_libs/build_fcns/default`"
else
MQC_InstallationDir="/usr/local"
fi
fi
if [[ ${MQC_InstallationDir:0:1} == "~" ]]; then
MQC_InstallationDir="`echo "${MQC_InstallationDir:1:${#MQC_InstallationDir}-1}"`"
MQC_InstallationDir="${HOME}${MQC_InstallationDir}"
fi
[ ! -d ${MQC_InstallationDir} ] && mkdir ${MQC_InstallationDir} > ${mqc_tmpfile} 2>&1
[ ! -d ${MQC_InstallationDir}/${MQC_Compiler} ] && mkdir ${MQC_InstallationDir}/${MQC_Compiler} > ${mqc_tmpfile} 2>&1
[ ! -d ${MQC_InstallationDir}/${MQC_Compiler}/lib ] && mkdir ${MQC_InstallationDir}/${MQC_Compiler}/lib > ${mqc_tmpfile} 2>&1
[ ! -d ${MQC_InstallationDir}/${MQC_Compiler}/mod ] && mkdir ${MQC_InstallationDir}/${MQC_Compiler}/mod > ${mqc_tmpfile} 2>&1
if [ ! -d ${MQC_InstallationDir} ]; then
echo "Failed to create "${MQC_InstallationDir}
elif [ ! -d ${MQC_InstallationDir}/${MQC_Compiler} ]; then
echo "Failed to create "${MQC_InstallationDir}/${MQC_Compiler}
elif [ ! -d ${MQC_InstallationDir}/${MQC_Compiler}/lib ]; then
echo "Failed to create "${MQC_InstallationDir}/${MQC_Compiler}/lib
elif [ ! -d ${MQC_InstallationDir}/${MQC_Compiler}/mod ]; then
echo "Failed to create "${MQC_InstallationDir}/${MQC_Compiler}/mod
else
if [ ! -w ${MQC_InstallationDir} ]; then
echo "Cannot write to ${MQC_InstallationDir}"
elif [ ! -r ${MQC_InstallationDir} ]; then
echo "Cannot read from ${MQC_InstallationDir}"
elif [ ! -w ${MQC_InstallationDir}/${MQC_Compiler} ]; then
echo "Cannot write to ${MQC_InstallationDir}/${MQC_Compiler}"
elif [ ! -r ${MQC_InstallationDir}/${MQC_Compiler} ]; then
echo "Cannot read from ${MQC_InstallationDir}/${MQC_Compiler}"
elif [ ! -w ${MQC_InstallationDir}/${MQC_Compiler}/lib ]; then
echo "Cannot write to ${MQC_InstallationDir}/${MQC_Compiler}/lib"
elif [ ! -r ${MQC_InstallationDir}/${MQC_Compiler}/lib ]; then
echo "Cannot read from ${MQC_InstallationDir}/${MQC_Compiler}/lib"
elif [ ! -w ${MQC_InstallationDir}/${MQC_Compiler}/mod ]; then
echo "Cannot write to ${MQC_InstallationDir}/${MQC_Compiler}/mod"
elif [ ! -r ${MQC_InstallationDir}/${MQC_Compiler}/mod ]; then
echo "Cannot read from ${MQC_InstallationDir}/${MQC_Compiler}/mod"
else
MQC_TEST="y"
export MQC_INSTALLATIONDIR="${MQC_InstallationDir}/${MQC_Compiler}"
fi
fi
done
echo ${MQC_InstallationDir} > ${MQC_HOME}/.other_libs/build_fcns/default 2>&1
#
# Need to link with the BLAS library. The following section of script
# is where the installer to defines how to link the BLAS in for our tests.
# It also tests that the BLAS library has been correctly defined, so that
# a typo here doesn't cause problems cause problems when we test MQCPack.
#
echo ""
echo "MQCPack requires the BLAS library."
echo ""
cd ${MQC_HOME}/.other_libs/BLAS
MQC_OLD_BLAS="g"
while [ "${MQC_OLD_BLAS}" = "g" ]
do
if [ -f ${MQC_HOME}/.other_libs/BLAS/default ]; then
echo "Please enter how you would link BLAS when building an"
echo "executable [default: `cat ${MQC_HOME}/.other_libs/BLAS/default`]:"
else
echo "Please enter how you would link BLAS into an executable:"
fi
read MQC_BLAS
if [ "${MQC_BLAS}a" = "a" ]; then
if [ -f ${MQC_HOME}/.other_libs/BLAS/default ]; then
MQC_BLAS="`cat ${MQC_HOME}/.other_libs/BLAS/default`"
else
echo "There is no default choice"
fi
fi
${FC} ${MQC_INTEGER_Compiler_Flag} test_blas_lib.f03 ${MQC_BLAS} > blas.err 2>&1
if [ -f a.out ]; then
MQC_OLD_BLAS="y"
rm -f a.out
echo "${MQC_BLAS}" > default 2>&1
else
echo "Warning: Problem when trying a test link with BLAS."
echo "The Link line is:"
echo ""
echo "${FC} ${MQC_INTEGER_Compiler_Flag} test_blas_lib.f03 ${MQC_BLAS}"
echo ""
echo "The error message is the next `wc -l < blas.err` lines"
cat blas.err
echo ""
echo "Try entering the full path such as"
echo "'/usr/lib/blas_LINUX.a'"
echo "If you do not have BLAS, you can get it by "
echo "downloading from this site:"
echo " http://www.netlib.org/blas/"
echo "Then you will have to:"
echo " - make all"
echo "When the build is finished, please enter the directory"
echo "and hit return again"
fi
done
cd ${MQC_HOME}
#
# Need to link with the LAPACK library. The following section of script
# is where the installer to defines how to link the LAPACK in for our tests.
# It also tests that the LAPACK library has been correctly defined, so that
# a typo here doesn't cause problems cause problems when we test MQCPack.
#
echo ""
echo "MQCPack requires the LAPACK library."
echo ""
cd ${MQC_HOME}/.other_libs/LAPACK
MQC_OLD_LAPACK="g"
while [ "${MQC_OLD_LAPACK}" = "g" ]
do
if [ -f default ]; then
echo "Please enter how you would link LAPACK when building an"
echo "executable [default: `cat ./default`]:"
else
echo "Please enter how you would link LAPACK when building an"
echo "executable [default: `cat ../BLAS/default`]:"
fi
read MQC_LAPACK
if [ "${MQC_LAPACK}a" = "a" ]; then
if [ -f default ]; then
MQC_LAPACK="`cat default`"
else
MQC_LAPACK="`cat ../BLAS/default`"
fi
fi
${FC} ${MQC_INTEGER_Compiler_Flag} test_lapack_lib.f03 ${MQC_LAPACK} ${MQC_BLAS} > lapack.err 2>&1
if [ -f a.out ]; then
MQC_OLD_LAPACK="y"
rm -f a.out
echo "${MQC_LAPACK}" > default 2>&1
else
echo "Warning: Problem when trying a test link with LAPACK."
echo "The Link line is:"
echo ""
echo "${FC} ${MQC_INTEGER_Compiler_Flag} test_lapack_lib.f03 ${MQC_LAPACK} ${MQC_BLAS}"
echo ""
echo "The error message is the next `wc -l < lapack.err` lines"
cat lapack.err
echo ""
echo "Try entering '-L{LAPACK Directory} -l{LAPACK Library}' such as"
echo "'-L/usr/lib -llapack' or the full path such as"
echo "'/usr/lib/liblapack.a'"
echo "If you do not have LAPACK, you can get it by "
echo "downloading from this site:"
echo " http://www.netlib.org/lapack/"
echo "Then you will have to:"
echo " - Create make.inc (see make.inc.example)"
echo " - make"
echo "When your finish the build, please enter the directory"
echo "and hit return again"
fi
done
# Remove the library so it contains only the objects selected by configure.
rm -f ${MQC_HOME}/src/libmqc.a
if [ "${MQC_Use_GauOpen}" = "y" ]; then
#
# Find the external, unmodified GauOpen sources. Configure and make compile
# these files directly with their dependency-specific legacy flags.
#
MQC_GAUOPEN_SOURCES_FOUND="n"
while [ "${MQC_GAUOPEN_SOURCES_FOUND}" = "n" ]
do
if [ -f ${MQC_HOME}/.other_libs/gauopen/default ]; then
echo "Enter the path to the gauopen directory"
echo " [default: `cat ${MQC_HOME}/.other_libs/gauopen/default`]:"
else
echo "Enter the path to the gauopen directory:"
fi
read MQC_GAUOPEN_DIR
if [ "${MQC_GAUOPEN_DIR}a" = "a" ]; then
if [ -f ${MQC_HOME}/.other_libs/gauopen/default ]; then
MQC_GAUOPEN_DIR="`cat ${MQC_HOME}/.other_libs/gauopen/default`"
fi
fi
if [ -f "${MQC_GAUOPEN_DIR}/qcmatrixio.F" ] &&
[ -f "${MQC_GAUOPEN_DIR}/qcmatrix.F" ]; then
MQC_GAUOPEN_SOURCES_FOUND="y"
echo "${MQC_GAUOPEN_DIR}" > ${MQC_HOME}/.other_libs/gauopen/default
else
echo ""
echo "The GauOpen directory must contain qcmatrixio.F and qcmatrix.F."
echo "If you need to get gauopen:"
echo " - Go to http://gaussian.com/interfacing/"
echo " - Choose the Download tab"
echo " - Choose to Download"
echo ""
fi
done
fi
cd ${MQC_HOME}
#
# Now build the MQCPack library.
#
chmod 755 ./configure > ${mqc_tmpfile} 2>&1
if [ "${MQC_Use_GauOpen}" = "y" ]; then
MQC_CONFIGURE_GAUOPEN_ARGS=(
"--with-gauopen=${MQC_GAUOPEN_DIR}"
"--with-gauopen-integer-bytes=8"
)
else
MQC_CONFIGURE_GAUOPEN_ARGS=("--without-gauopen")
fi
./configure --prefix=${MQC_INSTALLATIONDIR} \
"${MQC_CONFIGURE_GAUOPEN_ARGS[@]}" --silent
make MQC_LAPACK=${MQC_LAPACK} MQC_BLAS=${MQC_BLAS}
stat=$?
if [ $stat -ne 0 ] ; then
echo "Failure to build"
exit $stat
fi
echo "Congratulations! The libmqc is built!"
MQC_BUILD_DOC="g"
while [ "$MQC_BUILD_DOC" = "g" ]
do
echo "Do you want to build the documentation for MQC? [y or n]:"
read -n 1 INTERFACE
echo ""
if [ "$INTERFACE" = "y" ]; then
MQC_BUILD_DOC="y"
elif [ "$INTERFACE" = "n" ]; then
MQC_BUILD_DOC="n"
fi
done
if [ "${MQC_BUILD_DOC}" = "y" ]; then
command -v doxygen >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo >&2 "MQCPck requires Doxygen to build documentation but it's not installed. Skipping."
else
( cat ${MQC_HOME}/doc/Doxyfile ; echo "QUIET=YES" ) | doxygen -
stat=$?
if [ $stat -ne 0 ]; then
echo "Doxygen failed to build documentation"
exit $stat
else
echo "Doxygen built documentation"
fi
fi
fi
#
# Some of the tests run Gaussian. Find out if the installer wants to run
# these tests.
#
MQC_RUN_GAU="g"
while [ "$MQC_RUN_GAU" = "g" ]
do
echo "Do you want to execute the tests that run Gaussian calculations? [y or n]:"
read -n 1 INTERFACE
echo ""
if [ "$INTERFACE" = "y" ]; then
MQC_RUN_GAU="y"
elif [ "$INTERFACE" = "n" ]; then
MQC_RUN_GAU="n"
fi
done
if [ "${MQC_RUN_GAU}" = "y" ]; then
#
# Setup to run Gaussian.
#
echo ""
echo "Specify the Gaussian binary to use [default: g16]"
read INTERFACE
if [ "${INTERFACE}a" = "a" ]; then
export GAU_BINARY="g16"
else
export GAU_BINARY="${INTERFACE}"
fi
MQC_tmpfile_tmp="/tmp/Invoke_$BASHPID"
MQC_tmpfile="${MQC_HOME}/.other_libs/gaussian/default"
path_to_executable="`command -v ${GAU_BINARY}`"
while [ ! -x "${path_to_executable}" ]
do
echo "Specify how to get the Gaussian environment from the BASH shell."
echo "You MUST enter many lines. The final line MUST be blank."
if [ -f ${MQC_HOME}/.other_libs/gaussian/default ]; then
echo "[enter a blank line to get default:"
echo "`cat ${MQC_HOME}/.other_libs/gaussian/default`"
echo ""
echo "]:"
else
echo "for example:"
echo "export g16root=/opt"
echo ". ${g16root}/g16/bsd/g16.profile"
echo ""
fi
read INTERFACE
if [ "${INTERFACE}a" = "a" ]; then
MQC_tmpfile="${MQC_HOME}/.other_libs/gaussian/default"
else
MQC_tmpfile="${MQC_tmpfile_tmp}"
echo "${INTERFACE}" > ${MQC_tmpfile}
while [ "${INTERFACE}a" != "a" ]
do
read INTERFACE
echo "${INTERFACE}" >> ${MQC_tmpfile}
done
fi
. ${MQC_tmpfile}
path_to_executable="`command -v ${GAU_BINARY}`"
done
if [ "${MQC_tmpfile}" != "${MQC_HOME}/.other_libs/gaussian/default" ]; then
mv ${MQC_tmpfile} ${MQC_HOME}/.other_libs/gaussian/default
elif [ -f ${MQC_tmpfile_tmp} ] ; then
rm -f ${MQC_tmpfile_tmp}
fi
#
# If the Gaussian scratch directory has not been specified, specify it now.
#
if [ "${GAUSS_SCRDIR}a" != "a" ]; then
if [ ! -d "${GAUSS_SCRDIR}" ]; then
echo "${GAUSS_SCRDIR} does not exist. Please enter an existing directory."
export GAUSS_SCRDIR="Not set"
elif [ ! -w "${GAUSS_SCRDIR}" ]; then
echo "${GAUSS_SCRDIR} is not writable. Please enter a writable directory."
export GAUSS_SCRDIR="Not set"
elif [ ! -r "${GAUSS_SCRDIR}" ]; then
echo "${GAUSS_SCRDIR} is not readable. Please enter a readable directory."
export GAUSS_SCRDIR="Not set"
fi
else
export GAUSS_SCRDIR="Not set"
fi
while [ "${GAUSS_SCRDIR}" = "Not set" ]
do
if [ -f ${MQC_HOME}/.other_libs/gaussian/default_scratch ]; then
echo "Please enter the scratch directory for Gaussian"
echo "[default:`cat ${MQC_HOME}/.other_libs/gaussian/default_scratch`]:"
else
echo "Please enter the scratch directory for Gaussian:"
fi
read INTERFACE
if [ "${INTERFACE}a" == "a" ]; then
INTERFACE="`cat ${MQC_HOME}/.other_libs/gaussian/default_scratch`"
fi
if [ ! -d "${INTERFACE}" ]; then
echo "${INTERFACE} does not exist. Please enter an existing directory."
elif [ ! -w "${INTERFACE}" ]; then
echo "${INTERFACE} is not writable. Please enter a writable directory."
elif [ ! -r "${INTERFACE}" ]; then
echo "${INTERFACE} is not readable. Please enter a readable directory."
else
export GAUSS_SCRDIR="$INTERFACE"
fi
done
echo "Gaussian scratch directory is: ${GAUSS_SCRDIR}"
# Save the working GAUSS_SCRDIR for use as default next time
echo ${GAUSS_SCRDIR} > ${MQC_HOME}/.other_libs/gaussian/default_scratch 2>&1
# Use the script that will run Gaussian
rm -f ${MQC_HOME}/examples/DataSummary/testit.sh ${MQC_HOME}/examples/PrintAllData/testit.sh ${MQC_HOME}/examples/SCFenergy/testit.sh
ln -s ${MQC_HOME}/examples/DataSummary/testit_runGau.sh ${MQC_HOME}/examples/DataSummary/testit.sh
ln -s ${MQC_HOME}/examples/PrintAllData/testit_runGau.sh ${MQC_HOME}/examples/PrintAllData/testit.sh
ln -s ${MQC_HOME}/examples/SCFenergy/testit_runGau.sh ${MQC_HOME}/examples/SCFenergy/testit.sh
else
# Use the script that will not run Gaussian
rm -f ${MQC_HOME}/examples/DataSummary/testit.sh ${MQC_HOME}/examples/PrintAllData/testit.sh ${MQC_HOME}/examples/SCFenergy/testit.sh
ln -s ${MQC_HOME}/examples/DataSummary/testit_no_runGau.sh ${MQC_HOME}/examples/DataSummary/testit.sh
ln -s ${MQC_HOME}/examples/PrintAllData/testit_no_runGau.sh ${MQC_HOME}/examples/PrintAllData/testit.sh
ln -s ${MQC_HOME}/examples/SCFenergy/testit_no_runGau.sh ${MQC_HOME}/examples/SCFenergy/testit.sh
fi
chmod 755 ${MQC_HOME}/examples/DataSummary/testit.sh > ${mqc_tmpfile} 2>&1
chmod 755 ${MQC_HOME}/examples/PrintAllData/testit.sh > ${mqc_tmpfile} 2>&1
chmod 755 ${MQC_HOME}/examples/SCFenergy/testit.sh > ${mqc_tmpfile} 2>&1
# These functions are required because BASH has a problem with '*'
${MQC_HOME}/.other_libs/build_fcns/chmod_all > ${mqc_tmpfile} 2>&1
#
# Now check the FCHK functionality in the MQCPack library.
#
echo "Now check the build"
make check MQC_LAPACK=${MQC_LAPACK} MQC_BLAS=${MQC_BLAS}
if [ $? -ne 0 ] ; then exit $? ; fi
#
# Done with the build and check of the FCHK functionality in the MQCPack library.
#
#
# Finally, install the library
#
cd ${MQC_HOME}
# /dev/null is not happy in this shell. Use a file
make install MQC_LAPACK=${MQC_LAPACK} MQC_BLAS=${MQC_BLAS} > make.install.log 2>&1
if [ $? -ne 0 ]
then
echo "Installation failure see make.install.log"
exit 1
fi
rm -f make.install.log
echo "Successfully Finished! with installation and testing"
exit