AW: calculating replica exchange acceptance ratio

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

 

# 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 : Tue Dec 27 2016 - 23:21:46 CST