BoxMCMoveSize¶
- class hoomd.hpmc.tune.BoxMCMoveSize(trigger, boxmc, moves, target, solver, max_move_size=None)¶
Tunes
BoxMCmove sizes to targeted acceptance rate.Tip
For most common creation of a
BoxMCMoveSizetuner seeBoxMCMoveSize.secant_solverandBoxMCMoveSize.scale_solverrespectively.The tuner will continue tuning despite being
tuned. Thus, if simulation conditions change the move sizes will continue to change and the tuner will no longer betuned. The changes to the move size are completely controlled by the givenhoomd.tune.RootSolverinstance. See the documentation athoomd.tunefor more information.Warning
The tuner should be removed from the simulation once tuned to prevent invalid results due to the breaking of balance.
- Parameters:
trigger (hoomd.trigger.trigger_like) –
Triggerto determine when to run the tuner.boxmc (hoomd.hpmc.update.BoxMC) – The
hoomd.hpmc.update.BoxMCobject to tune.moves (list[str]) – A list of types of moves to tune. Available options are ‘volume’, ‘aspect’, ‘shear_{x,y,z}’, and ‘length_{x,y,z}’ where brackets denote multiple options. For shear and length moves each dimension is tuned independently.
target (float) – The acceptance rate for trial moves that is desired. The value should be between 0 and 1.
solver (
hoomd.tune.RootSolver) – A solver that tunes move sizes to reach the specified target.max_move_size (
dict[str,float], optional) – The maximum volume move size to attempt for each move time. See the available moves in themovesattribute documentation. Defaults to no maximumNonefor each move type.
Warning
Over-limiting the maximum move sizes can lead to the inability to converge to the desired acceptance rate.
Warning
Since each dimension of length and shear moves are tuned independently but the acceptance statistics are collected collectively, the reachable target acceptance rates is limited by the other dimensions.
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
BoxMCMoveSize:- boxmc¶
The
hoomd.hpmc.update.BoxMCobject to tune.- Type:
- moves¶
A list of types of moves to tune. Available options are ‘volume’, ‘aspect’, ‘shear_{x,y,z}’, and ‘length_{x,y,z}’ where brackets denote multiple options. For shear and length moves each dimension is tuned independently.
- target¶
The acceptance rate for trial moves that is desired. The value should be between 0 and 1.
- Type:
- solver¶
A solver that tunes move sizes to reach the specified target.
- Type:
- max_move_size¶
The maximum volume move size to attempt for each move time. See the available moves in the
movesattribute documentation.- Type:
- classmethod scale_solver(trigger, boxmc, moves, target, max_move_size=None, max_scale=2.0, gamma=1.0, tol=0.01)¶
Create a
BoxMCMoveSizetuner with ahoomd.tune.ScaleSolver.- Parameters:
trigger (hoomd.trigger.trigger_like) –
Triggerto determine when to run the tuner.boxmc (hoomd.hpmc.update.BoxMC) – The
hoomd.hpmc.update.BoxMCobject to tune.moves (list[str]) – A list of types of moves to tune. Available options are ‘volume’, ‘aspect’, ‘shear_{x,y,z}’, and ‘length_{x,y,z}’ where brackets denote multiple options. For shear and length moves each dimension is tuned independently.
target (float) – The acceptance rate for trial moves that is desired. The value should be between 0 and 1.
max_move_size (float) – The maximum value of a volume move size to attempt.
max_scale (float) – Maximum scale factor.
gamma (float) – The value of gamma to pass through to
hoomd.tune.ScaleSolver. Controls the size of corrections to the move size (larger values increase stability while increasing convergence time).tol (float) – The absolute tolerance to allow between the current acceptance rate and the target before the move sizes are considered tuned. The tolerance should not be too much lower than the default of 0.01 as acceptance rates can vary significantly at typical tuning rates.
- classmethod secant_solver(trigger, boxmc, moves, target, max_move_size=None, gamma=0.8, tol=0.01)¶
Create a
BoxMCMoveSizetuner with ahoomd.tune.SecantSolver.This solver can be faster than
hoomd.tune.ScaleSolver, but depending on the system slightly less stable. In general, with the default value of gamma this should not be a problem.- Parameters:
trigger (hoomd.trigger.trigger_like) –
Triggerto determine when to run the tuner.boxmc (hoomd.hpmc.update.BoxMC) – The
hoomd.hpmc.update.BoxMCobject to tune.moves (list[str]) – A list of types of moves to tune. Available options are ‘volume’, ‘aspect’, ‘shear_{x,y,z}’, and ‘length_{x,y,z}’ where brackets denote multiple options. For shear and length moves each dimension is tuned independently.
target (float) – The acceptance rate for trial moves that is desired. The value should be between 0 and 1.
max_move_size (float) – The maximum value of a volume move size to attempt, defaults to
Nonewhich represents no maximum move size.gamma (float) – The value of gamma to pass through to
hoomd.tune.SecantSolver. Controls the size of corrections to the move size (smaller values increase stability). Should be between 0 and 1, defaults to 0.8.tol (float) – The absolute tolerance to allow between the current acceptance rate and the target before the move sizes are considered tuned. The tolerance should not be too much lower than the default of 0.01 as acceptance rates can vary significantly at typical tuning rates.
Note
Increasing
gammatowards 1 does not necessarily speed up convergence and can slow it down. In addition, large values ofgammacan make the solver unstable, especially when tuning frequently.