TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
Solves a block diagonal Model using diagonalization. More...
#include <BlockDiagonalizer.h>
Classes | |
class | SelfConsistencyCallback |
Public Member Functions | |
BlockDiagonalizer () | |
void | setSelfConsistencyCallback (SelfConsistencyCallback &selfConsistencyCallback) |
void | setMaxIterations (int maxIterations) |
void | run () |
const double | getEigenValue (int state) |
const double | getEigenValue (const Index &blockIndex, int state) |
const std::complex< double > | getAmplitude (int state, const Index &index) |
const std::complex< double > | getAmplitude (const Index &blockIndex, int state, const Index &intraBlockIndex) |
unsigned int | getFirstStateInBlock (const Index &index) const |
unsigned int | getLastStateInBlock (const Index &index) const |
void | setParallelExecution (bool parallelExecution) |
Public Member Functions inherited from TBTK::Solver::Solver | |
Solver () | |
virtual | ~Solver () |
virtual void | setModel (Model &model) |
Model & | getModel () |
const Model & | getModel () const |
Public Member Functions inherited from TBTK::Communicator | |
Communicator (bool verbose) | |
void | setVerbose (bool verbose) |
bool | getVerbose () const |
Additional Inherited Members | |
Static Public Member Functions inherited from TBTK::Communicator | |
static void | setGlobalVerbose (bool globalVerbose) |
static bool | getGlobalVerbose () |
Solves a block diagonal Model using diagonalization.
Solves a Model by Diagonalizing the Hamiltonian. Is similar to Diagonalizer, but is able to take advantage of a Hamiltonian's block diagonal structure. Use PropertyExtractor::BlockDiagonalizer to extract Properties.
The BlockDiagonalizer is able to take advantage of a Model's block diagonal structure if the Subindices that the Model is block diagonal in appear to the left of Subindices that are not block indices. Therefore, if for example kx, ky, and kz are block labels, while sublattice and orbital are not, make sure the Model is specified such that the Index structure is {kx, ky, kz, sublattice, orbital} rather than {sublattice, orbital, kx, ky, kz}.
Scaling behavior:
If the Model has no blocks, the scaling behavior is the same as for the Diagonalizer, but with a larger prefactor. If the Model consists of \(b\) blocks, each of dimension \(h\), the scaling behavior is:
Time: \(O(nh^3)\)
Space: \(O(nh^2)\)
If the Model consists of \(b\) blocks of varying size, the above scaling behavior instead becomes an upper bound, with \(h\) the maximum block dimension.
TBTK::Solver::BlockDiagonalizer::BlockDiagonalizer | ( | ) |
Constructs a Solver::Diagonalizer.
|
inline |
Get amplitude for given eigenvector \(n\), block index \(b\), and physical index \(x\): \(\Psi_{nb}(x)\).
blockIndex | Block index \(b\) |
state | Eigenstate number \(n\) relative to the given block. |
index | Physical index \(x\). |
|
inline |
Get amplitude for given eigenvector \(n\) and physical index \(x\): \(\Psi_{n}(x)\).
state | Eigenstate number \(n\). |
index | Physical index \(x\). |
|
inline |
Get eigenvalue for specific block. Note that in contrast to getEigenValue(int state), 'state' here is relative to the first state of the block.
blockIndex | Block index to get the eigenvalue for. |
state | State index relative to the block in accending order. |
|
inline |
Get eigenvalue. The eigenvalues are ordered first by block, and then in accending order. This means that eigenvalues for blocks with smaller Indices comes before eigenvalues for blocks with larger Indices , while inside each block the eigenvalues are in accending order.
state | The state number. |
|
inline |
|
inline |
void TBTK::Solver::BlockDiagonalizer::run | ( | ) |
Run calculations. Diagonalizes ones if no self-consistency callback have been set, or otherwise multiple times until slef-consistencey or maximum number of iterations has been reached.
|
inline |
Set maximum number of iterations for the self-consistency loop. Only used if BlockDiagonalizer::setSelfConsistencyCallback() has been called with a non-nullptr argument. If the self-consistency callback does not return true, maxIterations determine the maximum number of times it is called.
maxIterations | Maximum number of iterations to use in a self-consistent calculation. |
|
inline |
Set whether parallel execution is enabled or not. Parallel execution is only possible if OpenMP is available.
@pragma parallelExecution True to enable parallel execution.
|
inline |
Set SelfCOnsistencyCallback. If never called, the self-consistency loop will not be run.
selfConsistencyCallback | A SelfConsistencyCallback that will be called after the Model has been diagonalized. The callback should calculate relevant quantities, modify the Model if necessary, and return false if further iteration is necessary. If true is returned, self-consistency is considered to be reached and the iteration stops. |