Skip to content

c++ implementation of the stochastic analytic continuation (SAC) to extract spectral information from the imaginary-time Matsubara correlation functions, which are typically measured in path-integral based QMC simulations.

License

Notifications You must be signed in to change notification settings

JefferyWangSH/sac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stochastic Analytic Continuation

workflow commit

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.


Installation

Prerequisite

  • gcc/g++ ( version >= 7.1, support C++17 standard ) and cmake ( version >= 3.21 ) installed.
  • Boost C++ libraries ( version >= 1.71 ) installed.
  • Eigen library ( version >= 3.3.9 ) providing a friendly API of matrix structure
  • Intel Math Kernel Library (MKL) for high-accuracy linear algebra, working as the backend of the Eigen library.

Usage

  1. Download the source code from github:

    $ # download the source code
    $ git clone -b master https://github.com/JefferyWangSH/sac.git {program_root}
    
  2. Enter the build directory and run runcmake.sh to config the program with cmake.

    $ # config cmake
    $ cd {program_root}/build && sh runcmake.sh
  3. Enter the run directory and compile the codes.

    $ # build the program
    $ cd {program_root}/run && sh make.sh
  4. We use slurm for task managements, and some example scripts for the submissions are presented in run/submit.slurm and run/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
  5. 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 ( See benchmark/config.toml for 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 --corr and --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

Repository Structure

  • include/ & src/ - header files and source codes

    • sac_core.h/sac_core.cpp - the core class for the SAC simulations, implementing the MonteCarlo sampling, simulated annealing, and the recovery of spectral functions
    • qmc_reader.h/qmc_reader.cpp - independent module to analyse and preprocess the input QMC correlation functions
    • freq_grids.h/freq_grids.cpp - grids class for the discretization of ( both hyperfine and spectral ) grids in the frequency domain
    • sac_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 SAC
    • sac_measure.h/sac_measure.cpp - class for measuring the averaged fitting goodness and the accepting ratio
    • sac_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 files
    • random.h/random.cpp - independent random module for the Monte Carlo process
    • utils/ - Utilities
    • sac_main.cpp - the main program
  • benchmark/ - benchmark example

    • config.toml - toml configuration file including the SAC parameters
    • tgrids.in - input QMC imaginary-time grids
    • corr.in - input QMC correlation functions
    • log.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 SAC
    • report.out - quality report of the recovered spectral functions, compared with the input QMC data
    • stdout.out - log file of the standard screen output during the running of the program, which is generated by slurm
    • scripts/ - python scripts
  • build/ - building directory

    • runcmake.sh- bash script for the configuration of cmake
  • run/ - running directory

    • make.sh - bash script for the compilation of the project
    • run.sh - bash script for the running of project with customized program options
    • submit.slurm - slurm script for the submission of program tasks
  • cmake/ - FindXXX.cmake files for cross-platform compilation

References

  1. Anders W. Sandvik, Stochastic method for analytic continuation of quantum Monte Carlo data, Phys. Rev. B 57, 10287, 1998. doi
  2. K. S. D. Beach, Identifying the maximum entropy method as a special limit of stochastic analytic continuation, arXiv:cond-mat/040305, 2004. doi
  3. 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

License & Support

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.

About

c++ implementation of the stochastic analytic continuation (SAC) to extract spectral information from the imaginary-time Matsubara correlation functions, which are typically measured in path-integral based QMC simulations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages