Re: calculating replica exchange acceptance ratio

From: Chitrak Gupta (chgupta_at_mix.wvu.edu)
Date: Mon Jan 25 2016 - 09:51:48 CST

Hi Norman,

The history file columns look like this

100 0 300 -80595.06905838488
200 1 300 -80394.8947269207
300 1 300 -80396.61219236573
400 0 300 -80633.88125895151
500 0 300 -80446.22636982969
600 0 300 -80231.83412244706

I believe the ordering is Step #, Replica #, Temperature, Energy. Is that
what it used to be when you wrote the code?

Also, thanks for the explanation on the temperature. That makes sense now.

Regards,
Chitrak.

On Mon, Jan 25, 2016 at 5:21 PM, Norman Geist <
norman.geist_at_uni-greifswald.de> wrote:

> Well, when I wrote that script, the output it did was identical to the one
> that replica.namd produced. So I’m sure that the output always printed the
> temperature, not the replica number, since the temperature->replica_id
> assignment is not fixed.
>
>
>
> Norman Geist
>
>
>
> *Von:* owner-namd-l_at_ks.uiuc.edu [mailto:owner-namd-l_at_ks.uiuc.edu] *Im
> Auftrag von *Chitrak Gupta
> *Gesendet:* Montag, 25. Januar 2016 09:54
> *An:* Norman Geist <norman.geist_at_uni-greifswald.de>
> *Cc:* NAMD list <namd-l_at_ks.uiuc.edu>
> *Betreff:* Re: namd-l: calculating replica exchange acceptance ratio
>
>
>
> Hi Norman,
>
> Thanks a lot for sending this code.
>
> When I tried it, it kept giving false for the "info exists psf_file", even
> though I did source job0.conf. I couldn't track it down, could it be
> because I do not have any variable named psf_file? I have "structure"
> variable set in the *_base.namd file, which is basically the psf file. I
> tried changing psf_file to structure, but that didn't help.
>
> I then tried commenting out the first check. This worked, except that now
> "temp1" and "temp2" are both set to 300 (the target temperature) instead of
> the replica numbers.
>
> Any clue why this is happening and how I can fix this?
>
> Best regards,
>
> Chitrak.
>
>
>
> On Mon, Jan 25, 2016 at 2:13 AM, Norman Geist <
> norman.geist_at_uni-greifswald.de> wrote:
>
>
>
> # Reconstruct exchange ratio information from replica history files
>
> # by Norman Geist 2013
>
>
>
> set go 1
>
> if {! [info exists psf_file] } {
>
> puts "Error: You forgot to source the job.conf"
>
> set go 0
>
> }
>
>
>
> if { $go } {
>
> if {! [info exists i_job]} { set i_job 0 }
>
> set outputbase "$output_root.job$i_job"
>
> set history_filename_format "${outputbase}.%d.history"
>
>
>
> array unset excounts
>
> array set excounts {}
>
> for {set replica_id 0} {$replica_id < $num_replicas} {incr replica_id} {
>
> set history_file [open [format $history_filename_format $replica_id
> $replica_id] "r"]
>
> set allcount 0
>
> set lastnum -1
>
> while {[gets $history_file vals] >= 0} {
>
> incr allcount
>
> if {$lastnum > -1} {
>
> set nownum [lindex $vals 1]
>
> set excounts($nownum.temp) [lindex $vals 2]
>
> if {$nownum != $lastnum} {
>
> set min [expr min($nownum,$lastnum)]
>
> set max [expr max($nownum,$lastnum)]
>
> if {[info exists excounts($min-$max)]} {
>
> set excounts($min-$max) [expr $excounts($min-$max)+1]
>
> } else {
>
> set excounts($min-$max) 1
>
> }
>
> set lastnum $nownum
>
> }
>
> } else {
>
> set lastnum [lindex $vals 1]
>
> }
>
> }
>
> set excounts(allcount) [expr $allcount/2]
>
> }
>
>
>
> for {set replica_id 0} {$replica_id < $num_replicas-1} {incr replica_id}
> {
>
> set partner [expr $replica_id+1]
>
> set temp1 $excounts($replica_id.temp)
>
> set temp2 $excounts($partner.temp)
>
> set excount [expr $excounts($replica_id-$partner)/2]
>
> set pdes [expr (double($excount))/$excounts(allcount)]
>
> puts "EXCHANGE_RATIO ${temp1} ${temp2} ${excount}
> ${excounts(allcount)} ${pdes}"
>
> }
>
> }
>
>
>
>
>
> Save the above code top pdes.tcl. Then in console do:
>
>
>
> tclsh
>
> source job0.conf
>
> source pdes.tcl
>
>
>
>
>
> Norman Geist
>
>
>
> *Von:* owner-namd-l_at_ks.uiuc.edu [mailto:owner-namd-l_at_ks.uiuc.edu] *Im
> Auftrag von *Chitrak Gupta
> *Gesendet:* Montag, 25. Januar 2016 06:16
> *An:* NAMD list <namd-l_at_ks.uiuc.edu>
> *Betreff:* namd-l: calculating replica exchange acceptance ratio
>
>
>
> Dear all,
>
> I am running replica exchange simulation using NAMD. Normally, the log
> file contains the exchange acceptance ratios at the end. However, my job
> ended prematurely (due to exceeding of walltime on the cluster), and the
> log file does not have the acceptance ratio information at the bottom. Is
> there a way I could calculate it from the log file entries? Has anyone
> ever done this?
>
> Best regards,
>
> Chitrak.
>
>
>

This archive was generated by hypermail 2.1.6 : Sun Dec 31 2017 - 23:20:09 CST