# msd calculation

Can anyone suggest me how to calculate msd for a particular region ( for a particular types of group of atoms) in Lammps ( where dynamics of that system will also considered means particles can go in or out from that region with time) ?

You can always compute. But its not clear what you mean by mean square displacement of a region or intend to get (is this just a region defining an initial group of atoms?). It might be more useful if you were to give an actual expectation that you were trying to compute, for clarification to people who might answer you.

yah i want to calculate msd for a region ( this just a region which i defined with some group of atoms) and also i want to consider the dynamics ( particles can go in or out with in that region) for that calculation. Is it possible to calculate msd for this, if please suggest me…

By dynamics do you mean that the population of atoms, over which you are averaging, is constantly updated? Not sure if this can be done with dynamic groups, my guess is no since the rewriting of initial atom coordinates would probably get messy. Someone might prove me wrong.

Its an easy post processing job to code, if you want to store the data and are so inclined, but I’m not sure what the measure would tell you. Estimating inhomogeneous diffusion coefficients?

yah i want to calculate msd for a region ( this just a region which i
defined with some group of atoms) and also i want to consider the dynamics
( particles can go in or out with in that region) for that calculation. Is
it possible to calculate msd for this, if please suggest me.....

​that is not so much a question of what LAMMPS can compute, but rather how
you define it. it is essentially an ill defined problem. *you* will have to
decide how to determined which contributions count towards the MSD: a)
those that were within the desired region at the beginning of each window
of the MSD calculation, b) only particles that stayed within the designated
region for the entire time of the MSD observation, c) those that were
inside at the beginning and the end, or d) some other definition.

only after you have understood which is what you want (i personally favor
a) as that ks the least biased choice, but is also is the least intuitive),
only *then* can you start wondering whether this can be done with LAMMPS
with the existing facilties, or whether it needs additional programming
work or whether it is impossible to do.

axel.

yes dynamics means population of atoms which will be constantly updated with time…inhomogeneous diffusion coefficient.

but i want to calculate the msd, where with time particles will be updated, not with those particles that were within the desired region at the beginning.

Everyone’s on the same page; Axel gave you some good advice. Right now you don’t have a clear description of how the accounting for population change or averaging for that matter is going to take place. He already gave you 3 interpretations, with subtle but important distinctions, that could be used to compute the vague description, so your question is, at present, without meaning.

yes dynamics means population of atoms which will be constantly updated
with time.........inhomogeneous diffusion coefficient.

but i want to calculate the msd, where with time particles will be
updated, not with those particles that were within the desired region at
the beginning.

​but do you understand that this also means to include a bias favors
particles that move slower, and that this bias gets larger, the longer your
time window gets?