Extended bell and const rate tests to multi-domain chains
[sawsim.git] / testing / const_rate / const_rate.sh
index 56ae14f9e48d8fdb3d232903e8eea09fc53145fa..baad49cc2ee85cde2400032f1cae86c66df85ccf 100755 (executable)
@@ -1,7 +1,9 @@
 #!/bin/bash
 #
-# Use a single hooke domain with a constant unfolding rate, so unfolding force
-# is proportional to time, and we expect an exponential population decay.
+# Use a single hooke domain with a constant unfolding rate, so
+# unfolding force is proportional to time, and connect multiple
+# identical constant unfolding domains.  We expect an exponential
+# population decay.
 #
 # e.g.
 #   spring constant k=df/dx      \__
 #   so histogram of unfolding vs. force p(F) normalized to p(0)=1 should follow
 #     -binwidth N0 dp/dF = binwidth N0 pK/kv = binwidth N0 K/kv exp(-FK/kv)
 #
-#   test with lots of runs of
-#     sawsim -v1 -mhooke -a1 -kconst -K1 -F1
-#   which is not a problem, because 200 runs of that takes ~1 second:
-#     time xtimes 200 sawsim -v1 -mhooke -a1 -kconst -K1 -F1 > /dev/null
-#
-# usage: const_rate.sh <velocity> <spring_constant> <unfolding_rate>
+# usage: const_rate.sh <num_domains> <velocity> <spring_constant> <unfolding_rate>
 
-if [ $# -ne 3 ]
+if [ $# -ne 4 ]
 then
-    echo "usage: const_rate.sh <velocity> <spring_constant> <unfolding_rate>"
+    echo "usage: $0 <num_domains> <velocity> <spring_constant> <unfolding_rate>"
     exit 1
 fi
 
-V=$1
-K=$2
-RATE=$3
+NDOM=$1
+V=$2
+K=$3
+RATE=$4
 DEBUG=0
 
 # since we're on the cluster, we'll go crazy and get really good statistics ;)
@@ -36,16 +34,16 @@ N=10000
 df=`python -c "print 0.1/$RATE"`
 
 SAWSIM=../../bin/sawsim
-DATA=const_rate_${V}_${K}_$RATE.d
-HIST=const_rate_${V}_${K}_$RATE.hist
-COMPFILE=const_rate_${V}_${K}_$RATE.compare
-GPFILE=const_rate_${V}_${K}_$RATE.gp
-PNGFILE=const_rate_${V}_${K}_$RATE.png
+DATA=const_rate_${NDOM}_${V}_${K}_${RATE}.d
+HIST=const_rate_${NDOM}_${V}_${K}_${RATE}.hist
+COMPFILE=const_rate_${NDOM}_${V}_${K}_${RATE}.compare
+GPFILE=const_rate_${NDOM}_${V}_${K}_${RATE}.gp
+PNGFILE=const_rate_${NDOM}_${V}_${K}_${RATE}.png
 
 # set up the theory
 # our predicted histogram (see notes above) is
 #  hist(F) = binwidth N0 K/kv exp(-FK/kv) = A exp(F/B)
-theoryA=`python -c "print $df*$N*$RATE/float($K*$V)"`
+theoryA=`python -c "print $df*$N*$NDOM*$RATE/float($K*$V)"`
 theoryB=`python -c "print float(-$K*$V)/$RATE"`
 THEORY_FN="$theoryA * exp(x / ($theoryB))"
 
@@ -54,26 +52,24 @@ THEORY_FN="$theoryA * exp(x / ($theoryB))"
 > $DATA
 if [ "$ISACLUSTER" -eq 1 ]
 then
-    # Sawsim <= 0.5
-    #qcmd "xtimes $N $SAWSIM -v$V -mhooke -a$K -kconst -K$RATE -F1 | grep -v '^#' >> $DATA"
     # Sawsim >= 0.6
-    qcmd xtimes $N $SAWSIM -v$V -s folded,hooke,$K -N1 -s unfolded,null \
+    qcmd xtimes $N $SAWSIM -v$V -s cantilever,hooke,$K -N1 \
+       -s folded,null -N$NDOM -s unfolded,null \
         -k folded,unfolded,const,$RATE -q folded \
         | grep -v '^#' | cut -f1 >> $DATA
 else
-    # Sawsim <= 0.5
-    #xtimes $N $SAWSIM -v$V -mhooke -a$K -kconst -K$RATE -F1 | grep -v '^#' >> $DATA
     # Sawsim >= 0.6
-    xtimes $N $SAWSIM -v$V -s folded,hooke,$K -N1 -s unfolded,null \
+    xtimes $N $SAWSIM -v$V -s cantilever,hooke,$K -N1 \
+       -s folded,null -N$NDOM -s unfolded,null \
         -k folded,unfolded,const,$RATE -q folded \
         | grep -v '^#' | cut -f1 >> $DATA
 fi
 
 # histogram the data
 if [ $DEBUG -eq 1 ]; then
-    echo "cat $DATA | stem_leaf -v-1 -b$df | sed 's/://' > $HIST"
+    echo "cat $DATA | stem_leaf -v-1 -b$df -c | sed 's/://' > $HIST"
 fi
-cat $DATA | stem_leaf -v-1 -b$df | sed 's/://' > $HIST
+cat $DATA | stem_leaf -v-1 -b$df -c | sed 's/://' > $HIST
 
 # fit the data to an exponential decay
 if [ $DEBUG -eq 1 ]; then