-
Notifications
You must be signed in to change notification settings - Fork 2
/
startepsr
executable file
·68 lines (57 loc) · 2.55 KB
/
startepsr
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
#!/bin/bash
# ---------------------------------------------------- #
# #
# Script to launch EPSRshell in a specific directory #
# Based on original script from EPSR25 distribution #
# #
# Set EPSRDIR to the full path of the main EPSR folder #
# #
# ---------------------------------------------------- #
EPSRDIR=${EPSRDIR:-"/opt/EPSR25/EPSR"}
echo "EPSR main directory is: ${EPSRDIR}"
# ---------------------------------------------------- #
# Derive locations for installed bin and startup directories
export EPSRbin="$EPSRDIR/bin"
export EPSRstartup="$EPSRDIR/startup"
# We will not assume any root folder (EPSRroot) which originally was EPSRbin/run.
# Instead, the first command line parameter should be absolute or relative path to the simulation folder of interest
# So, was an argument supplied?
if [ $# -eq 0 ]; then
echo "Error: Please supply the path to your simulation."
echo " e.g. startepsr ./ (simulation is in current working directory)"
echo " e.g. startepsr cyclohexane (no path, simulation directory is in current directory)"
echo " e.g. startepsr ./cyclohexane (equivalent to above)"
echo " e.g. startepsr /home/tris/simulations/crystal (absolute path to simulation)"
exit 1
else
# Path supplied - is it relative or absolute?
if [[ "$1" = /* ]]; then
# Absolute path - keep as is
export EPSRrun=$1
else
# Relative path - convert to absolute path
export EPSRrun=`pwd`/$1
fi
fi
# Does the supplied directory exist? If not, create it
if [ ! -e "$EPSRrun" ]; then
mkdir $EPSRrun
fi
# Check that the specified folder has plot_defaults.txt. If not then copy a version in.
if [ ! -e "$EPSRrun"/plot_defaults.txt ]; then
cp "$EPSRstartup"/plot_defaults.txt "$EPSRrun"/plot_defaults.txt
fi
# Change to simulation directory, copy necessary files and run epsrshell
# Once finished, can't copy gnuatoms.txt and gnubonds.txt back, since the user doesn't own /opt/EPSR25
OLDDIR=`pwd`
cd "$EPSRrun"
cp "$EPSRstartup"/system_commands_linux.txt system_commands.txt
cp "$EPSRstartup"/gnuatoms.txt gnuatoms.txt
cp "$EPSRstartup"/gnubonds.txt gnubonds.txt
cp "$EPSRstartup"/f0_WaasKirf.dat f0_WaasKirf.dat
"$EPSRbin"/epsrshell
#cp gnuatoms.txt "$EPSRstartup"/gnuatoms.txt
#cp gnubonds.txt "$EPSRstartup"/gnubonds.txt
# All done. Switch back to original directory and exit
cd $OLDDIR
exit 0