RANDOM GENERATOR: Difference between revisions

From VASP Wiki
(Created page with "{{TAGDEF|RANDOM_GENERATOR|default {{!}} pcg_32}} Description: {{TAG|RANDOM_GENERATOR}} specifies the random-number generator used to initialize the wave function (see {{TAG|INIWAV}}), initialize atomic velocities for molecular dynamics, or other random numbers generated in VASP. ---- The random-number generator (RNG) generates a sequence of random numbers, which is initialized by the tag {{TAG|RANDOM_SEED}}. By default the random number generator uses a very stable, c...")
(No difference)

Revision as of 12:32, 21 October 2025

RANDOM_GENERATOR = default | pcg_32 

Description: RANDOM_GENERATOR specifies the random-number generator used to initialize the wave function (see INIWAV), initialize atomic velocities for molecular dynamics, or other random numbers generated in VASP.


The random-number generator (RNG) generates a sequence of random numbers, which is initialized by the tag RANDOM_SEED. By default the random number generator uses a very stable, compiler and platform independent algorithm. It is based on the work: "Toward a Universal Random Number Generator" by George Marsaglia and Arif Zaman. Florida State University Report: FSU-SCRI-87-50 (1987) and was later modified by F. James and publisheed [1]. This algorithm is programmed in serial, not utilizing any threading or parallelism. For normal system the time to initialize wave functions is negligible, but for large systems with many bands NBANDS>1000, and plane wave coefficients this can take several seconds to minutes.

For such systems it can be advantageous to switch RANDOM_GENERATOR = pcg_32, which is a threaded (need to enable OpenMP threading at compile time) over the number of threads used. The algorithm is also guaranteed to produce the same random numbers in each call, but might depend on the compiler and library used. Compared to the default generator it is thus not platform independent if you need strictly reproducible results across different machines or VASP versions. However, this will not influence the converged results.

Related tags and articles

INIWAV RANDOM_SEED

Examples that use this tag