# [gmx-users] Re: gmx-users Digest, Vol 55, Issue 130

servaas servaas.michielssens at student.kuleuven.be
Tue Nov 25 11:14:16 CET 2008

```This is the code from repl_ex.c important for your question:

In the function get_replica_exchange:

m= (step / re->nst) %2;
#re->nst=number of steps that you give with the -replex option
for(i=1; i<re->nrepl; i++) {
a = re->ind[i-1];
b = re->ind[i];
bPrint = (re->repl==a || re->repl==b);
if (i % 2 == m) {
check for exchange
}
When step/re->nst is odd m is 1 result is the e.g. for a system with 3
replicas and a swap attempt every 500 steps:
step500   0 x 1   2
step1000  0   1 x 2
step1500  0 x 1   2
etc...

So when step/re-nst is odd exchange is attempted between odd replicas
and odd replica -1, when step/re-nst is even exchange is attempted
between even replica and even replica -1.

hope this helps,

servaas

On Tue, 2008-11-25 at 10:05 +0100, gmx-users-request at gromacs.org wrote:
> ------------------------------
>
> Message: 5
> Date: 25 Nov 2008 09:05:35 -0000
> From: "sarbani chattopadhyay" <sarbani_c84 at rediffmail.com>
> Subject: [gmx-users] how many pairs are exchanged in replica exchange
> To: "gmx_users" <gmx-users at gromacs.org>
> Message-ID: <20081125090535.11206.qmail at f5mail-237-208.rediffmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Hi,
>    I am new to Replica exchange molecular dynamics.
>     I obtained the optimal temperature distribution based on the
> lowest and highest
> tempearture and exchange probability from the REMD caclulator ,
> available through the
> gromacs homepage.
> There were 17 temperaure values as output. I prepared 17  ".tpr" files
> based on the
> temperatures.
> What I want to know is that at each attempted step of replica
> exchange, how many pairs of
> replicas will be exchanged, and how this is decided?
>