Re: Running multiple walker metadynamics replicas as a bundle

From: Giacomo Fiorin (
Date: Mon Oct 26 2020 - 13:49:10 CDT

Hi Zeynab (and other readers), what you linked as "NAMD user guide" is
actually part of the Colvars manual, specifically the version that
documents the NAMD backend:
It is good to clarify that Colvars is a contributed package developed for
the most part outside the institution that develops VMD and NAMD. To
maximize usability all these codes are distributed together, and no
patching is needed on your part. However, I kindly ask that in future
applications where you use Colvars features you cite both the NAMD paper
<> and the Colvars paper
<>, because each paper
acknowledges distinct sources of funding.

Also, if the documentation of the Colvars feature that you are using
describes a specific reference paper, it is understood that you should cite
that paper as well (e.g. multiple-walker metadynamics is described directly
in the "main" Colvars paper, but multiple-walker ABF was added later and
has an additional reference <>).

Back to your question, Josh correctly pointed out that your commands didn't
have the correct syntax for launching a multiple-replicas NAMD job
(metadynamics or otherwise). Check the NAMD manual section that he linked
and the README in NAMD's lib/replica folder. Your command should be
something along the lines of:
charmrun +p8 namd2 +replicas 2 job0.namd +stdout job0.rep%d.log
where "input.namd" is a shared script that contains lines like this one:
outputName job.rep[myReplica]

In the Colvars version distributed with NAMD 2.14 (which the Colvars doc
currently describes), the replica's numeric ID is auto-detected internally
so you won't need to use "myReplica" for that. In earlier versions, you
would instead inline the metadynamics bias in the NAMD script, and use
cv config "
metadynamics {
    replicaID [myReplica]

Lastly, try to be careful if you combine multiple-walkers with
well-tempered metadynamics. If the variable you chose is not a good one,
the replicas will stay more or less where they start from and the PMF would
"converge" to whatever was their initial distribution. That PMF may make
even some sense to you and the problem be difficult to detect (unlike
single-replica metadynamics, where the presence of a single huge minimum
will always be suspect). This is an issue already with standard
metadynamics, but only gets worse when you artificially turn down the bias
to make the PMF converge asymptotically. Whatever you do, with
multiple-walkers, keep a close look at the trajectories of the walkers, and
see that they all visit multiple states.

If you choose to initialize all walkers at the same structure, what you are
doing is (at least until the walkers diffuse away) pretty much equivalent
to single-replica metadynamics.


On Mon, Oct 26, 2020 at 12:06 PM Josh Vermaas <>

> Hi Zeynab,
> If you wanted two different simulations to execute independently within
> the queuing system, I don't think you'd use the +replicas options at
> all. +replicas 2 means that NAMD will run the .namd file twice under the
> same process (so that if one crashes, the whole simulation goes down).
> Based on the links you pointed to, +replicas 2 would write the same set of
> files. The trick to setting up multiple replicas under the same process is
> to use "myReplica" within the NAMD configuration file (
> to say what replica you are, and use that to setup the output files
> accordingly.
> -Josh
> On Mon, Oct 26, 2020 at 6:39 AM zeynab hosseini <
>> wrote:
>> Dear all,
>> I want to perform multiple walker/well-tempered (MWWT) metadynamics
>> through several replicas. I followed the example test under this link
>> <>,
>> creating the namd (.namd file) and collective variable (.in file)
>> configuration files for each replicas (e.g, rep1.namd, and
>> rep2.namd, and so on ). From NAMD user guide
>> <>
>> I‌ understood that there are two way to run MWWT metadynamics replicas, (1)
>> as a bundle (i.e. a single job in a cluster’s queueing system) or (2) as
>> fully independent runs (i.e. as separate jobs for the queueing system). I
>> think I‌ know how to run the second one (please correct me if I'm wrong):
>> charmrun /usr/local/bin/namd2 ++local +p8 +replicas 2 test.rep1.namd >
>> test.rep1.log
>> charmrun /usr/local/bin/namd2 ++local +p8 +replicas 2 test.rep2.namd >
>> test.rep2.log
>> I‌ tested the 2nd case and it worked. But I don't know how to perform the
>> first one. i.e. to run a single job and to get all replicas proceed
>> simultaneously. Would that be possible to guide me? (I assume that it is
>> related to the common.tcl provided in the example test
>> <> but
>> I don't know the proper commands to launch it).
>> All the best,
>> Zeynab

This archive was generated by hypermail 2.1.6 : Fri Dec 31 2021 - 23:17:10 CST