1 | #!@SHELL@
|
---|
2 | #
|
---|
3 | # Performs an adaptive simulation with molecuilder
|
---|
4 |
|
---|
5 | exec_prefix="/mount/bespin/heber/workspace/ESPACK/bin/"
|
---|
6 | MOLECUILDER="$exec_prefix/molecuilder"
|
---|
7 | JOINER="$exec_prefix/joiner"
|
---|
8 | CRUNCHER="/mount/bespin/heber/build/mpqc-2.3.0/bin/mpqc"
|
---|
9 | CONVERTER="/mount/bespin/heber/tmp/mpqc/espack2mpqc.sh"
|
---|
10 | PREPARER="/mount/bespin/heber/tmp/mpqc/convertresults.sh"
|
---|
11 | SUFFIX="in"
|
---|
12 |
|
---|
13 | . ~/scripts/check
|
---|
14 |
|
---|
15 | if [ -z $3 ]; then
|
---|
16 | echo "Usage: $0 <config> <max. bond distance> <accuracy>"
|
---|
17 | echo "i.e. $0 test.conf 1.55 -5"
|
---|
18 | exit 1
|
---|
19 | else
|
---|
20 | config=$1
|
---|
21 | DIR=`dirname $config`
|
---|
22 | distance=$2
|
---|
23 | order=$3
|
---|
24 | fi
|
---|
25 |
|
---|
26 | returncode="0"
|
---|
27 | while [ "$returncode" -eq "0" ]; do # don't go higher than 6th order
|
---|
28 | # break down the molecule with molecuilder
|
---|
29 | echo -n "Fragmenting molecule $DIR adaptively ... "
|
---|
30 | $MOLECUILDER $config -e $exec_prefix -f $distance $order 2>/dev/null 1>/dev/null
|
---|
31 | returncode=$?
|
---|
32 | check $returncode
|
---|
33 |
|
---|
34 | if [ "$returncode" -eq "0" ]; then
|
---|
35 | # find maximum number of digits
|
---|
36 | digit=1
|
---|
37 | while [ ! -e "$DIR/BondFragment`printf "%0${digit}d" 0`.conf" ]; do
|
---|
38 | let digit=$digit+1
|
---|
39 | done
|
---|
40 | let digit=$digit+1
|
---|
41 | if [ -e "$DIR/BondFragment`printf "%0${digit}d" 0`.conf" ]; then
|
---|
42 | let lesser=$digit-1
|
---|
43 | echo "Shifting found fragments with $lesser digits to those with $digit digits ..."
|
---|
44 | #dirs
|
---|
45 | for file in $DIR/BondFragment`i=0;while [ $i -lt $lesser ]; do let i=$i+1; echo -n "?"; done`; do
|
---|
46 | mv $file ${file/Fragment/Fragment0}
|
---|
47 | done
|
---|
48 | #files
|
---|
49 | for file in $DIR/BondFragment`i=0;while [ $i -lt $lesser ]; do let i=$i+1; echo -n "?"; done`.*; do
|
---|
50 | mv $file ${file/Fragment/Fragment0}
|
---|
51 | done
|
---|
52 | else
|
---|
53 | let digit=$digit-1
|
---|
54 | fi
|
---|
55 | echo "Found $digit digits."
|
---|
56 |
|
---|
57 | # evaluate each fragment
|
---|
58 | dir=`pwd`
|
---|
59 | cd $DIR
|
---|
60 | j=0;
|
---|
61 | while [ -e "BondFragment`printf "%0${digit}d" $j`.conf" ]; do
|
---|
62 | name="BondFragment`printf "%0${digit}d" $j`"
|
---|
63 | if [ ! -e "$name.out" ]; then # if not evaluated yet
|
---|
64 | echo -n "Converting $name.conf ..."
|
---|
65 | sh $CONVERTER "$name.conf"
|
---|
66 | check
|
---|
67 | #/opt/packages/mpichgm-1.2.7..15/bin/mpirun.ch_gm -machinefile $PBS_NODEFILE -np 8 /mount/bespin/heber/workspace/espack/pcp/bin/pcp -v -a 86000 $DIR/BondFragment`printf "%0${digit}d" $j`.conf
|
---|
68 |
|
---|
69 | if [ -e "$name.$SUFFIX" ]; then
|
---|
70 | echo -n "Evaluating $name.$SUFFIX ..."
|
---|
71 | $CRUNCHER "$name.$SUFFIX" >"$name.out"
|
---|
72 | check
|
---|
73 | fi
|
---|
74 | fi
|
---|
75 | let j=$j+1
|
---|
76 | done
|
---|
77 | cd $dir
|
---|
78 | echo "Evaluated $j fragments."
|
---|
79 |
|
---|
80 | # join the resulting energies into a single file and create EnergyPerFragment file
|
---|
81 | echo -n "Preparing results ..."
|
---|
82 | sh $PREPARER $DIR
|
---|
83 | check
|
---|
84 | echo -n "Joining energies ..."
|
---|
85 | $JOINER $DIR/ pcp >/dev/null
|
---|
86 | check
|
---|
87 | else
|
---|
88 | echo "Desired accuracy of 10^$order reached."
|
---|
89 | fi
|
---|
90 | # returncode=1
|
---|
91 | done
|
---|
92 |
|
---|