Re: Buffering problems while attempting to read log file

From: Zach Hensel (
Date: Fri Feb 10 2006 - 14:20:11 CST

I've since isolated this as related to charmrun. If I manually invoke
the replica exchange clients by logging into a node and using:

namd2 replica1.conf > replica1.log

everything works fine. However, if I invoke it using charmrun:

charmrun namd2 +p2 ++nodelist nodelist replica1.conf > replica1.conf

I experience the buffering problems mentioned in my previous message.

Zach Hensel

On 2/10/06, Zach Hensel <> wrote:
> Hello,
> I am trying to implement replica exchange by interfacing NAMD
> simulations with a Tcl server on our local cluster. At the moment I'm
> having trouble reading the energy of the replicas reliably. The .conf
> file runs a command to grab the energies of the replica after a period
> of simulation:
> set energies [split [exec tail -15 replica.log | grep ENERGY | awk {{
> print $12,$11 }}]]
> set potE [expr [lindex $energies 0] - [lindex $energies 1]]
> ... potential energies are sent to the Tcl server which calculates
> exchange moves and returns new temperatures to replicas ...
> This "works" on occasion, but runs into problems because the log file
> is not fully updated. Viewing the log file with tail -f as it is
> created shows that the output is caught up in some buffer. I'm not
> sure if this namd's buffer before sending information to stdout or
> some buffer implicit in redirecting namd output to a log file.
> It seems like there has to be an easy fix to this:
> 1. Some way to read potential energy within namd without loading any
> new coordinates files
> 2. A way to flush the output before reading the log file
> Any help would be appreciated.
> Zach Hensel
> Johns Hopkins Biophysics

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:41:36 CST