ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Functions | |
template<RNGSalt salt> | |
auto | philox_4_uint64s (uint64_t counter, uint32_t seed, int key1, int key2=0) |
get 4 random uint 64 from the Philox RNG | |
template<RNGSalt salt, std::size_t N = 3, std::enable_if_t<(N > 1) and(N<=4), int > = 0> | |
auto | noise_uniform (uint64_t counter, uint32_t seed, int key1, int key2=0) |
Generator for random uniform noise. | |
template<RNGSalt salt, std::size_t N = 3, class = std::enable_if_t<(N >= 1) and (N <= 4)>> | |
auto | noise_gaussian (uint64_t counter, uint32_t seed, int key1, int key2=0) |
Generator for Gaussian noise. | |
template<typename T > | |
std::mt19937 | mt19937 (T &&seed) |
Mersenne Twister with warmup. | |
std::mt19937 Random::mt19937 | ( | T && | seed | ) |
Mersenne Twister with warmup.
The first 100'000 values of Mersenne Twister generators are often heavily correlated [32]. This utility function discards the first 1'000'000 values.
seed | RNG seed |
Definition at line 194 of file random.hpp.
Referenced by draw_polymer_positions().
auto Random::noise_gaussian | ( | uint64_t | counter, |
uint32_t | seed, | ||
int | key1, | ||
int | key2 = 0 |
||
) |
Generator for Gaussian noise.
Mean = 0, standard deviation = 1.0. Based on the Philox RNG using 4x64 bits. The Box-Muller transform is used to convert from uniform to normal distribution. The transform is only valid, if the uniformly distributed random numbers are not zero (approx one in 2^64). To avoid this case, such numbers are replaced by std::numeric_limits<double>::min() This breaks statistics in rare cases but allows for consistent RNG counters across MPI ranks.
salt | decorrelates different thermostat types |
counter | counter for random number generation |
seed | seed for random number generation |
key1 | key for random number generation |
key2 | key for random number generation |
Definition at line 150 of file random.hpp.
auto Random::noise_uniform | ( | uint64_t | counter, |
uint32_t | seed, | ||
int | key1, | ||
int | key2 = 0 |
||
) |
Generator for random uniform noise.
Mean = 0, variance = 1 / 12. This uses the Philox PRNG, the state is controlled by the counter, the salt and two keys. If any of the keys and salt differ, the noise is not correlated between two calls along the same counter sequence.
salt | RNG salt |
N | Size of the noise vector |
counter | counter for random number generation |
seed | seed for random number generation |
key1 | key for random number generation |
key2 | key for random number generation |
Definition at line 112 of file random.hpp.
auto Random::philox_4_uint64s | ( | uint64_t | counter, |
uint32_t | seed, | ||
int | key1, | ||
int | key2 = 0 |
||
) |
get 4 random uint 64 from the Philox RNG
This uses the Philox PRNG, the state is controlled by the counter, the salt and two keys. If any of the keys and salt differ, the noise is not correlated between two calls along the same counter sequence.
Definition at line 75 of file random.hpp.
References Utils::u32_to_u64().