# Maxwell distribution gen\_t

**URL:** <https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503>\
**Category:** User discussions\
**Tags:** mdp-parameters\
**Created:** [August 7, 2025, 6:12am UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503 "2025-08-07T06:12:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanket\_singare](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sanket\_singare](https://gromacs.bioexcel.eu/u/sanket_singare)\
**Post date:** [August 7, 2025, 6:12am UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/1 "2025-08-07T06:12:40Z")

</div>

GROMACS version:  
GROMACS modification: Yes/No  
Here post your question

Hello Users  
I am beginner for gromacs  
1)i need to ask if i am changing my ref\_t more or less than 300K then i need to change the gen\_temp as well  
2) During the energy minimization, nvt.mdp and npt.mdp: the rlist, rvdw and rcoulomb should be same  
so here is my npt.mdp file  
; VARIOUS PREPROCESSING OPTIONS  
title = NPT simulation (constant number, pressure and temperature)  
cpp = /usr/bin/cpp  
define = -DPOSRES

; RUN CONTROL PARAMETERS  
integrator = md  
dt = 0.002  
nsteps = 1000000

; OUTPUT CONTROL OPTIONS  
nstxout = 5000  
nstvout = 5000  
nstfout = 0  
nstlog = 1000  
nstenergy = 1000  
nstxtcout = 1000  
xtc\_precision = 1000  
xtc-grps = System  
energygrps = system

; NEIGHBORSEARCHING PARAMETERS  
nstlist = 10  
ns-type = Grid  
pbc = xyz  
rlist = 1.0

; OPTIONS FOR ELECTROSTATICS AND VDW  
coulombtype = pme  
pme\_order = 4  
fourierspacing = 0.16  
rcoulomb = 1.6  
vdw-type = cut-off  
rvdw = 1.6  
ewald\_rtol = 0.00001

; Temperature coupling  
Tcoupl = v-rescale  
tc-grps = system  
tau\_t = 0.1  
ref\_t = 300

; Pressure coupling  
Pcoupl = Parrinello-Rahman  
Pcoupltype = Isotropic  
tau\_p = 2.0  
compressibility = 4.5e-5  
ref\_p = 1.0  
DispCorr = EnerPres  
refcoord\_scaling = com

; GENERATE VELOCITIES FOR STARTUP RUN  
gen\_vel = no ; Assign velocities to particles by taking them randomly from a Maxwell distribution  
gen\_temp = 300 ; Temperature to generate corresponding Maxwell distribution  
gen\_seed = 135962 ; Seed for (semi) random number generation.

; OPTIONS FOR BONDS  
constraints = h-bonds  
constraint-algorithm = lincs  
continuation = yes  
shake-tol = 0.0001  
please resolve the problem

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [August 7, 2025, 8:59am UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/2 "2025-08-07T08:59:30Z")

</div>

A few points, hoping I am not wrong:

i) regarding velocity generation, if you are generating velocities I would do it by using the same temperature as the thermostat. It’s not a huge deal in principle, as the thermostat will correct a wrong set of starting velocities very quickly, but anyway I would use the same.

Also please note this

```auto
gen_vel = no ; Assign velocities to particles by taking them randomly from a Maxwell distribution
gen_temp = 300 ; Temperature to generate corresponding Maxwell distribution
gen_seed = 135962 ; Seed for (semi) random number generation.

```

Here you are not generating velocities as you set `gen_vel = no`, so the `gen_temp` should be ignored. For `gen_seed` I would leave `-1` as this is the most robust way to have random velocity generation, except if you want a specific seed for some reason.

ii) This is a statement more than a question. I never head that they should be the same, let alone during EM, but I might be wrong. My understanding is that the vdW and Coulomb radii depend (at least) on the force field implementation. I think `rlist` should be at least as long as the longest of the two radii, but it’s irrelevant as it is then fine tuned automatically by GROMACS depending on some internal parameters like your hardware.

On a more general note, a few details of your mdp depend on the force field, so I would check previous literature to use the same parameters. I would also switch the barostat to the c-rescale.

---

<div class="post-metadata">

**Author:** ![sanket\_singare](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sanket\_singare](https://gromacs.bioexcel.eu/u/sanket_singare)\
**Post date:** [August 7, 2025, 9:19am UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/3 "2025-08-07T09:19:36Z")

</div>

Thanks for your valuable time  
I have queries, that for nvt, npt or for mdrun the ref\_temperature and the gen\_temperature should be same

if ref\_298.15 then gen\_temp should be same as ref\_temperature or it should be 300k (for nvt,npt and mdrun) as in gromacs manual, gen\_ temp 300k (maxwell distribution) it is mention over there

i need to ask to match the experimental density what should be done after equilibrium , it should be npt first then nvt or nvt first then npt

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [August 7, 2025, 10:46pm UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/4 "2025-08-07T22:46:17Z")

</div>

The temperature you should use is the temperature you want to use, not the one reported on GROMACS manual, that is an example. If you want to run at the “standard” room temperature, then you should set both the generation and the reference to 298.15K (although I wouldn’t expect it to matter that much with respect to 300K). If you need to run at other temperatures, you set the mdp to those temperatures.

Regarding the density, generally that is experimentally calculated at a given temperature and a given pressure. I would go with NVT at that T, then NPT at that T and that P. After a few ns (depending on the system dimension and composition) you will have an equilibrated box from which you can calculate the density.

---

<div class="post-metadata">

**Author:** ![sanket\_singare](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sanket\_singare](https://gromacs.bioexcel.eu/u/sanket_singare)\
**Post date:** [August 8, 2025, 9:02am UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/5 "2025-08-08T09:02:40Z")

</div>

Thanks for reply  
Actually I am doing md simulation of ethylene glycol with choline chloride to match the actual density reported in experimental paper, but actual i am not getting any idea to pack how much molecules need to pack in packmol?  
if you have any idea or calculation to acheiving the density and how much amount of molecules should be added?  
please resolve the issue

Thanks and Regards

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [August 8, 2025, 7:19pm UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/6 "2025-08-08T19:19:08Z")

</div>

This is not that relevant as the pressure coupling during the NPT phase will relax the box eventually anyway.

---

<div class="post-metadata">

**Author:** ![sanket\_singare](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sanket\_singare](https://gromacs.bioexcel.eu/u/sanket_singare)\
**Post date:** [August 12, 2025, 8:29am UTC](https://gromacs.bioexcel.eu/t/maxwell-distribution-gen-t/12503/7 "2025-08-12T08:29:24Z")

</div>

thanks
