DMRGBlockContainer< Block, Hamiltonian > Class Template Reference

Detailed Description

template<class Block, class Hamiltonian>
class DMRGBlockContainer< Block, Hamiltonian >

Contains and manipulates the system and environment blocks used in a single DMRG run.

Options Database
Command line argument Description
-mstates [int] The number of states kept during the warmup stage (default: 0)
or -mwarmup [int]
-nsweeps [int] The number of sweeps to perform using the same number of states as the warmup
-msweeps [int],[int],... An array of the number of kept states \(m\) for each sweep (default: None)
-maxnsweeps [int],[int],... An array of the maximum number of sweeps for each \(m\) (default: 1)
-verbose [bool] An array of the maximum number of sweeps for each \(m\) (default: 1)
-dry_run [bool] Do not execute the warmup and sweep stages. This can be used for testing if the correct command line arguments were given.
-do_save_prealloc [bool] Save the preallocation data on a file in DATA_DIR
-do_shell [bool] Use a SHELL matrix or matrix-free approach for the superblock Hamiltonian (default: true)
-scratch_dir [string] Specify the scratch directory (default: ./scratch_dir)
-data_dir [string] Specify the data directory (default: ./data_dir)
-restart_dir <string> Path to the restart directory, typically the SCRATCH_DIR of the previous run
-restart_options <bool> Whether to continue the sweep parameters of the previous run (default: false)
-rot_nsubcomm <int> The number of subcommunicators to use for the rotation of operator matrices. This has to be a number that exactly divides the total size of PETSC_COMM_WORLD communicator.
See also
Options regarding the Hamiltonian and geometry can be found at the Hamiltonians::J1J2XXZModel_SquareLattice documentation

Definition at line 166 of file DMRGBlockContainer.hpp.

#include <DMRGBlockContainer.hpp>

Classes

struct  BasisTransformation
 Context struct for results of the basis transformation that may be useful in solving the correlators. More...
 
struct  Correlator
 Describes an n-point correlator whose expectation value will be measured at the end of each sweep. More...
 
struct  StepData
 Storage for basic data to be saved corresponding to a call of SingleDMRGStep() More...
 
struct  TimingsData
 Storage for timings to be saved corresponding to a call of SingleDMRGStep() More...
 

Public Member Functions

 DMRGBlockContainer (const MPI_Comm &mpi_comm)
 The constructor only takes in the MPI communicator; Initialize() has to be called explicitly next. More...
 
 ~DMRGBlockContainer ()
 Calls the Destroy() method and deallocates container object. More...
 
PetscErrorCode Initialize ()
 Initializes the container object with blocks of one site on each of the system and environment. More...
 
PetscErrorCode Destroy ()
 Destroys the container object. More...
 
PetscErrorCode SetUpCorrelation (const std::vector< Op > &OpList, const std::string &name, const std::string &desc)
 Sets up measurement of correlation functions at the end of each sweep. More...
 
PetscErrorCode Warmup ()
 Performs the warmup stage of DMRG or loads blocks for the restart stage. More...
 
PetscErrorCode Sweeps ()
 Performs the sweep stage of DMRG. More...
 
PetscErrorCode SingleSweep (const PetscInt &MStates, const PetscInt &MinBlock=PETSC_DEFAULT)
 Performs a single sweep from center to right, and back to center. More...
 
const Block & SysBlock (const PetscInt &BlockIdx) const
 Accesses the specified system block. More...
 
const Block & EnvBlock (const PetscInt &BlockIdx) const
 Accesses the specified environment block. More...
 
const Block & EnvBlock () const
 Accesses the 0th environment block. More...
 
PetscInt NumSites () const
 Returns that number of sites recorded in the Hamiltonian object. More...
 
PetscBool Verbose () const
 Returns whether verbose printing is active. More...
 
const Hamiltonian & HamiltonianRef () const
 Const reference to the Hamiltonian object for extracting its parameters. More...
 

Private Types

enum  Block_t { BlockSys = 0, BlockEnv = 1 }
 Provides an alias of Side_t to follow the Sys-Env convention. More...
 
enum  Step_t { WarmupStep, SweepStep, NullStep =-1 }
 Lists the types of steps that can be performed. More...
 
enum  SweepMode_t { SWEEP_MODE_NULL, SWEEP_MODE_NSWEEPS, SWEEP_MODE_MSWEEPS, SWEEP_MODE_TOLERANCE_TEST }
 Determines the type of sweep to be performed. More...
 

Private Member Functions

PetscErrorCode SingleDMRGStep (Block &SysBlock, Block &EnvBlock, const PetscInt &MStates, Block &SysBlockOut, Block &EnvBlockOut, PetscBool do_measurements=PETSC_FALSE)
 Performs a single DMRG iteration taking in a system and environment block, adding one site to each and performing a truncation to at most MStates. More...
 
PetscErrorCode GetTruncation (const KronBlocks_t &KronBlocks, const Vec &gsv_r, const PetscInt &MStates, BasisTransformation &BT_L, BasisTransformation &BT_R)
 Obtain the rotation matrix for the truncation step from the ground state vector. More...
 
PetscErrorCode EigRDM_BlockDiag (const Mat &matin, const PetscInt &seqIdx, const PetscInt &blkIdx, std::vector< Eigen_t > &eigList, EPS &eps)
 Obtain the eigenspectrum of a diagonal block of the reduced density matrix through an interface to a lapack routine. More...
 
PetscErrorCode FillRotation_BlockDiag (const std::vector< Eigen_t > &eigen_list, const std::vector< EPS > &eps_list, const std::vector< Vec > &rdmd_vecs, const Block &BlockRef, Mat &RotMatT)
 Fills the rotation matrix assumming that the reduced density matrix has a block diagonal structure. More...
 
PetscErrorCode CalculateCorrelations_BlockDiag (KronBlocks_t &KronBlocks, const Vec &gsv_r, const BasisTransformation &BT, const PetscBool flg=PETSC_TRUE)
 Calculates the correlation functions. More...
 
PetscErrorCode CalculateOperatorProducts (const MPI_Comm &comm_in, const std::vector< Correlator > &Corr, const Block_t &BlockType, Block &BlockRef, std::map< std::string, Mat > &OpMats, std::vector< Mat > &AllOpProds, std::vector< Mat > &OpProds)
 Calculates the products of operators that belong to a single block represented by the same basis. More...
 
PetscErrorCode SysBlocksActive (const std::set< PetscInt > &SysIdx)
 Ensure that required blocks are loaded while unrequired blocks are saved. More...
 
std::string BlockDir (const std::string &BlockType, const PetscInt &iblock)
 Returns the relative path to the directory for the storage of a specific system block. More...
 
std::string SweepDir (const PetscInt &isweep)
 Returns the relative path to the directory for the storage of a specific sweep / loop index. More...
 
PetscErrorCode SaveStepHeaders ()
 
PetscErrorCode SaveStepData (const StepData &data)
 Save step data to file. More...
 
PetscErrorCode SaveTimingsHeaders ()
 
PetscErrorCode SaveTimingsData (const TimingsData &data)
 Save timings data to file. More...
 
PetscErrorCode SaveEntanglementSpectra (const std::vector< Eigen_t > &eigen_L, const std::vector< PetscReal > &qn_L, const std::vector< Eigen_t > &eigen_R, const std::vector< PetscReal > &qn_R)
 Save the entanglement spectra to file. More...
 
PetscErrorCode SaveLoopsData ()
 Save data regarding warmup/sweeps into the data directory. More...
 
PetscErrorCode SaveAsOptions (const std::string &filename)
 Dumps significant keys and values to file to be retrieved for restart. More...
 
PetscErrorCode SaveSweepsData ()
 Save data at the end of a completed sweep into the sweep directory in the scratch. More...
 

Private Attributes

const std::map< SweepMode_t, std::string > SweepModeToString
 Gives the equivalent string for the sweep mode. More...
 
MPI_Comm mpi_comm = PETSC_COMM_SELF
 MPI Communicator. More...
 
PetscMPIInt mpi_rank
 MPI rank in mpi_comm. More...
 
PetscMPIInt mpi_size
 MPI size of mpi_comm. More...
 
PetscBool init = PETSC_FALSE
 Tells whether the object is initialized. More...
 
PetscBool verbose = PETSC_FALSE
 Tells whether to printout info during certain function calls. More...
 
PetscBool restart = PETSC_FALSE
 Tells whether the container initialized from a checkpoint restart. More...
 
PetscBool restart_options = PETSC_FALSE
 If True, the PetscOptions.dat file will override the current command line arguments and the sweep stage will be continued from where the previous file left off; otherwise a new set of sweeps based on the command line arguments is performed, and the keys listed in SaveAsOptions() will be read from command line only. More...
 
std::string restart_dir
 Path to sweep directory for performing restart. More...
 
std::map< std::string, PetscInt > restart_sweep_dict
 Contents of the Sweep.dat file which will be read when restarting. More...
 
PetscBool dry_run = PETSC_FALSE
 Tells whether to skip the warmup and sweep stages even when called. More...
 
PetscBool warmed_up = PETSC_FALSE
 Tells whether the object was initialized using Initialize() More...
 
PetscBool no_symm = PETSC_FALSE
 Tells whether no quantum number symmetries will be implemented. More...
 
PetscReal qn_sector = 0.0
 The quantum number sector in which to search for the ground state. More...
 
SweepMode_t sweep_mode = SWEEP_MODE_NULL
 Stores the mode of sweeps to be performed. More...
 
PetscInt mwarmup = 0
 Number of states requested for warmup. More...
 
PetscInt nsweeps = 0
 Number of sweeps to be performed with the number of states specified by mwarmup (for SWEEP_MODE_NSWEEPS only) More...
 
std::vector< PetscInt > msweeps
 Number of states for each sweep (for SWEEP_MODE_MSWEEPS and SWEEP_MODE_TOLERANCE_TEST only) More...
 
std::vector< PetscInt > maxnsweeps
 Maximum number of sweeps for each state in msweeps (for SWEEP_MODE_TOLERANCE_TEST only) More...
 
std::vector< PetscInt > sweeps_mstates
 Records the number of states requested for each sweep, where each entry is a single call to Sweep() More...
 
PetscInt msweep_idx = -1
 Index of the last full sweep completed. More...
 
PetscInt num_sites
 Total number of sites. More...
 
PetscInt num_sys_blocks
 Number of system blocks to be stored. More...
 
PetscInt num_env_blocks = 1
 Number of environment blocks to be stored. More...
 
std::vector< Block > sys_blocks
 Array of system blocks each of which will be kept all throughout the simulation. More...
 
PetscInt sys_ninit = 0
 Number of initialized blocks in SysBlocks. More...
 
std::vector< Block > env_blocks
 Environment blocks to be used only during warmup. More...
 
PetscInt env_ninit = 0
 Number of initialized blocks in EnvBlocks. More...
 
Hamiltonian Ham
 Container for the Hamiltonian and geometry. More...
 
Block SingleSite
 Single site that is added to each block during the block enlargement procedure. More...
 
Block & AddSite = SingleSite
 Reference to the block of site/s added during enlargement. More...
 
std::string scratch_dir = "."
 Directory in which all the sweep data will be saved. More...
 
PetscBool do_scratch_dir = PETSC_TRUE
 Tells whether to save and retrieve blocks to reduce memory usage at runtime. More...
 
PetscBool data_tabular = PETSC_TRUE
 Tells whether data should be saved in tabular form, instead of verbose json. More...
 
PetscBool do_save_prealloc = PETSC_FALSE
 Tells whether to save preallocation data for the superblock Hamiltonian. More...
 
PetscBool do_shell = PETSC_TRUE
 Whether to create an implicit MATSHELL matrix for the superblock Hamiltonian. More...
 
FILE * fp_step = NULL
 File to store basic data (energy, number of sites, etc) More...
 
FILE * fp_timings = NULL
 File to store timings data for each section of a single iteration. More...
 
FILE * fp_entanglement = NULL
 File to store the entanglement spectrum of the reduced density matrices for a single iteration. More...
 
FILE * fp_data = NULL
 File to store timings data for each section of a single iteration. More...
 
FILE * fp_prealloc = NULL
 File to store preallocation data of the superblock Hamiltonian. More...
 
FILE * fp_corr = NULL
 File to store timings data for each section of a single iteration. More...
 
PetscInt GlobIdx = 0
 Global index key which must be unique for each record. More...
 
Step_t LoopType = NullStep
 The type of step performed, whether as part of warmup or sweep. More...
 
PetscInt LoopIdx = 0
 Counter for this loop (the same counter for warmup and sweeps) More...
 
PetscInt StepIdx = 0
 Counter for the step inside this loop. More...
 
std::vector< Correlatormeasurements
 Stores the measurements to be performed at the end of each sweep. More...
 
PetscBool corr_headers_printed = PETSC_FALSE
 Tells whether the headers for the correlators have been printed. More...
 
PetscBool corr_printed_first = PETSC_FALSE
 Tells whether a single entry for the correlators have been printed. More...
 
PetscScalar gse = 0.0
 Stores the ground state energy at the end of a single dmrg step. More...
 
std::vector< PetscReal > trunc_err
 Stores the truncation error at the end of a single dmrg step. More...
 
PetscLogDouble t0abs = 0.0
 Stores the absolute time started. More...
 

The documentation for this class was generated from the following file:
This site was generated by Sphinx using Doxygen with a customized theme from doxygen-bootstrapped.