# Temperature change

**URL:** <https://gromacs.bioexcel.eu/t/temperature-change/8978>\
**Category:** User discussions\
**Created:** [April 24, 2024, 4:51pm UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978 "2024-04-24T16:51:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SP06](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@SP06](https://gromacs.bioexcel.eu/u/SP06)\
**Post date:** [April 24, 2024, 4:51pm UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/1 "2024-04-24T16:51:09Z")

</div>

GROMACS version: 2021.4  
GROMACS modification: Yes/No  
Here post your question : I want to simulate my system at different temperature, say 290K. So I have to change the ref\_t from 300K to 290K in nvt.mdp, npt.mdp and md.mdp files. In the nvt.mdp, do I need to change the gen\_t (Maxwell distribution) to 290K too? The following is the nvt.mdp file-

title = charmm36 CYHE NVT equilibration  
; Run parameters  
integrator = md ; leap-frog integrator  
nsteps = 50000 ; 2 \* 50000 = 100 ps  
dt = 0.002 ; 2 fs  
; Output control  
nstenergy = 500 ; save energies every 1.0 ps  
nstlog = 500 ; update log file every 1.0 ps  
nstxout-compressed = 500 ; save coordinates every 1.0 ps  
; Bond parameters  
continuation = no ; first dynamics run  
constraint\_algorithm = lincs ; holonomic constraints  
constraints = h-bonds ; bonds to H are constrained  
lincs\_iter = 1 ; accuracy of LINCS  
lincs\_order = 4 ; also related to accuracy  
; Neighbor searching and vdW  
cutoff-scheme = Verlet  
ns\_type = grid ; search neighboring grid cells  
nstlist = 20 ; largely irrelevant with Verlet  
rlist = 1.2  
vdwtype = cutoff  
vdw-modifier = force-switch  
rvdw-switch = 1.0  
rvdw = 1.2 ; short-range van der Waals cutoff (in nm)  
; Electrostatics  
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics  
rcoulomb = 1.2 ; short-range electrostatic cutoff (in nm)  
pme\_order = 4 ; cubic interpolation  
fourierspacing = 0.16 ; grid spacing for FFT  
; Temperature coupling  
tcoupl = V-rescale ; modified Berendsen thermostat  
tc-grps = system ; two coupling groups - more accurate  
tau\_t = 0.1 ; time constant, in ps  
ref\_t = 300 ; reference temperature, one for each group, in K  
; Pressure coupling  
pcoupl = no ; no pressure coupling in NVT  
; Periodic boundary conditions  
pbc = xyz ; 3-D PBC  
; Dispersion correction is not used for proteins with the C36 additive FF  
DispCorr = no  
; Velocity generation  
gen\_vel = yes ; assign velocities from Maxwell distribution  
gen\_temp = 300 ; temperature for Maxwell distribution  
gen\_seed = -1 ; generate a random seed

---

<div class="post-metadata">

**Author:** ![Karis](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Karis](https://gromacs.bioexcel.eu/u/Karis)\
**Post date:** [April 25, 2024, 6:41am UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/2 "2024-04-25T06:41:25Z")

</div>

I’m pretty sure you should change it as well, gen\_t decides what velocities to assign to each atom so that it matches the maxwell distribution of the temperature you assign and ref\_t is the temperature that the algorithm will try to move the system towards during [equilibration](https://computecanada.github.io/molmodsim-md-theory-lesson-novice/07-thermostats/index.html), keeping the temperature consistent should provide the best results and avoids unnecessary fluctuations

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 25, 2024, 7:04am UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/3 "2024-04-25T07:04:44Z")

</div>

To add to Karis’s answer, when you are changing the temperature relatively little, like in this case, it might be better not to regenerate all velocities. You would certainly reach the target temperature quicker if you regenerate them, but the equilibration might take longer.

So, either should work fine. If it has already taken a long time to equilibrate the system I would probably avoid regenerating the velocities.

---

<div class="post-metadata">

**Author:** ![SP06](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@SP06](https://gromacs.bioexcel.eu/u/SP06)\
**Post date:** [April 25, 2024, 9:16am UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/4 "2024-04-25T09:16:35Z")

</div>

I changed both the temperatures (ref\_t and gen\_temp) to 290K for protein-water system. After NVT equilibration (100 ps) I got the following plot for temperature-

 ![vmd](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/7/7fbe022c32f222c1fa375ca131e148ef58798bea.jpeg)  
 ![temperature](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/1/1a82962721c124875c4638a820896b5d5a1272c3.jpeg)

After NPT equilibration, I got average density as 1020 kg/m^3 -

 ![density](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/a/acdaeb1e0954b35f0c1074da742f4395b92f957b.jpeg)

Is this okay, or do I need to increase any of the equilibrations, before the final md production run?

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 25, 2024, 9:29am UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/5 "2024-04-25T09:29:39Z")

</div>

It’s difficult for us to say. But in general, if you are not sure if your system is equilibrated it might be worth equilibrating a bit longer. Are you equilibrating a protein-water system for 100 ps NVT and 100 ps NPT? That sounds short to me.

One more thing, why are you using such a small `tau-t`? I wonder if that’s the cause of your large temperature fluctuations. I would recommend 1ps or even 2ps.

---

<div class="post-metadata">

**Author:** ![SP06](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@SP06](https://gromacs.bioexcel.eu/u/SP06)\
**Post date:** [April 25, 2024, 9:57am UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/6 "2024-04-25T09:57:28Z")

</div>

Yes, I am equilibrating a protein-water system (protein is ~8.2 kDa, cubic box). I equilibrated for 100 ps for both NVT and NPT. Then can you please suggest for how much time step do I need to equilibrate my system at temperature 290K and 310K? Is tau\_t, the only change should I make. I am attaching my .mdp files for your reference.

NVT.mdp-

title = charmm36 Protein-water system NVT equilibration  
; Run parameters  
integrator = md ; leap-frog integrator  
nsteps = 50000 ; 2 \* 50000 = 100 ps  
dt = 0.002 ; 2 fs  
; Output control  
nstenergy = 500 ; save energies every 1.0 ps  
nstlog = 500 ; update log file every 1.0 ps  
nstxout-compressed = 500 ; save coordinates every 1.0 ps  
; Bond parameters  
continuation = no ; first dynamics run  
constraint\_algorithm = lincs ; holonomic constraints  
constraints = h-bonds ; bonds to H are constrained  
lincs\_iter = 1 ; accuracy of LINCS  
lincs\_order = 4 ; also related to accuracy  
; Neighbor searching and vdW  
cutoff-scheme = Verlet  
ns\_type = grid ; search neighboring grid cells  
nstlist = 20 ; largely irrelevant with Verlet  
rlist = 1.2  
vdwtype = cutoff  
vdw-modifier = force-switch  
rvdw-switch = 1.0  
rvdw = 1.2 ; short-range van der Waals cutoff (in nm)  
; Electrostatics  
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics  
rcoulomb = 1.2 ; short-range electrostatic cutoff (in nm)  
pme\_order = 4 ; cubic interpolation  
fourierspacing = 0.16 ; grid spacing for FFT  
; Temperature coupling  
tcoupl = V-rescale ; modified Berendsen thermostat  
tc-grps = Protein Non-Protein ; two coupling groups - more accurate  
tau\_t = 0.1 0.1 ; time constant, in ps  
ref\_t = 290 290 ; reference temperature, one for each group, in K  
; Pressure coupling  
pcoupl = no ; no pressure coupling in NVT  
; Periodic boundary conditions  
pbc = xyz ; 3-D PBC  
; Dispersion correction is not used for proteins with the C36 additive FF  
DispCorr = no  
; Velocity generation  
gen\_vel = yes ; assign velocities from Maxwell distribution  
gen\_temp = 290 ; temperature for Maxwell distribution  
gen\_seed = -1 ; generate a random seed

NPT.mdp-

title = charmm36 Protein-water system NPT equilibration  
; Run parameters  
integrator = md ; leap-frog integrator  
nsteps = 50000 ; 2 \* 50000 = 100 ps  
dt = 0.002 ; 2 fs  
; Output control  
nstenergy = 500 ; save energies every 1.0 ps  
nstlog = 500 ; update log file every 1.0 ps  
nstxout-compressed = 500 ; save coordinates every 1.0 ps  
; Bond parameters  
continuation = yes ; continuing from NVT  
constraint\_algorithm = lincs ; holonomic constraints  
constraints = h-bonds ; bonds to H are constrained  
lincs\_iter = 1 ; accuracy of LINCS  
lincs\_order = 4 ; also related to accuracy  
; Neighbor searching and vdW  
cutoff-scheme = Verlet  
ns\_type = grid ; search neighboring grid cells  
nstlist = 20 ; largely irrelevant with Verlet  
rlist = 1.2  
vdwtype = cutoff  
vdw-modifier = force-switch  
rvdw-switch = 1.0  
rvdw = 1.2 ; short-range van der Waals cutoff (in nm)  
; Electrostatics  
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics  
rcoulomb = 1.2  
pme\_order = 4 ; cubic interpolation  
fourierspacing = 0.16 ; grid spacing for FFT  
; Temperature coupling  
tcoupl = V-rescale ; modified Berendsen thermostat  
tc-grps = Protein Non-Protein ; two coupling groups - more accurate  
tau\_t = 0.1 0.1 ; time constant, in ps  
ref\_t = 290 290 ; reference temperature, one for each group, in K  
; Pressure coupling  
pcoupl = C-rescale ; pressure coupling is on for NPT  
pcoupltype = isotropic ; uniform scaling of box vectors  
tau\_p = 2.0 ; time constant, in ps  
ref\_p = 1.0 ; reference pressure, in bar  
compressibility = 4.5e-5 ; isothermal compressibility of water, bar^-1  
refcoord\_scaling = com  
; Periodic boundary conditions  
pbc = xyz ; 3-D PBC  
; Dispersion correction is not used for proteins with the C36 additive FF  
DispCorr = no  
; Velocity generation  
gen\_vel = no ; velocity generation off after NVT

md.mdp-

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 25, 2024, 10:59am UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/7 "2024-04-25T10:59:16Z")

</div>

I can’t say for how long you should equilibrate your system.

As far as I can see the settings in general look OK (no guarantees - you must take the responsibility for your own settings). The only things I would change are `tau-t` (to 1 or 2) and `tau-p` (to 5 or 10). I’m curious to learn where these low coupling constants for `v-rescale` and `c-rescale` are recommended.

---

<div class="post-metadata">

**Author:** ![SP06](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@SP06](https://gromacs.bioexcel.eu/u/SP06)\
**Post date:** [April 25, 2024, 2:58pm UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/8 "2024-04-25T14:58:37Z")

</div>

As I am using the charmm36 forcefield, so I used most of the input file from the protein-ligand MD tutorial (V-rescale constant was recommended there, and pressure constant was actually recommended for Parrinello-Rahman barostat, but as you suggested me to change it to C-rescale for cyclohexane box of biphasic system, I used the same barostat here as I have to compare the two systems).

---

<div class="post-metadata">

**Author:** ![MagnusL](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/magnusl/32/2380_2.png) [@MagnusL](https://gromacs.bioexcel.eu/u/MagnusL)\
**Post date:** [April 25, 2024, 3:20pm UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/9 "2024-04-25T15:20:39Z")

</div>

Thanks for the information. I’m sure those coupling constants are good for the tutorials. In general, I would follow the recommendations in this post: [What is the recommended value for tau-p and tau-t with GROMACS2023.0 when using PR and NH - #4 by hess](https://gromacs.bioexcel.eu/t/what-is-the-recommended-value-for-tau-p-and-tau-t-with-gromacs2023-0-when-using-pr-and-nh/5840/4).

Looking at the temperature plot again, I think those fluctuations look very reasonable, especially for a small system.

---

<div class="post-metadata">

**Author:** ![SP06](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@SP06](https://gromacs.bioexcel.eu/u/SP06)\
**Post date:** [April 27, 2024, 2:13pm UTC](https://gromacs.bioexcel.eu/t/temperature-change/8978/10 "2024-04-27T14:13:52Z")

</div>

Thank you. The post you recommended really helped.
