RANDOM GENERATOR: Difference between revisions

From VASP Wiki
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:


----
----
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, 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 {{cite|james:rpng:1990}}. 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 {{TAGO|NBANDS|1000|op=>}}, and plane wave coefficients this can take several seconds to minutes.  
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, 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 {{cite|james:rpng:1990}}. 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 {{TAG|NBANDS|1000|op=>}}, and plane wave coefficients this can take several seconds to minutes.  


For such systems it can be advantageous to switch {{TAGO|RANDOM_GENERATOR|pcg_32}}, which is threaded (need to enable [[Combining_MPI_and_OpenMP|OpenMP threading]] at compile time) over the number of OpenMP threads. 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. Hence, use {{TAGO|RANDOM_GENERATOR|default}} for strictly reproducible numbers across different machines at all steps during the calculation or comparison of VASP versions.
For such systems it can be advantageous to switch {{TAG|RANDOM_GENERATOR|pcg_32}}, which is threaded (need to enable [[Combining_MPI_and_OpenMP|OpenMP threading]] at compile time) over the number of OpenMP threads. 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. Hence, use {{TAG|RANDOM_GENERATOR|default}} for strictly reproducible numbers across different machines at all steps during the calculation or comparison of VASP versions.


== Related tags and articles ==
== Related tags and articles ==
Line 13: Line 13:


{{sc|RANDOM_GENERATOR|Howto|Workflows that use this tag}}
{{sc|RANDOM_GENERATOR|Howto|Workflows that use this tag}}
== References ==


[[Category:INCAR tag]][[Category:Calculation setup]]
[[Category:INCAR tag]][[Category:Calculation setup]]

Latest revision as of 08:13, 24 October 2025

RANDOM_GENERATOR = default | pcg_32 

Description: Specifies the random-number generator used to initialize the wavefunction (see INIWAV) for electronic minimization, initialize atomic velocities for molecular dynamics, etc.


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 threaded (need to enable OpenMP threading at compile time) over the number of OpenMP threads. 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. Hence, use RANDOM_GENERATOR = default for strictly reproducible numbers across different machines at all steps during the calculation or comparison of VASP versions.

Related tags and articles

RANDOM_SEED, INIWAV

Workflows that use this tag

References