DMRGBlock.hpp
PetscErrorCode EnsureRetrieved()
Ensures that the block matrices have been retrieved if the block is initialized, otherwise does nothi...
Definition: DMRGBlock.cpp:1098
Contains information on quantum numbers and associated index ranges.
Definition: QuantumNumbers.hpp:30
PetscErrorCode InitializeSave(const std::string &save_dir_in)
Initializes the writing of the block matrices to file.
Definition: DMRGBlock.cpp:835
Mat Sm(const PetscInt &Isite) const
Returns the matrix pointer to the operator at site Isite, if available.
Definition: DMRGBlock.hpp:365
PetscErrorCode GetOperatorBlocks(Op_t Operator)
Extracts the block structure for each operator.
RotMethod rot_method
Method to use for performing basis transformation.
Definition: DMRGBlock.hpp:191
PetscBool init_save
Whether saving the block matrices to file has been initialized correctly.
Definition: DMRGBlock.hpp:142
virtual std::vector< PetscScalar > loc_qn_list() const
Sz sectors of a single site.
Definition: DMRGBlock.hpp:207
std::string SaveDir() const
Returns the value of save_dir where the block data will be read from/written.
Definition: DMRGBlock.hpp:287
Base class for the implementation of a block of spin sites.
Definition: DMRGBlock.hpp:79
PetscBool SaveInitialized() const
Tells whether InitializeSave() has been properly called.
Definition: DMRGBlock.hpp:290
const std::vector< Mat > & Sp() const
Returns the list of matrix pointer to the operators.
Definition: DMRGBlock.hpp:375
std::string read_dir
Root directory to read the matrix blocks from during the first access.
Definition: DMRGBlock.hpp:157
PetscErrorCode AssembleOperators()
Ensures that all operators are assembled.
Definition: DMRGBlock.cpp:825
PetscErrorCode EnsureSaved()
Ensures that the block matrices have been saved if the block is initialized, otherwise does nothing...
Definition: DMRGBlock.cpp:1090
PetscErrorCode SetDiskStorage(const std::string &read_dir_in, const std::string &write_dir_in)
Tells where to read from and save the operators and data about the block.
Definition: DMRGBlock.cpp:857
Op_t
Identifies the three possible spin operators and also represents the shift associated to its action o...
Definition: DMRGBlock.hpp:21
PetscBool MPIInitialized() const
Returns PETSC_TRUE if the MPI communicator was initialized properly.
Definition: DMRGBlock.hpp:196
PetscErrorCode CheckOperatorBlocks() const
Checks whether all matrix blocks follow the correct sector indices using MatCheckOperatorBlocks() ...
Definition: DMRGBlock.cpp:601
PetscBool verbose
Tells whether to printout info during certain function calls.
Definition: DMRGBlock.hpp:118
virtual std::vector< PetscInt > loc_qn_size() const
Number of states in each sector in a single site.
Definition: DMRGBlock.hpp:213
PetscErrorCode RotateOperators(SpinBase &Source, const Mat &RotMatT)
Rotates all operators from a source block using the given transposed rotation matrix.
Definition: DMRGBlock.cpp:677
PetscErrorCode InitializeFromDisk(const MPI_Comm &comm_in, const std::string &block_path)
Initializes block object from data located in the directory block_path.
Definition: DMRGBlock.cpp:214
PetscErrorCode MatOpGetNNZs(const Op_t &OpType, const PetscInt &isite, std::vector< PetscInt > &nnzs) const
Returns the number of non-zeros in each row for an operator acting on a given site.
Definition: DMRGBlock.cpp:450
virtual PetscErrorCode MatSpinSzCreate(Mat &Sz)
Creates the single-site operator.
Definition: DMRGBlock.cpp:1106
PetscErrorCode CheckOperators() const
Checks whether all operators have been initialized and have correct dimensions.
Definition: DMRGBlock.cpp:413
PetscErrorCode CheckSectors() const
Checks whether sector indexing was done properly.
Definition: DMRGBlock.cpp:429
PetscErrorCode SaveOperator(const std::string &OpName, const size_t &isite, Mat &Op, const MPI_Comm &comm_in)
Saves a single operator.
Definition: DMRGBlock.cpp:896
std::string spin_type_str
Type of spin contained in the block expressed as a string.
Definition: DMRGBlock.hpp:97
const std::vector< Mat > & Sz() const
Returns the list of matrix pointer to the operators.
Definition: DMRGBlock.hpp:372
PetscBool init_once
Tells whether the block was initialized at least once before.
Definition: DMRGBlock.hpp:112
std::vector< PetscInt > _loc_qn_size
Stores the number of states in each sector in a single site.
Definition: DMRGBlock.hpp:106
PetscErrorCode Retrieve()
Retrieve all the matrix operators that were written to file by SaveAndDestroy()
Definition: DMRGBlock.cpp:1048
PetscErrorCode RetrieveOperator(const std::string &OpName, const size_t &isite, Mat &Op, const MPI_Comm &comm_in=MPI_COMM_NULL)
Retrieves a single operator.
Definition: DMRGBlock.cpp:974
virtual PetscErrorCode MatSpinSpCreate(Mat &Sp)
Creates the single-site raising operator , from which we can define .
Definition: DMRGBlock.cpp:1169
RotMethod
List of possible methods for performing basis transformation.
Definition: DMRGBlock.hpp:187
PetscErrorCode CheckOperatorArray(const Op_t &OpType) const
Determines whether the operator arrays have been successfully filled with matrices.
Definition: DMRGBlock.cpp:375
Mat Sz(const PetscInt &Isite) const
Returns the matrix pointer to the operator at site Isite.
Definition: DMRGBlock.hpp:353
PetscBool mpi_init
Tells whether the block's MPI attributes were initialized.
Definition: DMRGBlock.hpp:115
PetscBool Initialized() const
Indicates whether block has been initialized before using it.
Definition: DMRGBlock.hpp:335
PetscErrorCode SaveAndDestroy()
Save all the matrix operators to file and destroy the current storage.
Definition: DMRGBlock.cpp:1014
PetscErrorCode SaveBlockInfo()
Save some information about the block that could be used to reconstruct it later. ...
Definition: DMRGBlock.cpp:924
PetscErrorCode Destroy()
Destroys all operator matrices and frees memory.
Definition: DMRGBlock.cpp:655
PetscErrorCode MatOpCheckOperatorBlocks(const Op_t &op_t, const PetscInt &isite) const
Checks the block indexing in the matrix operator op_t on site isite.
Definition: DMRGBlock.cpp:498
PetscErrorCode Initialize(const MPI_Comm &comm_in)
Initializes block object's MPI attributes.
Definition: DMRGBlock.cpp:31
PetscBool disk_set
Whether SetDiskStorage() has properly set the block storage locations.
Definition: DMRGBlock.hpp:145
std::string save_dir
Root directory to read from and write the matrix blocks into.
Definition: DMRGBlock.hpp:154
QuantumNumbers Magnetization
Stores the information on the magnetization Sectors.
Definition: DMRGBlock.hpp:326
PetscErrorCode MatGetNNZs(const Mat &matin, std::vector< PetscInt > &nnzs) const
Returns the number of non-zeros in each row for a given matrix.
Definition: DMRGBlock.cpp:477
PetscInt NumSites() const
Gets the number of sites that are currently initialized.
Definition: DMRGBlock.hpp:344
PetscErrorCode MatCheckOperatorBlocks(const Op_t &op_t, const Mat &matin) const
Checks the block indexing in the matrix operator op_t on specified matrix matin.
Definition: DMRGBlock.cpp:520
Mat Sp(const PetscInt &Isite) const
Returns the matrix pointer to the operator at site Isite.
Definition: DMRGBlock.hpp:359
MPI_Comm MPIComm() const
Gets the communicator associated to the block.
Definition: DMRGBlock.hpp:341
Defines a single operator to be used for performing measurements.
Definition: DMRGBlockContainer.hpp:97
std::vector< PetscScalar > _loc_qn_list
Stores the Sz sectors of a single site.
Definition: DMRGBlock.hpp:103
const std::vector< Mat > & Sm() const
Returns the list of matrix pointer to the operators.
Definition: DMRGBlock.hpp:378
PetscInt NumStates() const
Gets the number of states that are currently used.
Definition: DMRGBlock.hpp:347
PetscErrorCode Retrieve_NoChecks()
Private function to retrieve operators without checking for save initialization.
Definition: DMRGBlock.cpp:1063