AW: calculating replica exchange acceptance ratio

From: Norman Geist (norman.geist_at_uni-greifswald.de)
Date: Mon Jan 25 2016 - 05:51:31 CST

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 < <mailto:norman.geist_at_uni-greifswald.de> 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> [mailto: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 < <mailto:namd-l_at_ks.uiuc.edu> 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 : Tue Dec 27 2016 - 23:21:46 CST