[lammps-users] commands to compute and dump msd

Hi, all. Could someone please post the current equivalent of the old command

fix 4 all msd 8000 msddumpfile com yes

i. e., calculate the mean-squared displacements of all atoms, with the center-of-mass displacement subtracted out, every 8000 steps, and dump them to file “msddumpfile”?

I did look at the new doc page http://lammps.sandia.gov/doc/compute_msd.html, but am a bit lost in terms of how to do exactly the above.

Thanks,
Rob

compute msd all msd com yes
fix msd all ave/time 1 1 8000 c_msd[4] file msddumpfile

should do the trick.

Steve

It works, Steve - thanks!

Let me make sure I correctly understand the new command syntax.

fix msd all ave/time 1 1 8000 c_msd[4] file msddumpfile

The first ‘1’, Nevery = 1, means LAMMPS takes the coordinates on the 1st timestep following the ‘run’ command as the reference state for the msd calc. The second ‘1’, Nrepeat = 1, means LAMMPS isn’t actually time-averaging here, but always calculates the msd relative to this same reference state, every 8000 timesteps. That’s exactly what the old fix_msd did, what the doc page describes, and is what I wanted, so I’m happy on that score :slight_smile:

But this leads to a followup question. The line on the doc page, “For example, if Nevery=2, Nrepeat=6, and Nfreq=100, then values on timesteps 90,92,94,96,98,100 will be used to compute the final average on timestep 100. Similarly for timesteps 190,192,194,196,198,200 on timestep 200, etc.” is a bit confusing in the context of computes where there is a reference state.

Supposing I put Nevery = 2 and Nrepeat = 6 in the above fix command. Then, the MSD output at step 8000 would be an average over the MSDs at steps 7990, 7992, …, 8000. However, these will all use the same, single reference state (step 0), right?

And the various ‘ave’ options to the fix, ‘one’, ‘running’, and ‘window’, all still use the single reference state, right? In other words, using multiple reference states would require additional computes, right?

Don’t need to do this now, just want to make sure I understand the new syntax. It seems quite powerful!

Thanks,
Rob

Fix ave/time knows nothing about reference states. It simply
knows the value that the source gives it on each requested
timestep, in this case from the MSD compute. There is no
mechanism in LAMMPS to compute and average some
arbitrary quantity from a bunch of reference states, except
for fix ave/correlate. That works for scalar quanatities, but
doing it for a per-atom quantity like MSD would require storing
many,many states (each of which is N atom coords), which
is not feasible in many contexts.

Steve

Hi, guys. Is there currently a command to compute mean quartic displacement, i.e. <displacement^4>? This is of course different from ^2. Looked at the fix_msd docs and didn’t see anything along these lines. But figure it might have already been added to LAMMPS since it’s such a useful quantity (e.g. when dynamics are heterogenous). If the capability isn’t currently there, I’d be happy to add it. I have a code from an old non-stock version of LAMMPS that did this, and would just need to update it for the new “compute” method of calculating msd.

Thanks,
Rob

No, it's not in the code. I would suggest adding it as an
option to compute msd, since every else that is needed
is already there. It could just calculate an extra set of
columns for the 4th power quantity, if requested by the user.

Steve

Dear all

In using the lammps 2011.07.01 version yesterday, I discovered that the dump file has the following form

ITEM: TIMESTEP
ITEM: NUMBER OF ATOMS
ITEM: BOX BOUNDS pp pp pp
-0.219812 21.5598
ITEM: ATOMS id type x y z
303 1 1.70902 2.37388 2.2741
236 1 0.835581 -0.16827 1.60078
123 1 4.4088 2.48904 2.42421
223 1 5.61772 0.194655 0.950025
...

and does not output the timestep and number of atoms values anymore. What do I have to add/change in the input file (attached herewith) to recover this

before I used the 2010 / 05 /01 version of lammps

Thanks for your response.
Best,
Noel

in.alh (1.18 KB)

Dear all

In using the lammps 2011.07.01 version yesterday, I discovered that the dump
file has the following form

ITEM: TIMESTEP
ITEM: NUMBER OF ATOMS
ITEM: BOX BOUNDS pp pp pp
-0.219812 21.5598
-0.219812 21.5598
-0.219812 21.5598
ITEM: ATOMS id type x y z
303 1 1.70902 2.37388 2.2741
236 1 0.835581 -0.16827 1.60078
123 1 4.4088 2.48904 2.42421
223 1 5.61772 0.194655 0.950025
...

and does not output the timestep and number of atoms values anymore. What do
I have to add/change in the input file (attached herewith) to recover this

nothing. it works for me with the current version of lammps.

what platform are you running on?
did you compile lammps yourself?

the part that outputs the header in lammps hasn't been
changed since, as the following excerpt from "git blame"
clearly demonstrates. the only possible problem can be
in the BIGINT_FORMAT, but that hasn't changed for a
about a year either, so it is most likely that you have a
somehow miscompiled executable.

axel.

5a0f2e17 (sjplimp 2009-03-16 22:34:07 +0000 341)
140cdf94 (sjplimp 2011-01-07 21:42:19 +0000 342) void
DumpCustom::header_item(bigint ndump)
222c9550 (sjplimp 2006-09-27 19:51:33 +0000 343) {
209f169c (sjplimp 2007-01-30 00:22:05 +0000 344) fprintf(fp,"ITEM:
TIMESTEP\n");
d5b49439 (sjplimp 2011-01-14 15:53:06 +0000 345)
fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep);
209f169c (sjplimp 2007-01-30 00:22:05 +0000 346) fprintf(fp,"ITEM:
NUMBER OF ATOMS\n");
d5b49439 (sjplimp 2011-01-14 15:53:06 +0000 347)
fprintf(fp,BIGINT_FORMAT "\n",ndump);
d4b0e145 (sjplimp 2011-04-11 19:37:10 +0000 348) fprintf(fp,"ITEM:
BOX BOUNDS %s\n",boundstr);
9e1f8bcd (sjplimp 2007-03-08 00:54:02 +0000 349) fprintf(fp,"%g
%g\n",boxxlo,boxxhi);
9e1f8bcd (sjplimp 2007-03-08 00:54:02 +0000 350) fprintf(fp,"%g
%g\n",boxylo,boxyhi);
9e1f8bcd (sjplimp 2007-03-08 00:54:02 +0000 351) fprintf(fp,"%g
%g\n",boxzlo,boxzhi);
5a0f2e17 (sjplimp 2009-03-16 22:34:07 +0000 352) fprintf(fp,"ITEM:
ATOMS %s\n",columns);
5a0f2e17 (sjplimp 2009-03-16 22:34:07 +0000 353) }

Dear Axel

I did not compile myself the code. It was compiled by the administrators of the french national plateform IDRIS (IBM power6 machine). So I will forward your mail to them to solve the problem.
Many thanks for your response

All the best
Noel

Le 05/02/2012 16:35, Axel Kohlmeyer a �crit :

Dear Axel

I did not compile myself the code. It was compiled by the administrators of
the french national plateform IDRIS (IBM power6 machine). So I will forward

o dear. the IBM compilers on AIX have been very problematic,
since they don't fully conform to the c/c++ standards that LAMMPS
is relying on to use 64-bit integers in a portable way.

it is possible that your administrators just ignored warnings
and/or changed the code so that it compiles without regard
of the implications on the correctness and functionality.

your mail to them to solve the problem.

there have been repeated discussions on the subject
in the mailing list archives. i would recommend to first
try compiling the current version and then let us know,
if there are still issues.

btw: compiling/running lammps doesn't require any system
administrator privilege, so you also have the option to
compile a custom version by yourself.

good luck,
    axel.