|
TRIQS/triqs_modest 3.3.0
Modular Electronic Structure Toolkit
|
#include <triqs_modest/embedding.hpp>
The embedding class.
The embedding class encodes the mapping between impurities and the correlated space \( \mathcal{C} \) (cf. ModEST implementation notes). In particular, it maps the individual "blocks" within an impurity self-energy to a block and spin of the embedded self-energy function, which can then be upfolded (downfolded) to obtain the lattice self-energy and the local Green's function.
Definition at line 32 of file embedding.hpp.
Public Member Functions | |
| embedding (std::vector< long > sigma_embed_decomposition, std::vector< std::vector< long > > imp_decompositions, nda::array< imp_block_t, 2 > psi, std::vector< std::string > sigma_names) | |
| Construct an embedding object. | |
| template<typename Mesh> | |
| std::vector< std::pair< block_gf< Mesh, matrix_valued >, block_matrix_t > > | make_zero_imp_self_energies (Mesh const &mesh) |
| Create zero-initialized impurity self-energies. | |
Accessors | |
| imp_block_t | operator[] (long alpha, long sigma) const |
| Bracket accessor: \( \psi[\alpha,\sigma] \). | |
| nda::array< imp_block_t, 2 > | psi_map () const |
| The mapping table \( \psi \). | |
| long | n_alpha () const |
| Number of blocks in \( \alpha \) for the \( \Sigma_{\text{embed}} \). | |
| long | n_sigma () const |
| Number of blocks in \( \sigma \) for the \( \Sigma_{\text{embed}} \). | |
| long | n_gamma (long imp_idx) const |
| Number of blocks in \( \gamma \) for the \( \Sigma_{\text{imp}} \) [imp_idx]. | |
| long | n_impurities () const |
| Number of impurities. | |
| std::vector< std::string > | sigma_names () const |
| The names of the sigma indices. | |
| std::vector< long > | imp_decomposition (long imp_idx) const |
| The impurity decomposition. | |
| C2PY_IGNORE gf_struct2_t | embed_block_structure () const |
| Block structure (names and dimensions) for the embedded self-energy \( \Sigma_{\text{embed}} \). | |
| std::vector< gf_struct_t > | imp_block_structure () const |
| Block structure (names and dimensions) for each impurity solver. | |
| std::string | description (bool verbosity=false) const |
| Summarize the embedding object. | |
Embedding transformations | |
Methods that return a new embedding with a modified \( \psi \) map. | |
| bool | operator== (embedding const &other) const =default |
| embedding | drop_imp (long imp_idx) const |
| Remove an impurity from the embedding table \( \psi \). | |
| embedding | replace_imp (long imp_idx_old, long imp_idx_new) const |
| Redirect all \( \psi \) entries from one impurity to another. | |
| embedding | swap_sigma (long alpha) const |
| Swap the \( \sigma \) (spin) assignment for \( \alpha \) block alpha. | |
| embedding | swap_sigma (std::vector< long > alphas) const |
| Swap the \( \sigma \) (spin) assignment for all \( \alpha \) blocks in alphas. | |
| embedding | slice_sigma () const |
| Slice the embedding to a single \( \sigma \) channel ("ud"). | |
| embedding | split_imp (long imp_idx, std::function< bool(long)> p) const |
| Split impurity imp_idx using a predicate. | |
| embedding | split_imp (long imp_idx, std::vector< long > const &block_list) const |
| Split impurity imp_idx based on block_list. | |
| embedding | split_imp (long imp_idx, std::initializer_list< const char * > x)=delete |
| embedding | split_imp_block (long imp_idx, long gamma, std::vector< long > const &new_dims) const |
| Split a single \( \gamma \) block of an impurity into multiple blocks. | |
| embedding | merge_embed_block_by_imp () const |
| Merge consecutive \( \alpha \) blocks belonging to the same impurity into a single block. | |
Embed and extract operations | |
Methods that map data between impurity and embedded representations. | |
| template<int Rank> | |
| std::vector< std::vector< nda::array< dcomplex, Rank > > > | extract (std::vector< nda::array< dcomplex, Rank > > const &X) const |
| Extract impurity data from embedded arrays. | |
| template<int Rank> | |
| std::vector< nda::array< dcomplex, Rank > > | embed (std::vector< std::vector< nda::array< dcomplex, Rank > > > const &imps_blocks) const |
| Embed impurity data into the full correlated space. | |
| template<typename Mesh> | |
| block2_gf< Mesh, matrix_valued > | embed (std::vector< block_gf< Mesh, matrix_valued > > const &Sigma_imp_vec) const |
| Embed Green's function containers. | |
| template<typename Mesh> | |
| std::vector< block_gf< Mesh, matrix_valued > > | extract (block2_gf< Mesh, matrix_valued > const &g_loc) const |
| Extract Green's function containers. | |
| template<typename Mesh> | |
| std::pair< block2_gf< Mesh, matrix_valued >, block2_matrix_t > | embed (std::vector< block_gf< Mesh, matrix_valued > > const &Sigma_imp_vec, std::vector< block_matrix_t > const &Sigma_imp_static_vec) const |
| Embed pairs Green's function containers and matrices. | |
| block2_matrix_t | embed (std::vector< block_matrix_t > const &Sigma_imp_static_vec) const |
| Embed block matrices into the full correlated space. | |
| std::vector< block_matrix_t > | extract (block2_matrix_t const &matrix_C) const |
| Extract block matrices from the embedded representation. | |
Friends | |
| void | h5_read (h5::group g, std::string const &name, embedding &x) |
| void | h5_write (h5::group g, std::string const &name, embedding const &x) |
| h5 read/write | |
| std::ostream & | operator<< (std::ostream &out, embedding const &E) |
| triqs::modest::embedding::embedding | ( | std::vector< long > | sigma_embed_decomposition, |
| std::vector< std::vector< long > > | imp_decompositions, | ||
| nda::array< imp_block_t, 2 > | psi, | ||
| std::vector< std::string > | sigma_names ) |
Construct an embedding object.
| sigma_embed_decomposition | Decomposition (list of block sizes) for \( \Sigma_{\text{embed}} \): \([ \alpha ] = \) block size. Note that the decompositions are given for \( \alpha \), \( \gamma \) index, and are independent of \( \sigma \). |
| imp_decompositions | List of decomposition of solvers: [n_imp][ \( \gamma \)] = block size. |
| psi | The mapping \( \psi[\alpha,\sigma]\) -> n_imp, \( \gamma \), \( \tau \). |
| sigma_names | Names for the values of the \( \sigma \) index (e.g., "up", "down"). |
Definition at line 17 of file embedding.cpp.
| std::string triqs::modest::embedding::description | ( | bool | verbosity = false | ) | const |
Summarize the embedding object.
Definition at line 101 of file printing.cpp.
| embedding triqs::modest::embedding::drop_imp | ( | long | imp_idx | ) | const |
Remove an impurity from the embedding table \( \psi \).
Remove the impurity imp_idx, map the corresponding \( \alpha \) blocks to -1 (i.e. no longer connected to an impurity) and relabel the other impurities with a number > imp_idx.
| imp_idx | Index of the impurity to remove from the table \( \psi \). |
Definition at line 274 of file embedding.cpp.
|
inline |
Embed Green's function containers.
Embed impurity solver self-energies into an embedded self-energy.
| Sigma_imp_vec | A list of impurity self-energies. |
Definition at line 476 of file embedding.hpp.
|
inline |
Embed pairs Green's function containers and matrices.
Embed the impurity self-energy decomposed as a list of dynamic and a list of static parts.
| Mesh | The type of mesh. |
| Sigma_imp_vec | A list of dynamic impurity self-energies. |
| Sigma_imp_static_vec | A list of static impurity self-energies. |
Definition at line 535 of file embedding.hpp.
| block2_matrix_t triqs::modest::embedding::embed | ( | std::vector< block_matrix_t > const & | Sigma_imp_static_vec | ) | const |
Embed block matrices into the full correlated space.
Embeds static (frequency-independent) impurity data stored as block matrices into the \( (\alpha, \sigma) \)-indexed embedded representation. This is the matrix analogue of the frequency-dependent embed operation.
| Sigma_imp_static_vec | List of block matrices, one per impurity. |
Definition at line 418 of file embedding.cpp.
|
inline |
Embed impurity data into the full correlated space.
This method maps impurity solver data into the embedded representation using the \( \psi \) mapping table. Given data from each impurity solver organized by blocks \( (\gamma, \tau) \), the method constructs the full embedded arrays indexed by \( (\alpha, \sigma) \).
The algorithm proceeds as follows:
Blocks with imp_idx == -1 (disconnected from any impurity) remain zero.
The template parameter Rank determines the dimensionality of the data arrays. For frequency-dependent quantities (Rank ∈ {3,5}), the first dimension is the frequency index.
| Rank | The rank of the underlying nda arrays (e.g., 2 for static, 3 for frequency-dependent). |
| imps_blocks | Nested vector [n_imp][block] of impurity data arrays. |
Definition at line 408 of file embedding.hpp.
| gf_struct2_t triqs::modest::embedding::embed_block_structure | ( | ) | const |
Block structure (names and dimensions) for the embedded self-energy \( \Sigma_{\text{embed}} \).
Definition at line 153 of file embedding.cpp.
|
inline |
Extract Green's function containers.
| Mesh | The mesh type triqs::mesh::{dlr_imfreq, imfreq}. |
| g_loc | Block2Gf of gloc in \( M \times M \) space. |
Definition at line 502 of file embedding.hpp.
| std::vector< block_matrix_t > triqs::modest::embedding::extract | ( | block2_matrix_t const & | matrix_C | ) | const |
Extract block matrices from the embedded representation.
Extracts static (frequency-independent) impurity data from the embedded \( (\alpha, \sigma) \)-indexed representation back into per-impurity block matrices. This is the inverse of the block matrix embed operation.
| matrix_C | Embedded block2 matrix in \( \mathcal{C} \) space. |
Definition at line 426 of file embedding.cpp.
|
inline |
Extract impurity data from embedded arrays.
This method performs the inverse of the embed operation: it takes data in the full correlated space and extracts the individual impurity blocks using the reverse mapping \( \psi^{-1} \).
The algorithm proceeds in two steps:
The template parameter Rank determines the dimensionality of the underlying data arrays. For frequency-dependent quantities (Rank ∈ {3,5}), the first dimension is interpreted as the frequency index.
| Rank | The rank of the underlying nda arrays (e.g., 2, 4 for static, 3, 5 for frequency-dependent). |
| X | Vector of arrays in the embedded space, one per spin channel \( \sigma \). |
Definition at line 338 of file embedding.hpp.
| std::vector< gf_struct_t > triqs::modest::embedding::imp_block_structure | ( | ) | const |
Block structure (names and dimensions) for each impurity solver.
Definition at line 161 of file embedding.cpp.
|
inlinenodiscard |
The impurity decomposition.
Definition at line 131 of file embedding.hpp.
|
inline |
Create zero-initialized impurity self-energies.
Constructs a list of zero-initialized self-energy containers for each impurity, with both dynamic (frequency-dependent) and static components. The block structure of each impurity's self-energy is determined by imp_block_structure().
Each impurity receives a pair consisting of:
| Mesh | The mesh type (e.g., imfreq, refreq, dlr_imfreq). |
| mesh | The frequency mesh for the dynamic self-energy. |
Definition at line 286 of file embedding.hpp.
| embedding triqs::modest::embedding::merge_embed_block_by_imp | ( | ) | const |
Merge consecutive \( \alpha \) blocks belonging to the same impurity into a single block.
Merges consecutive \( \alpha \) blocks that belong to the same atom into a single block. Atom boundaries are detected by monitoring the \( \gamma \) index: within one atom the \( \gamma \) values are strictly increasing; when \( \gamma \) resets or the impurity index changes a new group is started. Disconnected blocks (imp_idx == -1) are never merged and pass through unchanged.
Definition at line 200 of file embedding.cpp.
|
inlinenodiscard |
Number of blocks in \( \alpha \) for the \( \Sigma_{\text{embed}} \).
Definition at line 116 of file embedding.hpp.
|
inlinenodiscard |
Number of blocks in \( \gamma \) for the \( \Sigma_{\text{imp}} \) [imp_idx].
Definition at line 122 of file embedding.hpp.
|
inlinenodiscard |
Number of impurities.
Definition at line 125 of file embedding.hpp.
|
inlinenodiscard |
Number of blocks in \( \sigma \) for the \( \Sigma_{\text{embed}} \).
Definition at line 119 of file embedding.hpp.
|
default |
|
inline |
Bracket accessor: \( \psi[\alpha,\sigma] \).
Definition at line 110 of file embedding.hpp.
|
inlinenodiscard |
The mapping table \( \psi \).
Definition at line 113 of file embedding.hpp.
| embedding triqs::modest::embedding::replace_imp | ( | long | imp_idx_old, |
| long | imp_idx_new ) const |
Redirect all \( \psi \) entries from one impurity to another.
Rewires every \( (\alpha, \sigma) \) that currently points to imp_idx_old so that it points to imp_idx_new instead. The impurity at imp_idx_old remains in the embedding but becomes dangling — no \( \alpha \) block maps to it any longer. Call drop_imp(imp_idx_old) afterwards to remove the dangling entry and compact the indices.
| imp_idx_old | The impurity whose \( \alpha \) connections are redirected. |
| imp_idx_new | The impurity that will receive those connections. |
Definition at line 287 of file embedding.cpp.
|
inlinenodiscard |
The names of the sigma indices.
Definition at line 128 of file embedding.hpp.
| embedding triqs::modest::embedding::slice_sigma | ( | ) | const |
Slice the embedding to a single \( \sigma \) channel ("ud").
Converts a spinful embedding (with two spin channels, e.g., "up" and "down") into a single-channel embedding labelled "ud". This is useful when working with systems with spin-orbit coupling or spin-averaged quantities, like the density-density susceptibility.
Definition at line 190 of file embedding.cpp.
| embedding triqs::modest::embedding::split_imp | ( | long | imp_idx, |
| std::function< bool(long)> | p ) const |
Split impurity imp_idx using a predicate.
Partitions the blocks of impurity imp_idx into two new impurities based on predicate p. Blocks for which p(block_idx) returns true stay with imp_idx; the rest are assigned to a new impurity inserted at imp_idx + 1.
| imp_idx | Impurity number. |
| p | Predicate taking a block index and returning true/false. |
Definition at line 301 of file embedding.cpp.
|
delete |
| embedding triqs::modest::embedding::split_imp | ( | long | imp_idx, |
| std::vector< long > const & | block_list ) const |
Split impurity imp_idx based on block_list.
For impurity imp_idx, split part of its blocks into a new impurity. The blocks that were split off remain mapped to their original alpha blocks with the updated imp_idx.
| imp_idx | Impurity number. |
| block_list | A list of blocks of imp_idx to split off. |
Definition at line 336 of file embedding.cpp.
| embedding triqs::modest::embedding::split_imp_block | ( | long | imp_idx, |
| long | gamma, | ||
| std::vector< long > const & | new_dims ) const |
Split a single \( \gamma \) block of an impurity into multiple blocks.
Splits block gamma of impurity imp_idx into multiple blocks whose sizes are given by new_dims. The sum of new_dims must equal the original dimension of the block. For example, a block of dimension 5 could be split into blocks of dimensions 2 (e.g.) and 3 (t2g).
| imp_idx | The index of the impurity to operate on. |
| gamma | The block index of the impurity to split. |
| new_dims | New dimensions of the split blocks; must sum to the original block dimension. |
Definition at line 345 of file embedding.cpp.
| embedding triqs::modest::embedding::swap_sigma | ( | long | alpha | ) | const |
Swap the \( \sigma \) (spin) assignment for \( \alpha \) block alpha.
For block \( \alpha \) transforms \( (\sigma,\sigma') \to (\tau, \tau') \) to \( (\sigma, \sigma') \to (\tau', \tau)\).
| alpha | The index of the alpha block whose spin assignment is swapped. |
Definition at line 173 of file embedding.cpp.
| embedding triqs::modest::embedding::swap_sigma | ( | std::vector< long > | alphas | ) | const |
Swap the \( \sigma \) (spin) assignment for all \( \alpha \) blocks in alphas.
For each block \( \alpha \) in alphas, transforms \( (\sigma,\sigma') \to (\tau, \tau') \) to \( (\sigma, \sigma') \to (\tau', \tau)\).
| alphas | A list of alpha blocks whose spin assignments are swapped. |
Definition at line 182 of file embedding.cpp.
|
friend |
|
friend |
|
friend |
Definition at line 167 of file printing.cpp.