Package CPMC-Lab version 1.0 (2014)
Huy Nguyen, Hao Shi, Jie Xu and Shiwei Zhang
Package homepage: huynguyen.io/CPMC-Lab.
This package is distributed under the Computer Physics Communications Non-Profit Use License.
Any publications resulting from either applying or building on the present package should cite the following journal article (in addition to the relevant literature on the method): CPMC-Lab: A Matlab Package for Constrained Path Monte Carlo Calculations, Comput. Phys. Commun. 185, 3344 (2014).
CPMC-Lab is a Matlab package for the constrained-path and phaseless auxiliary-field Monte Carlo methods. This package implements the full ground-state constrained-path Monte Carlo (CPMC) method in Matlab with a graphical interface, using the Hubbard model as an example.
The package can perform calculations in finite supercells in any dimensions, under periodic or twist boundary conditions. The package also includes and illustrates importance sampling and all other algorithmic details of a total energy calculation. This open-source tool allows users to experiment with various model and run parameters and visualize the results. It provides a direct and interactive environment to learn the method and study the code with minimal overhead for setup.
Furthermore, the package can be easily generalized for auxiliary-field quantum Monte Carlo (AFQMC) calculations in many other models for correlated electron systems, and can serve as a template for developing a production code for AFQMC total energy calculations in real materials.
Installation and Execution
User must have an active Matlab installation to run the CPMC-Lab package. The GUI (but not the rest of the package) requires Matlab R2010b (version 7.11) or above. For installation instructions, visit http://www.mathworks.com/help/install.
To run the sample script
sample.min an interactive Matlab session, navigate to the directory containing the script, type
sampleand hit Enter or Return. User should feel free to change the input parameters in
sample.mand run the script with these new parameters.
For help, see the header of each file in the package. Alternatively, in an interactive Matlab session, type
help filenameat the Matlab prompt.
This package contains 10 source files for the CPMC program, 1 GUI program, and 2 sample scripts for running the program:
CPMC_Lab.mis the main driver of the package. For every time step, it calls
stepwlk.mto propagate the walkers. When appropriate, it calls
measure.mto measure the energy,
stlbz.mto re-orthonormalize the walkers or
pop_cntrl.mto do population control. After the end of the random walk, it calculates the final average and standard error of the energy and saves the results to a file.
validation.mto conduct a basic check on the input parameters and initializes internal quantities, e.g. the total number of sites and electrons. It forms the free-electron trial wave function and creates the initial population of walkers.
validation.mverifies the basic validity of user inputs, as mentioned above.
H_K.mcreates the one-body kinetic Hamiltonian.
stepwlk.mcarries out one step of the random walk by calling
halfK.mpropagates a walker by exp(-Delta tau K/2).
V.mcarries out importance sampling site by site to select the auxiliary fields, and propagates a walker by exp(-Delta tau V).
measure.mcomputes the energy of a walker.
stblz.morthonormalizes walkers by the modified Gram-Schmidt algorithm.
pop_cntrl.mcarries out population control by a simple-combing method.
sample.mis a script that allows users to set input parameters.
batchsample.mis a script that loops over multiple sets of parameters.
GUI.mlaunches the graphical user interface of the package. It is a stand-alone file that is independent of all the other files in the package and contains all the subroutines of a QMC run.
Sample input can be found in the script
The following output is produced by running the
sample.m script as distributed. If invoked during an interactive session, this output is displayed in the Matlab command window. A
*.mat file containing all data from the calculation is also saved to the script's directory.(Below we have left the actual output values blank, since they depend on the particular random number generator seed.)
E_ave = ...
E_err = ...
time = ...