Unknown warning

Dear LAMMPS developers and users

I’m going to simulate TIP4P as rigid molecules and to remove drift I’d like to use the following commands:

velocity all create $T 123456 rot yes mom yes
fix 1 water rigid/nvt/small molecule temp $T $T 100
velocity water zero linear rigid 1
run 100

However, the warning below will appear:

WARNING: Changing velocities of atoms in rigid bodies. This has no effect unless rigid bodies are rebuild (…/velocity.cpp:74)

How can I get around that warning? Should I change the order of commands?

Bests

Define your rigid bodies (via fix rigid), after setting
the velocities you want.

Steve

Dear Steve
Thanks for your reply
However, as shown below, velocity zero must be set after defining a fix, since it includes the fix id, in my case 1:

velocity all create $T 123456 rot yes mom yes
fix 1 water rigid/nvt/small molecule temp $T $T 100
velocity water zero linear rigid 1
run 100

Is it a bug?

I didn’t notice you were using the rigid option in the velocity command.
If you use the 2nd velocity command before fix rigid to zero the momentum,
then you don’t need the rigid option.

Creating rigid bodies will not change the net momentum of the system.

Steve