RANDOM GENERATOR: Difference between revisions

From VASP Wiki
No edit summary
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:RANDOM_GENERATOR}}
{{TAGDEF|RANDOM_GENERATOR|default {{!}} pcg_32}}
{{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.  
Description: Specifies the random-number generator used to initialize the wavefunction (see {{TAG|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 {{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, 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 {{TAGO|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 a threaded (need to enable [[Combining_MPI_and_OpenMP|OpenMP threading]] at compile time) over the number of threads used for running VASP. 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.
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.


== Related tags and articles ==
== Related tags and articles ==
{{TAG|INIWAV}} {{TAG|RANDOM_SEED}}
{{TAG|RANDOM_SEED}}, {{TAG|INIWAV}}


{{sc|RANDOM_SEED|Examples|Examples that use this tag}}
{{sc|RANDOM_GENERATOR|Howto|Workflows that use this tag}}
----


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

Revision as of 13:23, 22 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