Syntax for Zero Momentum Updater

103 views
Skip to first unread message

Jakin Delony

unread,
Mar 31, 2022, 10:18:18 AM3/31/22
to hoomd-users
Dear HOOMD-blue developers,

What is the correct syntax for zeroing system momentum in v3.0?  Based on the documentation, I'd expect something along the lines of:

`zeroer = hoomd.md.update.ZeroMomentum(hoomd.trigger.Periodic(1))
sim.operations.updaters.append(zeroer)`

however, I'm getting anomalous results for mean-squared displacement depending on the zeroing protocol used.  I've attached a MWE and the initial config used here along with a plot of the MSD profiles as a function of zeroing protocol.  To clarify, "10 Timesteps" and "1000 Timesteps" indicate the trigger in the first line.  "Commented" indicates that the first line defining the zeroer is present, but the second line adding it to the simulation operations list is commented out, and "Disabled" indicates that neither line is used (i.e., no momentum zeroing at all).

I would expect "Disabled" and "Commented" to yield the same results since defining an updater and not adding it to the simulation state should have no effect.  I'd also expect the trigger frequency to have an effect on MSD as linear momentum is allowed to accumulate for varying periods of time, but as shown here the trigger frequency does not matter.

It is possible that there is an issue with the custom PCND functionality I am testing, but the unexpected behavior in MSD is concerning as well.

Thanks for your help,
Jakin
multi_chain_Xi_0.1_NVT.gsd
multi_chain_Xi_0.01_MWE.py
MSD_Small_Xi_Tau_100_Zeroer_Comps.png

Joshua Anderson

unread,
Apr 4, 2022, 6:05:36 AM4/4/22
to hoomd...@googlegroups.com
Jakin,

Does the issue persist when you remove PCND?

The proper way to use ZeroMomentum is not to use it at all. `hoomd.md.methods.NVT` is momentum conserving and there is no need to drastically slow your simulation by applying the CPU implemented ZeroMomentum on every time step.

If you have unknown velocity inputs and prefer not to thermalize the velocities to new random ones, ZeroMomentum is useful to run only on the first timestep to remove any center of mass motion before starting the simulation.

If you have a large amount of momentum drift in your simulation, you may have set too large a step size or may have overlapping particles in the initial configuration. Also check that all forces (such as your new PCND) sum to 0 across the system.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
> --
> You received this message because you are subscribed to the Google Groups "hoomd-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/ff35e91f-d911-4909-b9a7-94a6a7da496en%40googlegroups.com.
> <multi_chain_Xi_0.1_NVT.gsd><multi_chain_Xi_0.01_MWE.py><MSD_Small_Xi_Tau_100_Zeroer_Comps.png>

Jakin Delony

unread,
Apr 13, 2022, 4:39:05 PM4/13/22
to hoomd-users
Dr. Anderson,

No - ZeroMomentum appears to function as expected without PCND when tested on both an LJ liquid and a simple bulk linear homopolymer system.  I tested by annealing these systems under NPT conditions to yield the proper density, then started an NVT run with all particles initialized with a highly unidirectional velocity to intentionally induce momentum drift.  The ZeroMomentum functionality effectively eliminates this effect as shown in the attached MSD profiles obtained via Freud.

Unfortunately, I believe I have ruled out step size or particle overlap issues as I fully equilibrate my test systems under nominal MD before adding the PCND functionality to the simulation state.

I will see if I can query the PCND particle forces and check their statistics, as they should sum to 0 as you had mentioned.  Thanks for the suggestions.
MSD_Nonbonded_PreAnnealed.png
MSD_Polymer_PreAnnealed.png
Reply all
Reply to author
Forward
0 new messages