Calculate MSD in a particular region of a particular type atom

Dear Sir,

In the simulation box, I make one region, and in this region, I want to calculate the msd of a particular type of atom.
Please suggest some ideas.

Thanks and regards
Sachin

This question has been asked and answered several times before. Please have a look at those discussions in the archives or provide an explanation why your case is different than the others.

Thanks, sir
I went through the previous explanation, and I found that compute msd/chunk is the solution for this.
But, sir, when we calculate compute msd, we can plot the graph between msd values vs time for calculating the diffusion coefficient. But, msd/chunk provide some other data. Is there any way to convert “compute msd/chunk” data similar to “compute msd” values so that we can plot the graph between msd vs time and calculate the diffusion coefficient.
Thanks in advance

What you should have noticed in the previous discussions is that a “regional MSD” is an ill-defined property. During the MSD calculation atoms may leave the region, other atoms are entering the region (without being tracked) and if you would enforce that atoms have to be within the region all the time, then you have a bias toward a lower MSD.

This would be a task for a custom post processing script. The file format is documented, so you can process it as needed.

Dear sir,

If I generate the dump file for the particular region, then with the help of the trajectory of the atom, I can generate MSD for a particular atom type inside the region.
is it technically correct to do this?

Dear Sir ,

One more question related to msd/chunk output.

My SImulation box size is 0 52 0 52 0 52. I created a region of 20 40 20 40 20 40. This is my input code

region re block 20 40 20 40 20 40 # Creating a region
group reg region re # make group of this region
compute chu_1 reg chunk/atom type
compute msd_ch reg msd/chunk chu_1
fix msd_c reg ave/time 1 1 1 c_msd_ch[1] c_msd_ch[2] c_msd_ch[3] c_msd_ch[4] file msd_ch_all.txt mode vector

I am getting output in four column like this ,

1 2.5447e-08 6.50225e-08 4.46849e-08 1.35154e-07
2 4.82883e-11 1.67111e-09 7.27524e-08 7.44718e-08
3 4.39291e-08 1.59608e-07 7.31352e-10 2.04268e-07
4 6.01965e-07 2.7107e-08 6.92399e-13 6.29073e-07
5 1.2949e-07 2.49407e-07 3.59274e-07 7.38172e-07
6 5.03752e-07 8.37267e-08 1.31648e-07 7.19127e-07
7 4.8868e-12 9.33332e-08 1.0222e-08 1.0356e-07
8 1.29501e-09 6.42236e-07 9.07454e-13 6.43532e-07
9 2.38429e-07 7.44732e-07 5.35871e-08 1.03675e-06

These values are calculated at every time step, So my question is I created a “compute chunk/atom type” atom type … in the region, if i have 20 atoms of type 1 or 30 atoms of type 2, then this command considers all the atom of type 1 or type 2 and give an average of all-atom of the same type?
In compute msd command it clear mention in LAMMPS document about average but for msd/chunk it did not mention.

compute msd command

A vector of four quantities is calculated by this compute. The first three elements of the vector are the squared dx , dy , and dz displacements, summed and averaged over atoms in the group. The fourth element is the total squared displacement (i.e., 𝑑𝑥2+𝑑𝑦2+𝑑𝑧2),
" summed and averaged over atoms in the group"

compute msd/chunk command

Four quantities are calculated by this compute for each chunk. The first 3 quantities are the squared dx , dy , and dz displacements of the center-of-mass. The fourth component is the total squared displacement (i.e., 𝑑𝑥2+𝑑𝑦2+𝑑𝑧2) of the center-of-mass. These calculations include all effects due to atoms passing through periodic boundaries.

I have given you my opinion on how misguided this kind of calculation is before here: Rearding msd calculation - #2 by akohlmey

I am not in the habit of supporting ill-advised projects.