Use hoomd.hpmc.external.user.CPPExternalPotential but with global property parameters

17 views
Skip to first unread message

ch wang

unread,
May 16, 2023, 1:01:50 PM5/16/23
to hoomd-users
Dear all,

When building an external potential using hoomd.hpmc.external.user.CPPExternalPotential to run hpmc simulations, I found the built-in parameters, like r_i, diameter can't meet my potential energy function. I want to use global property parameters, like the number of particles in solid phase. Is it possible to pass Python code to external potential, or are there other better ways to implement this purpose?

Thank you in advance.

Chaohong

Joshua Anderson

unread,
May 18, 2023, 9:03:30 AM5/18/23
to hoomd...@googlegroups.com
Chaohong,

You can embed constant parameters in your source code. f-strings are one convenient way to do this.

For computed global parameters, there aren't any good options currently. For CPP pair potentials, you can write a custom Updater that sets `param_array` entries. However,  `CPPExternalPotential` does not provide a similar `param_array`. You could modify the C++ code to add it (if you do, please submit a pull request to make this available to others in HOOMD releases). 

Note that the CustomUpdater would change parameters only when your updater is triggered and not with every individual trial move. This breaks detailed balance and will impact the accuracy of your calculation. There is no way to solve this in HOOMD, which is designed around the assumption that all trial moves can be evaluated using *only* the local state.

You mention the "number of particles in the solid phase". Perhaps umbrella sampling would be a more appropriate solution? You can structure umbrella sampling to operate at the level of timesteps (accepting rejecting whole series of timesteps) thereby maintaining detailed balance and removing the need for variable parameters in an external potential.
------
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/d5633b0d-e8b7-49c4-9634-cb7b196c1892n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages