How to generate parallel runs with different initial velocites?

Hi, I would like to study the interfacial properties of a water-trichloroethane system. I am planning to run a 20 ns molecular dynamics (MD) simulation. For better statistical sampling and to account for variations in initial conditions, I aim to conduct 4 parallel runs with different initial velocities. To achieve this, I understand that I need to specify the gen_seed parameter during equilibration in order to generate initial velocities from a Maxwellian distribution. However, I am unsure how to choose different values for gen_seed for each parallel run. Could you please provide guidance on how to accomplish this? Thank you

Dear @aish.warya_2024 ,

as per the manual setting gen-seed = -1 will generate a random number to sample the starting Boltzmann distribution of velocities, so as long as you generate the starting velocities with gen-vel = yes and you use a random seed in each simulation you should be fine. The likelihood of having the same random number is incredibly small and eventually the trajectories will diverge exponentially as the simulation time passes, especially if you are introducing further stochastic terms like the v-rescale thermostat or you use mixed precision.

Thank you @obZehn. I will try

Dear @obZehn, thank you for your assistance. I have one more question to ask. Should I apply these commands during NVT or NPT equilibration, or during the MD run? All these .mdp files include an option for velocity generation.

I ran an NVT equilibration with gen-vel = yes and gen-seed = -1. As a result, I obtained four .tpr files. Can I use these .tpr files as input files with different initial velocities for further runs? Your help is appreciated. Thanks in advance.

I would say you have to generate the velocities only in the first run with dynamics, e.g. the first run after the energy minimization and then the following steps should have continuation = yes and be compiled in the grompp pre-processing phase with the flag -t pointing at the .cpt file of the previous step.

Thank you @obZehn. I will try this

dear sir @obZehn , let me ask you one question, after the nvt riun with gen-vel=yes , I am getting four .tpr files. Can i use these four .tpr files as four different inital velocities for further calculation?

You get a .tpr file after the grompp pre-processing step, which you then use to run the simulation. I don’t think you will get any .tpr as an output itself of the simulation! Are you sure those are not files you compiled by mistake in previous steps?

I have run the NVT equilibration using .gro file of the energy minimization. gromm pp run has done using the command:
grompp -f nvt.mdp -c em-tce-water.gro -r em-tce-water.gro -p -o nvt-tce-water.tpr -maxwarn 1000
After this run, i got nvt-tce-water.tpr, #nvt-tce-water.tpr.1# , #nvt-tce-water.tpr.2# #nvt-tce-water.tpr.3#. Further I have run four different NVT equilibration with these separate .tpr files considering them as files with different initial velocities by giving the command:
mdrun -deffnm nvt-tce-water1
mdrun -deffnm nvt-tce-water2 etc.
that is in total 4 different NVT equilibration runs completed and I obtained the respective .gro files. After that, I have run corresponding NPT equilibration MD simulatio. Is that correct?

why there is a maxwarn 1000 in your command? @aish.warya_2024

Thank you @scinikhil for your reply. I have given 1000 as an arbitrary number. Is that an issue? Can we consider these tpr files as starting files with different initial velocity for md run?

How did you obtain these nvt-tce-water.tpr, #nvt-tce-water.tpr.1# , #nvt-tce-water.tpr.2# #nvt-tce-water.tpr.3#? Did you just run four times the grompp command? In that case you should use the four outputs separately to run the simulations, It is not very clear which one did you use as you define the -deffnm and refer to a binary that you didn’t produce in the previous command.

Also, -maxwarn should never be used randomly. You should never mute any error, as this can cover up problems that are not sufficient to break the simulations but will give you garbage output, e.g. if you forgot to neutralize your system and you run with a net charge. Does the system compile if you take away the -maxwarn flag?

Actually, I have run the grompp command only once. my nvt.mdp file is given below:

; Run parameters
integrator = md ; leap-frog integrator
nsteps = 500000 ; 2 * 50000 = 100 ps
dt = 0.002 ; 2 fs
; Output control
nstxout = 500 ; save coordinates every 1.0 ps
nstvout = 500 ; save velocities every 1.0 ps
nstenergy = 500 ; save energies every 1.0 ps
nstlog = 500 ; update log file every 1.0 ps
; Bond parameters
continuation = no ; first dynamics run
constraint_algorithm = lincs ; holonomic constraints
constraints = h-bonds ; bonds involving H are constrained
lincs_iter = 1 ; accuracy of LINCS
lincs_order = 4 ; also related to accuracy
; Nonbonded settings
cutoff-scheme = Verlet ; Buffered neighbor searching
ns_type = grid ; search neighboring grid cells
nstlist = 10 ; 20 fs, largely irrelevant with Verlet
rcoulomb = 1.0 ; short-range electrostatic cutoff (in nm)
rvdw = 1.0 ; short-range van der Waals cutoff (in nm)
DispCorr = EnerPres ; account for cut-off vdW scheme
; Electrostatics
coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics
pme_order = 4 ; cubic interpolation
fourierspacing = 0.16 ; grid spacing for FFT
; Temperature coupling is on
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 is off
pcoupl = no ; no pressure coupling in NVT
; Periodic boundary conditions
pbc = xyz ; 3-D PBC
; Velocity generation
gen_vel = yes ; assign velocities from Maxwell distribution
gen_temp = 300 ; temperature for Maxwell distribution
gen_seed = -1 ; generate a random seed
When i am running nvt equiibration by taking away -maxwarn flag, the .log file shows 1 warning:
“Calculating fourier grid dimensions for X Y Z
Using a fourier grid of 24x24x52, spacing 0.137 0.137 0.150
This run will generate roughly 140 Mb of data
Estimate for the relative computational load of the PME mesh part: 0.28
Calculated rlist for 1x1 atom pair-list as 1.025 nm, buffer size 0.025 nm
Set rlist, assuming 4x4 atom pair-list, to 1.000 nm, buffer size 0.000 nm
Note that mdrun will redetermine rlist based on the actual pair-list setup”

Fatal error:
Abort(1) on node 6 (rank 6 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 6
Abort(1) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
Too many warnings (1).
If you are sure all warnings are harmless, use the -maxwarn option.

you need to generate the n number of tpr for n nuber of different velocity. remove the maxwarn and generate the tpr. btw, these are backup files:#nvt-tce-water.tpr.1# , #nvt-tce-water.tpr.2# #nvt-tce-water.tpr.3#

The warning is probably earlier in the gmx grompp command output. It should be clear what it is warning about.

Thank you, @scinikhil, for your help. That addressed my previous question, and now everything is clear.

Okay @MagnusL. thank you for your assistance