sinusoidal transverse force simulation


I'm working with a student who is trying to implement a sinusoidal
transverse force simulation for calculating viscosities in MD simulation.
We can use Fix ave/spatial to calculate the streaming velocity of particles
in a cubic cell and output these histogrammed average velocities
over space and time to a file.

What we require is the ability to call the velocities of individual bins
for further computes. Specifically to subtract these numbers (the
histogrammed streaming velocities) from absolute atomic velocities on the
fly in order to derive average peculiar velocities.

In the example below we have tried calling the streaming velocities with
f_streamvel[I][J] at intervals of Nfreq, which returns an error.
“Thermo fix array is accessed out-of-range”, when called within a Thermo

Does any one have any thoughts on how we could do this? The next possible
step would be to write a new fix, based on Fix ave/spatial.
But doing this with fixes/ computes will probably be more flexible & less



Adding these 2 lines to bench/in.lj works for me:

fix streamvel all ave/spatial 1 10 10 x 0.0 0.5 vy
thermo_style custom step temp f_streamvel[4][3]

Are you using the most current version of LAMMPS?
It prints a NAN on timestep 0, but I just fixed that.