Re: Syntax for replicaRecv

From: Florian Blanc (blanc.flori_at_gmail.com)
Date: Mon Aug 07 2017 - 08:47:02 CDT

Dear NAMD users,

Coming back from the week-end with a fresher mind, I figured the source
of the error I was describing has nothing to do with replicaRecv but
simply comes from a syntax mistake in my tcl code: the elseif
instruction should be on the same line as the closing bracket of the if.
Once this is corrected the code runs fine.

Apologies for this confusion,

Florian

On 08/04/2017 05:17 PM, Florian Blanc wrote:
> 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.
>
>
> # BEGINNING SCRIPT
>
> replicaBarrier
> 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
>
> replicaBarrier
>
> # 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]
> }
>
> # END
>
>
> 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 : Sun Dec 31 2017 - 23:21:32 CST