# Replica-exchanging temperature error in REST2

**URL:** <https://gromacs.bioexcel.eu/t/replica-exchanging-temperature-error-in-rest2/6018>\
**Category:** User discussions\
**Tags:** simulation-setup\
**Created:** [March 22, 2023, 6:49am UTC](https://gromacs.bioexcel.eu/t/replica-exchanging-temperature-error-in-rest2/6018 "2023-03-22T06:49:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WangshuLi](https://avatars.discourse-cdn.com/v4/letter/w/6de8d8/32.png) [@WangshuLi](https://gromacs.bioexcel.eu/u/WangshuLi)\
**Post date:** [March 22, 2023, 6:49am UTC](https://gromacs.bioexcel.eu/t/replica-exchanging-temperature-error-in-rest2/6018/1 "2023-03-22T06:49:21Z")

</div>

GROMACS version:2021.6-plumed-2.7.5  
GROMACS modification: Yes

Hi, I am using gromacs version 2021.6-plumed-2.7.5 and trying the REST2 for a 39-residue peptide system sourcing a99sb-disp ff.

I used a .sh bash to produce the REST2 with temperature distributed from 293 to 400K, and my .sh bash and files related are attached below.

However, I found the temperature of each replica is all the same. I don’t know what went wrong.

[rest.sh]  
#five replicas  
nrep=20  
#“effective” temperature range  
tmin=293  
tmax=400

#build geometric progression  
list=$(  
awk -v n=$nrep   
-v tmin=$tmin   
-v tmax=$tmax   
‘BEGIN{for(i=0;i\<n;i++){  
t=tmin_exp(i_log(tmax/tmin)/(n-1));  
printf(t); if(i\<n-1)printf(“,”);  
}  
}’  
)

#clean directory  
rm -fr #\*  
rm -fr topol\*

for((i=0;i\<nrep;i++))  
do

```
mkdir ./steprest/MD_${i}
cp ./mdtest.mdp ./steprest/MD_${i}/.
cp ./nvt.gro ./steprest/MD_${i}/.
cp ./nvt.cpt ./steprest/MD_${i}/.

```

#choose lambda as T[0]/T[i]  
#remember that high temperature is equivalent to low lambda  
lambda=$(echo $list | awk ‘BEGIN{FS=“,”;}{print 1/’$((i+1))‘;}’)  
#process topology  
#(if you are curious, try “diff topol0.top topol1.top” to see the changes)  
plumed partial\_tempering $lambda \< processed.top \> topol$i.top  
cp ./topol${i}.top ./steprest/MD\_${i}/.  
#prepare tpr file  
#-maxwarn is often needed because box could be charged  
gmx\_mpi grompp -maxwarn 1 -o ./steprest/MD\_{i}/topolmdtest.tpr -c ./steprest/MD\_{i}/nvt.gro -f ./steprest/MD\_{i}/mdtest.mdp -t ./steprest/MD\_{i}/nvt.cpt -p ./steprest/MD\_{i}/topol{i}.top  
done  
#mpirun -np $nrep gmx\_mpi mdrun -v -plumed plumed.dat -multidir ./steprest/MD\_[0123456] -replex 1000 -nsteps 500000 -hrex -dlb no  
nohup mpirun -np 20 gmx\_mpi mdrun -plumed /data/Liws2021/ptad1/rest2/plumed.dat -deffnm topolmdtest -multidir ./steprest/MD\_0 ./steprest/MD\_1 ./steprest/MD\_2 ./steprest/MD\_3 ./steprest/MD\_4 ./steprest/MD\_5 ./steprest/MD\_6 ./steprest/MD\_7 ./steprest/MD\_8 ./steprest/MD\_9 ./steprest/MD\_10 ./steprest/MD\_11 ./steprest/MD\_12 ./steprest/MD\_13 ./steprest/MD\_14 ./steprest/MD\_15 ./steprest/MD\_16 ./steprest/MD\_17 ./steprest/MD\_18 ./steprest/MD\_19 -replex 1000 -hrex -dlb no

[mdtest.mdp](https://gromacs.bioexcel.eu/uploads/short-url/AbnvMQ2Ir1TPPo43Xb0U8AE28Hc.mdp) (2.3 KB)  
[processed.top](https://gromacs.bioexcel.eu/uploads/short-url/xamJFRUDTDUCpBfxevlAM1dmEW9.top) (249.5 KB)  
[topolmdtest.log](https://gromacs.bioexcel.eu/uploads/short-url/7IjPOrYZENWmzXFuL8DBp68Arbv.log) (180.0 KB)

---

<div class="post-metadata">

**Author:** ![therealchrisneale](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@therealchrisneale](https://gromacs.bioexcel.eu/u/therealchrisneale)\
**Post date:** [March 26, 2023, 1:39am UTC](https://gromacs.bioexcel.eu/t/replica-exchanging-temperature-error-in-rest2/6018/2 "2023-03-26T01:39:15Z")

</div>

How did you determine that “the temperature of each replica is all the same”? If I recall the method correctly, the temperature is in fact always the same. It’s just the Hamiltonian that gets scaled in a way that can be interpreted as effectively changing the temperature.

---

<div class="post-metadata">

**Author:** ![WangshuLi](https://avatars.discourse-cdn.com/v4/letter/w/6de8d8/32.png) [@WangshuLi](https://gromacs.bioexcel.eu/u/WangshuLi)\
**Post date:** [March 26, 2023, 7:56am UTC](https://gromacs.bioexcel.eu/t/replica-exchanging-temperature-error-in-rest2/6018/3 "2023-03-26T07:56:23Z")

</div>

Thank you for your reply.  
Yeah, I didn’t learn H-REMD well at first. Seeing the exact same in “Replica exchange in temperature” in topolmdtest.log, it knocked me that there must be something wrong with my process.  
Later I studied the REST2 tutorial ([Enhanced\_Sampling\_Methods\_Tutorials/REST2 at master · NNairIITK/Enhanced\_Sampling\_Methods\_Tutorials · GitHub](https://github.com/NNairIITK/Enhanced_Sampling_Methods_Tutorials/tree/master/REST2)) again more carefully, and just as you proposed, “in REST2 the temperature of the system remains same for all the replicas instead the potential energies of selected atoms in each replica will be  
scaled by some parameter λ” .  
More, I checked my topol$i.top files, and topol0.top remained unscaled for i=0, lambda=1 while others were all scaled in success.

Thanks again.
