We present in this repository a general C++ implementation of
the Stochastic Analytic Continuation (SAC) algorithm, proposed by Anders W. Sandvik.
This program aims to extract the spectral information from the imaginary-time correlation functions calculated by quantum Monte Carlo (QMC) simulations
in strongly correlated quantum systems.
Details about the SAC algorithm can be found in the References section.
gcc/g++( version >= 7.1, support C++17 standard )andcmake( version >= 3.21 )installed.Boost C++ libraries( version >= 1.71 )installed.Eigen library( version >= 3.3.9 )providing a friendly API of matrix structureIntel Math Kernel Library (MKL)for high-accuracy linear algebra, working as the backend of theEigenlibrary.
-
Download the source code from github:
$ # download the source code $ git clone -b master https://github.com/JefferyWangSH/sac.git {program_root} -
Enter the
builddirectory and runruncmake.shto config the program with cmake.$ # config cmake $ cd {program_root}/build && sh runcmake.sh
-
Enter the
rundirectory and compile the codes.$ # build the program $ cd {program_root}/run && sh make.sh
-
We use
slurmfor task managements, and some example scripts for the submissions are presented inrun/submit.slurmandrun/run.sh. One can also run the code directly from the command line.$ # run the program with slurm $ cd {program_root}/run $ # edit simulating parameters before running the code $ vim submit.slurm $ sh submit.slurm $ # run directly from the command line $ # using program option `--help` to see the optional params and the helping messages. $ {program_root}/build/sac --help
-
The parameters of the SAC algorithm are organized in the TOML (v1.0.0) format, and one should provide a TOML configuration file to the program through the option
--config( Seebenchmark/config.tomlfor example ).And to make the input QMC data detectable for the program, one should pass the path of the input QMC corrlation functions and the corresponding imaginary-time grids through the command line options
--corrand--tgrids.$ # specify paths of input and output files $ {program_root}/build/sac \ --config=${config_file} --tgrids=${tgrids_file} --corr=${corr_file} \ --log=${log_file} --spec=${spec_file} --report=${report_file}
During the SAC simulation, the history of the simulated annealing will be recorded in the output log file, which can be assigned through the option
--log. After the simulation is finished, results of the recovered spectrum (--spec), together with a quality report of the SAC recovery (--report), will be automatically generated.$ # by default, the output files would be put under the [benchmark] folder unless explicitly assigned $ cd {program_root}/benchmark $ # monitor the process of annealing in log.out $ vim log.out $ # if someone runs the program using slurm, the screen output will be stored in stdout.out $ vim stdout.out $ # recovered spectral functions $ vim spec.out $ # quality report of the recovered spectrum to quantify the goodness of the SAC recovery $ vim report.out
-
include/&src/- header files and source codessac_core.h/sac_core.cpp- the core class for the SAC simulations, implementing the MonteCarlo sampling, simulated annealing, and the recovery of spectral functionsqmc_reader.h/qmc_reader.cpp- independent module to analyse and preprocess the input QMC correlation functionsfreq_grids.h/freq_grids.cpp- grids class for the discretization of ( both hyperfine and spectral ) grids in the frequency domainsac_kernel.h/sac_kernel.cpp- the integration kernel of SAC, which connects the spectral functions and the QMC correlations. The kernel may vary for different physical quantities, and basic kernels for fermionic and bosonic quantum systems are provided by default. One can also add customized types of kernels to this class.sac_annealing.h/sac_annealing.cpp- the chain structure for the storage of metadata during the simulated annealing process of SACsac_measure.h/sac_measure.cpp- class for measuring the averaged fitting goodness and the accepting ratiosac_writer.h/sac_writer.cpp- writer module to output the simulation information, e.g. the log info, the recovered spectrum and the quality report, to filesrandom.h/random.cpp- independent random module for the Monte Carlo processutils/- Utilitieslinear_algebra.hpp- Eigen-style interfaces for the high-efficiency diagonalization of matrices, using MKL LAPACK as the backendtoml.hpp- toml++ library, a header-only TOML config parser for C++
sac_main.cpp- the main program
-
benchmark/- benchmark exampleconfig.toml- toml configuration file including the SAC parameterstgrids.in- input QMC imaginary-time gridscorr.in- input QMC correlation functionslog.out- log file generated during the simulated annealing process of SAC. The metadata, including the sampling temperature, fitting goodness and the averaged accepting ratio, are recorded for the tracking of the annealing and equilibrium.spec.out- data of the accumulated spectral functions recovered by SACreport.out- quality report of the recovered spectral functions, compared with the input QMC datastdout.out- log file of the standard screen output during the running of the program, which is generated by slurmscripts/- python scriptsgenerate_data.py- generation of the synthetic spectral functions and the biased correlation functions for the usage of benchmarkplot_benchmark.py- visualization of benchmark resultsdata/exact_spec.dat- synthetic spectral functionsfigure/benchmark.pdf- benchmark figure
-
build/- building directoryruncmake.sh- bash script for the configuration of cmake
-
run/- running directorymake.sh- bash script for the compilation of the projectrun.sh- bash script for the running of project with customized program optionssubmit.slurm- slurm script for the submission of program tasks
-
cmake/- FindXXX.cmake files for cross-platform compilation
- Anders W. Sandvik, Stochastic method for analytic continuation of quantum Monte Carlo data, Phys. Rev. B 57, 10287, 1998. doi
- K. S. D. Beach, Identifying the maximum entropy method as a special limit of stochastic analytic continuation, arXiv:cond-mat/040305, 2004. doi
- Hui Shao, Yan Qi Qin, Sylvain Capponi et al., Nearly deconfined spinon excitations in the square-lattice spin-1/2 Heisenberg antiferromagnet, Phys. Rev. X 7, 041072, 2017. doi
The code is open source under the GPL-3.0 License.
I would like to sincerely thank Prof. Hui Shao and Zheng Zhou for the generous sharing of their source codes in Fortran.
If any questions, feel free to contact me via email 17307110117@fudan.edu.cn.