-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exec_threeD
59 lines (50 loc) · 1.21 KB
/
Exec_threeD
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
#!/bin/bash
#FILE: Exec_threeD
#DATE: 23 FEB 2004
#AUTH: G. E. Deschaines
#DESC: Execute threeD.exe with specified trajectory output file.
function remove_symlink
{
if [ -h TXYZ.OUT ]
then
rm -f ./TXYZ.OUT
fi
}
# Check command line parameters
if [ $# -lt 1 ] || [ $1 -lt 0 ] || [ $1 -gt 9999 ]
then
echo "usage: Exec_threeD ####"
echo "where: #### is a TXYZ.OUT file run number of the form"
echo " 0000 to 9999 inclusive."
exit -1
fi
run=$1
# Check if threeD executable file exists.
if [ ! -e ./bin/threeD.exe ]
then
echo "error: threeD.exe does not exist, but can be created"
echo " by running the Make_threeD shell script."
exit -1
fi
# Check if trajectory output file exists.
file="TXYZ.OUT.${run}"
if [ ! -e ./txyz/$file ]
then
echo "error: file ${file} does not exist."
exit -2
fi
# Create ./Ximg subdirectory is not present.
if [ ! -d ./Ximg ]
then
mkdir ./Ximg
fi
# Remove previous symbolic link TXYZ.OUT (if it exists) and
# create symbolic link to specified trajectory output file
# as TXYZ.OUT, which threeD loads.
remove_symlink
ln -s ./txyz/${file} ./TXYZ.OUT
# Initiate execution of threeD.
./bin/threeD.exe
# Remove symbolic link TXYZ.OUT.
remove_symlink
exit 0