hoomd-blue icon indicating copy to clipboard operation
hoomd-blue copied to clipboard

Implement brute force overlap search for SDF compute

Open tcmoore3 opened this issue 3 years ago • 3 comments

Description

This PR implements a brute force search for finding overlaps in hpmc.compute.SDF. In contrast to the binary search algorithm that is currently in place, the "first" overlap for a pair of particles is found by iteratively scaling down the vector connecting their centers and checking for overlaps at each scale value. The compute also weights the points added to the histogram by a factor that is a function of the change in energy upon overlap, where we now have a notion of "soft overlaps" that result from a change in the interaction energy for a pair of particles in addition to the "hard overlaps" that are a standard HPMC concept. By considering soft overlaps, we can accurately calculate the pressure in systems of patchy particles.

The user-facing API is unaffected by these changes. The binary search is valid for athermal systems of convex particles, and is much faster than the brute force method in that case. Therefore, upon computation of the SDF, we check if there is a patch energy evaluator and only use the brute force method if there is. Otherwise, we use the binary search method.

Motivation and context

This change is needed to calculate the pressure in systems with discontinuous pair potentials where the change in the energy for a pair of particles can be a nonmonotonic function of their separation (e.g., patchy particles or non-convex hard particles).

How has this been tested?

I have done fairly extensive tests for systems of patchy hexagons. I ran a series of NPT simulations at several pressures and temperatures and constructed equations of state isotherms. I then ran NVT systems at the same temperatures and the mean densities from the NPT simulations. The two sets of isotherms (obtained from NPT simulations and obtained from NVT simulations) overlap well within error bars. Pressures measured in NVT simulations are generally accurate to within 2 decimals places of the pressure that gave the corresponding density in NPT simulations.

I plan on doing similar tests (probably not as comprehensive but several state points) for several different systems that span dimensionality (2D vs 3D), shape (e.g., polygons, polyhedra, spheres), and density.

Change log

- Enable pressure measurement via hpmc.compute.SDF for systems with pair potentials

Checklist:

tcmoore3 avatar Jul 05 '22 16:07 tcmoore3

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Jul 31 '22 19:07 github-actions[bot]

@tcmoore3 Let us know if you have any questions.

joaander avatar Aug 01 '22 14:08 joaander

This is ready for another set of reviews. It especially needs a careful review of whether I correctly account for the patch cutoff when building the AABB around particle i in the AABB tree search.

tcmoore3 avatar Aug 01 '22 20:08 tcmoore3

I addressed Brandon's last round of suggestions, so I think this is good to go now.

tcmoore3 avatar Aug 24 '22 14:08 tcmoore3

Thanks!

joaander avatar Aug 24 '22 14:08 joaander