-
Notifications
You must be signed in to change notification settings - Fork 35
How to build and run miniQMC
- CMake
- C/C++ compilers with C++11 support
- BLAS/LAPACK, numerical library, use platform-optimized libraries
cd build
cmake -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx ..
make -j 8
CMake provides a number of optional variables that can be set to control the build and configure steps. When passed to CMake, these variables will take precident over the enviornmental and default variables. To set them add -D FLAG=VALUE to the configure line between the cmake command and the path to the source directory.
- General build options
CMAKE_C_COMPILER Set the C compiler
CMAKE_CXX_COMPILER Set the C++ compiler
CMAKE_BUILD_TYPE A variable which controls the type of build (defaults to Release).
Possible values are:
None (Do not set debug/optmize flags, use CMAKE_C_FLAGS or CMAKE_CXX_FLAGS)
Debug (create a debug build)
Release (create a release/optimized build)
RelWithDebInfo (create a release/optimized build with debug info)
MinSizeRel (create an executable optimized for size)
CMAKE_C_FLAGS Set the C flags. Note: to prevent default debug/release flags
from being used, set the CMAKE_BUILD_TYPE=None
Also supported: CMAKE_C_FLAGS_DEBUG, CMAKE_C_FLAGS_RELEASE,
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS Set the C++ flags. Note: to prevent default debug/release flags
from being used, set the CMAKE_BUILD_TYPE=None
Also supported: CMAKE_CXX_FLAGS_DEBUG, CMAKE_CXX_FLAGS_RELEASE,
CMAKE_CXX_FLAGS_RELWITHDEBINFO
- Key QMC build options
QMC_MPI Build with MPI (default 1:yes, 0:no)
QMC_COMPLEX Build the complex (general twist/k-point) version (1:yes, default 0:no)
QMC_MIXED_PRECISION Build the mixed precision (mixing double/float) version (1:yes, default 0:no).
Use float and double for base and full precision.
Executables are created in ./bin folder. There are a few of them
check_determinant # checks the determinant part of the wavefunction
check_wfc # checks Jastrow components of the wave function
check_spo # checks single particle orbitals including 3D-cubic splines.
miniqmc # runs a fake DMC and report the time spent in each component.
It is recommended to run all the check_XXX routines. They report either "All checking pass!" or a failure message indicating where the failure is.
all the executables can run without any arguments and input files, namely default setting. If more controls is needed, query by -h option to print out available options.
This is an example how miniqmc reports. The default setting is a fake DMC run mimicing the NiO 32 atom cell simulation.
==================================
Stack timer profile
Timer Inclusive_time Exclusive_time Calls Time_per_call
Total 1.6640 0.0131 1 1.663990021
Diffusion 1.0446 0.0158 100 0.010445936
Current Gradient 0.0054 0.0036 38400 0.000000140
Jastrow 0.0017 0.0017 38400 0.000000045
Distance Tables 0.3296 0.3296 95899 0.000003437
New Gradient 0.6151 0.0069 38395 0.000016021
Jastrow 0.0973 0.0973 38395 0.000002534
Single-Particle Orbitals 0.5110 0.5110 38395 0.000013308
Update 0.0785 0.0785 18999 0.000004133
Wavefuntion GL 0.0002 0.0002 100 0.000002389
Pseudopotential 0.6063 0.0098 100 0.006063325
Distance Tables 0.2907 0.2907 74484 0.000003902
Value 0.3059 0.0116 74484 0.000004107
Jastrow 0.1221 0.1221 74484 0.000001640
Single-Particle Orbitals 0.1722 0.1722 74484 0.000002312
The basic task of quantum Monte Carlo is to obtain the total energy of a quantum mechanical system composed of mobile electrons and immobile ions. The system miniQMC is based on is nickel oxide (NiO), in which nickel and oxygen atoms are arranged in a 3D checkerboard pattern (crystal). A fixed number of immobile atoms (e.g. 16 nickel and 16 oxygen) are set inside a box with periodic boundary conditions along with the physically relevant electrons--18 per nickel and 6 per oxygen. The remaining 10 and 2 electrons, for nickel and oxygen respectively, are represented abstractly by effective force fields called "pseudopotentials".
Each electron in the system is represented explicitly as a point charge in 3-dimensional space. If there are N electrons, we can list the 3D positions as . The quantum mechanical wavefunction describes the probability of finding the electrons at any given set of positions:
The QMC simulation process amounts to performing an integral over the electronic coordinates. The total energy is just the sum of the local energy of each particular set of electronic coordinates weighted by its probability of occurrence:
In Monte Carlo, a sequence of electron positions () are sampled randomly with probability and the integral is approximated statistically by the sum
The computationally costly parts of the simulation are the generation of the sample positions and the evaluation of the local energy .
The sample positions are generated from each other in sequence in the following way:
Here, is a list of 3N gaussian distributed random numbers, is a uniformly distributed random number, and is a ratio that depends on the value and the gradient of the wavefunction . The repeated calculation of the wavefunction's value, gradient, laplacian as well as ratios of wavefunction values dominate the cost of QMC calculations.
The analytic form of the wavefunction used in the miniapp is a product of a symmetric term (identical under exchange of like-spin electrons), known as the Jastrow factor, and an antisymmetric term (changes sign with exchange) called a Slater determinant:
The Jastrow factor is split into one-, two-, and three-body terms
The Slater determinant is actually a product of two determinants, one for up electrons and one for down electrons. The determinants are composed of single particle orbitals , which are each (complex) scalar valued functions of three spatial variables:
The sections that follow describe the overall computational algorithm of QMC and provide a finer level of detail regarding the form of each wavefunction component.