Conformation Sampling tutorial: factor of 2 in monitor.sh

From: Alexander Adams (xadams_at_umich.edu)
Date: Tue Feb 11 2020 - 13:24:21 CST

Hello all,

I was working through the Conformation Sampling NAMD tutorial
<https://www.ks.uiuc.edu/Training/Tutorials/namd/confsamp-tutorial/confsamp.pdf>
and
was confused by one of the included scripts. monitor.sh in the beus files
produces a file containing the exchange rates for each window, and I
believe calculates the rate with the following expression:
count[i]/(nr*nc/2). I understand this to be the number of exchange events
(read from the log file) divided by the total number of runs, divided again
by the number of copies (each of which can be exchanged after each run),
but I do not understand why there is an additional 1/2 in the denominator.
I have attached the monitor file and included it in this email. Thank you
in advance for your help.

#!/bin/bash
ni=4 # number of images
nc=5 # number of copies
log="../sample-output/job0.log" # if you are using the sample-output

grep EXCHANGING $log | awk -v ni=$ni -v nc=$nc '{
    count[$8]++
    nr=$6+1
}END{
    for(i=0;i<ni-1;i++) print i,count[i]/(nr*nc/2),nr
}' | sort -n | \
awk 'BEGIN{
    print "#image1 image2 rate(percentage)"
}{
    sum+=$2
    n++
    print $1,$1+1,100*$2
    nr=$3
}END{
    print "#avr",100*sum/n
    print "#runs",nr
}' > exchange.txt

Alexander Adams

-- 
University of Michigan, Ann Arbor
Ph.D. Candidate - Mayes Lab
College of Engineering - Chemical Engineering

This archive was generated by hypermail 2.1.6 : Fri Dec 31 2021 - 23:17:08 CST