QuickCompress¶
- class hoomd.hpmc.update.QuickCompress(trigger, target_box, max_overlaps_per_particle=0.25, min_scale=0.99, allow_unsafe_resize=False)¶
Bases:
UpdaterQuickly compress a hard particle system to a target box.
- Parameters:
trigger (hoomd.trigger.trigger_like) – Update the box dimensions on triggered time steps.
target_box (
hoomd.box.box_likeorhoomd.variant.box.BoxVariant) – Dimensions of the target box.max_overlaps_per_particle (float) – The maximum number of overlaps to allow per particle (may be less than 1 - e.g. up to 250 overlaps would be allowed when in a system of 1000 particles when max_overlaps_per_particle=0.25).
min_scale (float) – The minimum scale factor to apply to box dimensions.
allow_unsafe_resize (bool) – When
True, box moves are proposed independent of particle translational move sizes.
Use
QuickCompressin conjunction with an HPMC integrator to scale the system to a target box size.QuickCompresscan typically compress dilute systems to near random close packing densities in tens of thousands of time steps. For more control over the rate of compression, use aBoxVariantfortarget_box.QuickCompressoperates by making small changes toward thetarget_box, but only when there are no particle overlaps in the current simulation state. In 3D:and in 2D:
where the current simulation box is , the target is , the new simulation box set is and is the scale factor chosen for this step (see below).
QuickCompressscales particle coordinates (seeBoxMCfor details) when it sets a new box.When there are more than
max_overlaps_per_particle * N_particleshard particle overlaps in the system in the new box, the box move is rejected. Otherwise, the small number of overlaps remain when the new box is set.QuickCompressthen waits untilhoomd.hpmc.integrate.HPMCIntegratormakes local MC trial moves that remove all overlaps.QuickCompressadjusts the value of based on the particle and translational trial move sizes to ensure that the trial moves will be able to remove the overlaps. It randomly chooses a value of uniformly distributed betweenmax(min_scale, 1.0 - min_move_size / max_diameter)and 1.0 wheremin_move_sizeis the smallest MC translational move size adjusted by the acceptance ratio andmax_diameteris the circumsphere diameter of the largest particle type. Ifallow_unsafe_resizeisTrue, box move sizes will be uniformly distributed betweenmin_scaleand 1.0 (with no consideration ofmin_move_size).When using a
BoxVariantfortarget_box,completereturnsTrueif the current simulation box is equal to the box corresponding totarget_boxevaluated at the current timestep and there are no overlaps in the system. To ensure the updater has compressed the system to the final target box, use a condition that checks both thecompleteattribute of the updater and the simulation timestep. For example:target_box = hoomd.variant.box.InverseVolumeRamp( sim.state.box, sim.state.box.volume / 2, 0, 1_000) qc = hoomd.hpmc.update.QuickCompress(10, target_box) while ( sim.timestep < target_box.t_ramp + target_box.t_start or not qc.complete): sim.run(100)
Tip
Use the
hoomd.hpmc.tune.MoveSizein conjunction withQuickCompressto adjust the move sizes to maintain a constant acceptance ratio as the density of the system increases.Warning
When the smallest MC translational move size is 0,
allow_unsafe_resizemust be set toTrueto progress toward the target box. Decreasemax_overlaps_per_particlewhen using this setting to prevent unresolvable overlaps.Warning
Use
QuickCompressORBoxMC. Do not use both at the same time.Mixed precision
QuickCompressuses reduced precision floating point arithmetic when checking for particle overlaps in the local particle reference frame.Members inherited from
AutotunedObject:- property kernel_parameters¶
Kernel parameters.
Read more...
- property is_tuning_complete¶
Check if kernel parameter tuning is complete.
Read more...
- tune_kernel_parameters()¶
Start tuning kernel parameters.
Read more...
Members inherited from
TriggeredOperation:- trigger¶
The trigger to activate this operation.
Read more...
Members defined in
QuickCompress:- target_box¶
The variant for the dimensions of the target box.
- Type:
- max_overlaps_per_particle¶
The maximum number of overlaps to allow per particle (may be less than 1 - e.g. up to 250 overlaps would be allowed when in a system of 1000 particles when max_overlaps_per_particle=0.25).
- Type:
- instance¶
When using multiple
QuickCompressupdaters in a single simulation, give each a unique value forinstanceso that they generate different streams of random numbers.- Type:
- allow_unsafe_resize¶
When
True, box moves are proposed independent of particle translational move sizes.- Type:
- property complete¶
True when the box has achieved the target.