Ensemble effect on compute msd

Hello everyone I just want to be sure about the fact how LAMMPS consider effect of thermodynamic ensemble while doing MSD compute,

  • from examples, I see they did 5000 steps nve equilibrium run before 100000 steos data gathering run where sole effect is to calculate MSD vector dynamically. does that mean 100000 steps data gahering is being performed under nve ensemble? shouldn’t I add compute insdie ensemble run ?
  • moreover , its mentioned in restrictions ‘’ Compute msd cannot be used with a dynamic group.’ I think from this they are refering to conservation of mass.is that true ?

Hi @Irslan_Ullah_Ashraf,

LAMMPS does not deal with thermodynamics ensemble directly. fix nve is an integrator of position that uses Newton’s equation of motion, fix nvt and fix npt are integrator using extended hamiltonians as developed in the reference papers. The thermodynamic ensemble are retrieved for periodic bulk systems as has often been discussed in the forum.

I see they did 5000 steps nve equilibrium run before 100000 steos data gathering run where sole effect is to calculate MSD vector dynamically.

Who is “they”? What are you referring to? What do you mean by calculate MSD vector “dynamically”?

its mentioned in restrictions ‘’ Compute msd cannot be used with a dynamic group.’ I think from this they are refering to conservation of mass.is that true ?

The reason compute msd cannot be used with dynamic group is because of the way MSD is computed on the fly by LAMMPS: the initial positions of atoms in the group is saved and the average of the square of the distances is computed with regard to these initial positions. If the atoms in the group change, as is the purpose of a dynamic group, the computation simply makes no sense.

hI @Germain Thanks for your comments, i am sorry if i couldn’t write it clearly

I understand the meaning of imposing thermodynamic ensemble using fix command very well. my question is very simple and it is connected to the 2nd comment so I am stating it in next paragraph

From they I am refereing to the LAMMPS to MSD calculation. performed for Diffusivity calculation in the LAMMPS example, where they followed the mentioned procedure. by ‘dynamically’ I want to refer continuous measurement of MSD at each time step throughout the calculation. Here my question is, whe you equilibrate system using nve for 5000 steps and than after doing unfix(as you can check in the attached input) they start another simulation just to gather MSD data. so will it retain. the same fix nve setting for 100000. ? if no , under which thermodynamics conditions LAMMPS will calculate MSD ?

here is the input

irslanullahashraf@Arslans-MacBook-Air DIFFUSE % vim in.msd.2d

sample LAMMPS input script for diffusion of 2d LJ liquid

mean-squared displacement via compute msd

settings

variable x equal 40
variable y equal 40

variable rho equal 0.6
variable t equal 1.0
variable rc equal 2.5

problem setup

units lj
dimension 2
atom_style atomic
neigh_modify delay 0 every 1

lattice sq2 ${rho}
region simbox block 0 $x 0 $y -0.1 0.1
create_box 1 simbox
create_atoms 1 box

pair_style lj/cut ${rc}
pair_coeff * * 1 1

mass * 1.0
velocity all create $t 97287

fix 1 all nve
fix 2 all langevin $t $t 0.1 498094
fix 3 all enforce2d

equilibration run

thermo 1000
run 5000

unfix 2

data gathering run

reset_timestep 0

factor of 4 in 2 variables is for 2d

compute msd all msd com yes
variable twopoint equal c_msd[4]/4/(stepdt+1.0e-6)
fix 9 all vector 10 c_msd[4]
variable fitslope equal slope(f_9)/4/(10
dt)

thermo_style custom step temp c_msd[4] v_twopoint v_fitslope

only need to run for 10K steps to make a good 100-frame movie

dump 1 all custom 1 tmp.dump id type vx vy vz

dump 2 all image 100 image.*.jpg type type zoom 1.6 adiam 1.2

“in.msd.2d” 62L, 1281B
"

Please note that these are a lot of context information that you did not give in your initial question and that could not be guessed from readers.

Allow me now to comment your statements. When you say:

I understand the meaning of imposing thermodynamic ensemble using fix command very well.

Then ask:

Here my question is, when you equilibrate system using nve for 5000 steps and than after doing unfix (as you can check in the attached input) they start another simulation just to gather MSD data.

You missed that the unfix in the example concerns the langevin fix that was used to equilibrate the temperature of the system.

The computation of the msd is clearly done after the equilibration of the temperature as all the definitions of the compute, fix and variables used are done in between the two runs. The computation is done at constant energy to avoid effect from the thermostat. LAMMPS does not care about “the thermodynamic conditions” to compute the MSD. It uses the compute and fixes commands you defined. That’s it.

If you are interested in these effects, not ensemble effects but thermostat effects which are, I insist, not the same thing, I recommend you start looking into the relevant literature. See for example: https://doi.org/10.1021/ct400109a

Dear @Germain thank you so much for your response and guiding remarks. I consider my bad while reading unfix command. Also thank you for suggesting the literature.
have a fantastic day