Single Particle Pressure

199 views
Skip to first unread message

Yuchen Xi

unread,
Sep 27, 2020, 7:25:39 PM9/27/20
to hoomd-users
Hi all,

I am doing a bidisperse sphere particle simulation under brownian motion using HOOMD. I am trying to calculate every single particle's pressure during simulation. I know that HOOMD has commands like hoomd.analyze.log and hoomd.compute.thermo that help calculate averaged system pressure. But is there a way to let HOOMD split out pressure values of every single particles in the system during simulation?

Any help would be acknowledged!

Thanks
Lawrence



Joshua Anderson

unread,
Sep 28, 2020, 8:33:16 AM9/28/20
to hoomd...@googlegroups.com
Lawrence,

Pressure is a thermodynamic variable defined over the entire system as it involves sums over pair (and/or N-way) virial terms. You need to define the precise quantity you would like to calculate.

When you have pair, bond, angle, dihedral, and/or improper force terms, HOOMD does compute a per particle virial which may be what you are looking for. It distributes the pairwise (and N-way) virial terms equally among all the participating particles (e.g. 1/2 to each particle in the pair). You can access this with the net_virial particle data or force data property.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
http://www-personal.umich.edu/~joaander/


--
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/f0957aed-8dbd-4266-b929-6230a48798bcn%40googlegroups.com.

Yuchen Xi

unread,
Sep 28, 2020, 11:56:33 PM9/28/20
to hoomd...@googlegroups.com
Hi Dr. Anderson

Thanks for your reply!
I've also noticed that the command hoomd.analyze.log can generate a file that contains system pressure values over a certain period. I am curious about how these pressure values are calculated. Are they averaged over all single particle's pressures? If they are calculated this way, then I might be able to extract pressure values of every single particle over a certain period of time.

Thanks
Lawrence

You received this message because you are subscribed to a topic in the Google Groups "hoomd-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hoomd-users/iCp6FMNynAE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CADqmvgcBiG%3DB-EGMoAXrFkv%3DLCBwxraPy0XW0_vKPkZ%3D_zCJ%2Bg%40mail.gmail.com.

Joshua Anderson

unread,
Sep 29, 2020, 8:15:03 AM9/29/20
to hoomd...@googlegroups.com
Lawrence,

We are improving this documentation in the upcoming v3.0 release. You can find a draft of the documentation here: https://github.com/glotzerlab/hoomd-blue/blob/57b7b8bd11eddddfe2aa785ed02541acb882df32/hoomd/md/compute.py#L71-L92
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
http://www-personal.umich.edu/~joaander/

Yuchen Xi

unread,
Oct 2, 2020, 5:21:26 AM10/2/20
to hoomd-users
Hi Dr. Anderson

As you previously suggested, I tried to use hoomd.data.particle_data_proxy to access single particle properties. Specifically, I loop through every particle tags using print(system.particles[tags]) after the simulation. However, the net_virial terms were all zeros for my particles. 

My system is a 3D box with bidisperse particles undergoing brownian motions. I was anticipating non-zero virial terms. 

Lawrence

Joshua A. Anderson

unread,
Oct 2, 2020, 6:57:57 AM10/2/20
to hoomd...@googlegroups.com
Lawrence,

What integrator and potentials are you using?

For performance, HOOMD only computes the virial on timesteps where it is required. In HOOMD 2.x, the only ways to force virial computations is through the analyze.log framework. You will need to check the contents of the net_virial on those timesteps that analyze.log writes out pressure.

HOOMD v3 will provide a flag to enable the virial computations always.

------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

Yuchen Xi

unread,
Oct 2, 2020, 8:06:18 AM10/2/20
to hoomd-users
Hi Dr. Anderson

I am using brownian integrator and lj potentials. I am having the latest version of HOOMD.

I was trying to find local particle's net virials. I suppose that analyze.log only splits out system pressure as a whole. That's why I am using particle_data_proxy to find individual particle's properties.

Lawrence

Brandon Butler

unread,
Oct 2, 2020, 10:04:45 AM10/2/20
to hoomd...@googlegroups.com
Lawrance,

While you may not want the net virial, HOOMD-blue does not compute the virial unless necessary or specified by the users to avoid unnecessary computation. In HOOMD v2, this means to force the computing of virials a user needs to  log a quantity like the net viral. This is the only way for HOOMD v2 to know you want the virials. You can then disregard the net virials and look at the individual particle virials if you want. Like Josh says, HOOMD v3 will have a flag that allows users to specify when they want to calculate the virials every timestep.



--
Brandon Butler
PhD Candidate Glotzer Lab
Department of Chemical Engineering
University of Michigan, Ann Arbor

Yuchen Xi

unread,
Oct 2, 2020, 10:16:16 AM10/2/20
to hoomd...@googlegroups.com
Hi Brandon

Thanks for your reply.

What do you mean by a flag? Is there any documentation that I can refer to?


Lawrence

Brandon Butler

unread,
Oct 2, 2020, 11:00:58 AM10/2/20
to hoomd...@googlegroups.com
Lawrence,

This is for HOOMD-blue v3 which has not yet been released. An alpha version of version 3 can be seen when looking at the documentation for the feature/new-object-API branch found at https://hoomd-blue.readthedocs.io/en/feature-new-object-api/ note that the beta has not yet been released, and the API is not considered stable. The documentation of the flag is here, https://hoomd-blue.readthedocs.io/en/feature-new-object-api/package-hoomd.html#hoomd.Simulation.always_compute_pressure.

Note that the flag does not exist in HOOMD-blue v2.x which is what you are using.

Yuchen Xi

unread,
Oct 2, 2020, 11:22:47 AM10/2/20
to hoomd...@googlegroups.com
Hi Brandon

Thanks for sharing these!

In my current version of HOOMD, do you suggest that I use analyze.log to evaluate the net virial of the system first then look at individual particle virials? How specifically do I disregard the net virials and evaluate individual particles?

Lawrence


Joshua A. Anderson

unread,
Oct 2, 2020, 11:30:39 AM10/2/20
to hoomd...@googlegroups.com
Lawrence,

You can pass `filename=None` to analyze.log to prevent it from writing output.

------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

Luke Langford

unread,
Oct 4, 2021, 2:51:59 PM10/4/21
to hoomd-users
Hi Lawrence,

Did you find a solution to your issue? I am also getting all zeros outputted for the per-particle virial. I am outputting the pressure of the system during the same time steps as suggested here but this is not solving the problem.

Thanks,
Luke

Yuchen Xi

unread,
Oct 4, 2021, 2:57:15 PM10/4/21
to hoomd...@googlegroups.com
Hi Luke

Unfortunately the issue is still there. Instead, I chose to manually calculate the particle virials based on their position outputs and intermolecular potentials.

Best
Lawrence

Joshua Anderson

unread,
Oct 4, 2021, 3:00:34 PM10/4/21
to hoomd...@googlegroups.com
All,

HOOMD v3.0-beta has a well defined API to request that virials be computed (Simulation.always_compute_pressure) and to access the per-particle virials (Force.virial)

https://hoomd-blue.readthedocs.io/en/latest/package-hoomd.html#hoomd.Simulation.always_compute_pressure
https://hoomd-blue.readthedocs.io/en/latest/module-md-force.html#hoomd.md.force.Force.virials
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CACR9c31qsErZngtbL-zEEKBPosUbXAzSpj2Sn4RCWMnxiLXLHQ%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages