Syntax for replicaRecv

From: Florian Blanc (
Date: Fri Aug 04 2017 - 10:17:27 CDT

Dear NAMD users,

I am trying to run multiple-copy simulations with an MPI build of NAMD
(either 2.11 or recent Git version). But, I am having trouble setting up
the communication between the replicas using replicaSend and
replicaRecv. Here is a minimal example in which I try to send the value
of a variable from one replica to another at the end of the run. This is
just a dummy case to illustrate the problem I am facing, which I think
relates to my misunderstanding of the syntax of the replicaSend and
replicaRecv commands.


set replica_id [myReplica]
set num_replicas [numReplicas]

# set a different temperature for each replica

set temperature [ expr 100.0 + 100.0*double($replica_id) ]

# Declare all NAMD simulation parameters

# ...

run 100


# And now try to send the value of temperature from replica 1 to replica 0:

if { $replica_id == 1 } {

     replicaSend $temperature 0


elseif { $replica_id == 0 } {
     # receive the value of temperature and store it in variable foo
     set foo [replicaRecv 1]


I execute this code with a command like:

  mpirun -np 2 namd2 +replicas 2 initial.conf +stdout ./%03d/replica%03d.log

and obtain the following error when NAMD attempts to execute the part of
the script that deals with inter-replica communication:

REPLICA 0 FATAL ERROR: wrong # args for NAMD config parameter
     while executing
"elseif { $replica_id == 0 } {

     set foo [replicaRecv 1]

As I understand it, it tells me that the number of arguments for the
function replicaRecv is wrong. I am confused, because in the
documentation it is said that replicaRecv takes as argument the
identifier of the source process, that is, the one which sent the data.
I had the impression that I had respected this syntax.

Note that everything before this (setting up and running the simulation)
works fine.

Could you please help me figure out what I am missing regarding how
replicaSend and replicaRecv are supposed to be used?

Many thanks in advance for your help, and I apologize if my request is
insufficiently clear.

Florian Blanc

PhD student, University of Strasbourg

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2018 - 23:20:29 CST