-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patchy particle pressure #66
Conversation
…d-validation into patchy-particle-pressure
With short simulations, I tested:
with patch code:
at a variety of pressures (2-10) and densities (around ~0.7). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you have GPU jobs definitions in the workflow. Do you plan to validate that these work properly before merging?
hoomd_validation/config_parser.py
Outdated
@@ -34,7 +34,7 @@ def __init__(self, config_file_path=DEFAULT_CONFIG_PATH): | |||
config.get("max_cores_submission", 16)) | |||
self["max_gpus_submission"] = int(config.get("max_gpus_submission", 1)) | |||
self["max_walltime"] = int(config.get("max_walltime", 24)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self["max_walltime"] = int(config.get("max_walltime", 24)) | |
self["max_walltime"] = float(config.get("max_walltime", 24)) |
For consistency with the below change.
hoomd_validation/init.py
Outdated
# alj_2d, | ||
# lj_fluid, | ||
# lj_union, | ||
# hard_disk, | ||
# hard_sphere, | ||
# simple_polygon, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# alj_2d, | |
# lj_fluid, | |
# lj_union, | |
# hard_disk, | |
# hard_sphere, | |
# simple_polygon, | |
alj_2d, | |
lj_fluid, | |
lj_union, | |
hard_disk, | |
hard_sphere, | |
simple_polygon, |
hoomd_validation/init.py
Outdated
# hard_disk, | ||
# hard_sphere, | ||
# simple_polygon, | ||
patchy_particle_pressure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patchy_particle_pressure | |
patchy_particle_pressure, |
hoomd_validation/util.py
Outdated
@@ -28,7 +28,7 @@ def get_job_filename(sim_mode, device, name, type): | |||
return f"{sim_mode}_{suffix}_{name}.{type}" | |||
|
|||
|
|||
def run_up_to_walltime(sim, end_step, steps, walltime_stop): | |||
def run_up_to_walltime(sim, end_step, steps, walltime_stop, minutes_per_run=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def run_up_to_walltime(sim, end_step, steps, walltime_stop, minutes_per_run=None): | |
def run_up_to_walltime(sim, end_step, steps, walltime_stop): |
unused.
hoomd_validation/util.py
Outdated
|
||
if numpy.all(data_arr == data_arr[0]): | ||
histogram[:] = 0 | ||
|
||
max_density_histogram = max(max_density_histogram, numpy.max(histogram)) | ||
|
||
ax.plot(bin_edges[:-1], histogram, label=mode) | ||
if plot_rotated: | ||
XX, YY = histogram, bin_centers #bin_edges[:-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the need for the variables by placing the call to plot
inside the conditional.
Alternately, replace meaningless XX and YY variable names with something meaningful.
hoomd_validation/util.py
Outdated
ax.set_ylabel(xlabel) | ||
ax.set_xlabel('probability density') | ||
else: | ||
XX, YY = bin_edges[:-1], histogram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unrotated plot should also use bin_centers
.
hoomd_validation/util.py
Outdated
#Y, X = bin_edges[:-1], expected(bin_edges[:-1]) | ||
Y, X = bin_centers, expected(bin_centers) | ||
else: | ||
X, Y = bin_edges[:-1], expected(bin_edges[:-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unrotated plot should also use bin_centers
.
hoomd_validation/util.py
Outdated
expected(bin_edges[:-1]), | ||
if plot_rotated: | ||
#Y, X = bin_edges[:-1], expected(bin_edges[:-1]) | ||
Y, X = bin_centers, expected(bin_centers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the need for the variables by placing the call to plot
inside the conditional.
Alternately, name these variables with a PEP8 compliant name.
hoomd_validation/util.py
Outdated
@@ -299,3 +318,46 @@ def plot_timeseries(ax, | |||
def _sort_sim_modes(sim_modes): | |||
"""Sort simulation modes for comparison.""" | |||
sim_modes.sort(key=lambda x: ('nvt' in x or 'nec' in x, 'md' in x, x)) | |||
|
|||
|
|||
def _single_patch_kern_frenkel_code(delta_rad, lambda_, sigma, kT): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this function to patchy_particle_pressure.py
.
|
||
@Project.pre.after(patchy_particle_pressure_create_initial_state) | ||
@Project.post.isfile(f'{mode}_{device_name}_complete') | ||
#@Project.post(lambda j: j.isfile(f'{mode}_{device_name}_complete') or j.sp.pressure <= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#@Project.post(lambda j: j.isfile(f'{mode}_{device_name}_complete') or j.sp.pressure <= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More fixes to prevent deadlock.
print(f'completed patchy_particle_pressure_{mode}_{device_name} ' | ||
f'{job} in {communicator.walltime} s') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print(f'completed patchy_particle_pressure_{mode}_{device_name} ' | |
f'{job} in {communicator.walltime} s') | |
print(f'completed patchy_particle_pressure_{mode}_{device_name}: {job}') |
See #67.
print(f'completed patchy_particle_pressure_create_initial_state: ' | ||
f'{job} in {communicator.walltime} s') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print(f'completed patchy_particle_pressure_create_initial_state: ' | |
f'{job} in {communicator.walltime} s') | |
print(f'completed patchy_particle_pressure_create_initial_state: {job}') |
See #67.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! There is one minor change to make, then this is ready to merge.
# (10.0, 0.95, 11.951630531873338, 0.7, 1.5, 1.0), | ||
(1.0, 0.95, 10.208625410213362, 0.7, 1.5, 1.0), | ||
# (0.6, 0.95, 8.927827449359, 0.7, 1.5, 1.0), | ||
# hard sphere + square well statepoints, from 10.1063/1.3054361 | ||
# pressure from NVT simulations, NOT from values in paper | ||
# (0.5714, 0.8, -0.2692376274894095, 1.0, 1.5, 1.0), | ||
# (1.0, 0.8, 2.2766339608381325, 1.0, 1.5, 1.0), | ||
(3.0, 0.8, 4.837436833423719, 1.0, 1.5, 1.0), | ||
# hard sphere + square well + repulsive shoulder statepoints. | ||
# temperatures/densities from initial tests, pressures from NVT | ||
# simulations. | ||
(3.0, 0.7, 4.00804, 1.0, 1.0, -1.0), | ||
# (1.0, 0.7, -5.0, 1.0, 1.0, -1.0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# (10.0, 0.95, 11.951630531873338, 0.7, 1.5, 1.0), | |
(1.0, 0.95, 10.208625410213362, 0.7, 1.5, 1.0), | |
# (0.6, 0.95, 8.927827449359, 0.7, 1.5, 1.0), | |
# hard sphere + square well statepoints, from 10.1063/1.3054361 | |
# pressure from NVT simulations, NOT from values in paper | |
# (0.5714, 0.8, -0.2692376274894095, 1.0, 1.5, 1.0), | |
# (1.0, 0.8, 2.2766339608381325, 1.0, 1.5, 1.0), | |
(3.0, 0.8, 4.837436833423719, 1.0, 1.5, 1.0), | |
# hard sphere + square well + repulsive shoulder statepoints. | |
# temperatures/densities from initial tests, pressures from NVT | |
# simulations. | |
(3.0, 0.7, 4.00804, 1.0, 1.0, -1.0), | |
# (1.0, 0.7, -5.0, 1.0, 1.0, -1.0), | |
(1.0, 0.95, 10.208625410213362, 0.7, 1.5, 1.0), | |
# hard sphere + square well statepoints, from 10.1063/1.3054361 | |
# pressure from NVT simulations, NOT from values in paper | |
(3.0, 0.8, 4.837436833423719, 1.0, 1.5, 1.0), | |
# hard sphere + square well + repulsive shoulder statepoints. | |
# temperatures/densities from initial tests, pressures from NVT | |
# simulations. | |
(3.0, 0.7, 4.00804, 1.0, 1.0, -1.0), |
Remove unused state points.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Description
Validate pressure computation for discontinuous pair potentials simulated with HPMC.
I also changed the comparison plots to show the distributions of sampled pressures and densities.
Motivation and context
The pressure pressure computation for systems with discontinuous pair potentials in HPMC is currently not tested for validity but should be.
I will add another validation test for the hard sphere + square well + square shoulder system we discussed, but I wanted to get this PR opened because the code will not change very much.
Resolves #43.
How has this been tested?
We discovered a conceptual error in the implementation of the SDF calculation for systems with pair potentials. We implemented a fix at glotzerlab/hoomd-blue@8d7cb2c. That commit is the version of HOOMD-blue I used to generate the results below.
I ran NVT simulations of 4,096 particles interacting either through a hard sphere + square well potential, or through a Kern–Frenkel potential, i.e., a hard sphere + square well model with an angular component to the pair potential. I ran NVT simulations, measured the pressure for the given density and temperature, and then ran NPT simulations at the corresponding pressure. The agreement between the pressure measured in NVT simulations and the density measured at the corresponding NPT simulations is shown in the figures below. These results are from 16 replicates at each statepoint. \chi = 1.0 corresponds to the hard sphere + square well state points, and \chi = 0.7 is the Kern–Frenkel model.
Checklist:
CONTRIBUTORS.md
) in the pull request source branch.