[lammps-users] print the sum of velocity of certain atoms

Hi everyone:

   I am doing a simulation of an alloy with two elements.
   I want to print the sum of velocity of certain atoms respectively in the log file every timestep.
   Could someone teach me how to?

Cheng Hao

Here’s a fix I wrote which would be useful for you. It writes the average force, velocity, and position of a group to a file. I used it to watch force fluctuations on a wall I was using to drive the system. It may not work against more recent LAMMPS releases with the revamped “compute” structure. It is known to work against the 29 Nov 06 release.


fix_sumforce.cpp (3.78 KB)

fix_sumforce.h (930 Bytes)

You can print the center-of-mass velocity of a group of atoms
by defining a variable and printing the variable with thermodynamics.

See the doc pages for the variable and thermo custom commands.