|
faunus
|
Helper class for smart MC moves that preferentially samples within Regions. More...
#include <smart_montecarlo.h>
Public Member Functions | |
| RegionSampler (double outside_acceptance, std::unique_ptr< Region::RegionBase > region) | |
| void | to_json (json &j) const |
| Serialise to json. | |
| template<GroupOrParticle T, std::ranges::range Range> | |
| std::optional< Selection< T > > | select (Range &range, Random &random) |
| Select a random element from range and perform region check. More... | |
| template<GroupOrParticle T> | |
| double | bias (const Selection< T > &selection) |
Public Attributes | |
| std::optional< double > | fixed_number_inside |
| Optionally give a fixed number inside. | |
Protected Attributes | |
| const std::unique_ptr< Region::RegionBase > | region |
| This defines the smart MC region. | |
Helper class for smart MC moves that preferentially samples within Regions.
Responsibilities:
Region| Faunus::SmarterMonteCarlo::RegionSampler::RegionSampler | ( | double | outside_acceptance, |
| std::unique_ptr< Region::RegionBase > | region | ||
| ) |
| outside_acceptance | Probability to accept element outside the region |
| region | Region to preferentially pick from |
| double Faunus::SmarterMonteCarlo::RegionSampler::bias | ( | const Selection< T > & | selection | ) |
selection has been setThis function is typically called after a MC move and will determine the bias due to non-uniform sampling which depends on the transition directions, i.e. if an element is moved from inside of the region to the outside etc.
| std::optional< Selection< T > > Faunus::SmarterMonteCarlo::RegionSampler::select | ( | Range & | range, |
| Random & | random | ||
| ) |
Select a random element from range and perform region check.
Typically before a move.
| range | Range of particles or groups |
| random | Random number object used to perform a random selection |
Loops until a perturbable element is found. If a max number of attempts is reached without any selection, an empty object is returned and a warning issued. The maximum number of attempts is currently set to 10x the size of the given range.
1.8.13