Block Structure

The BlockStructure class allows to change and manipulate Green’s functions structures and mappings from sumk to solver.

The block structure can also be written to and read from HDF files.

Warning

Do not write the individual elements of this class to a HDF file, as they belong together and changing one without the other can result in unexpected results. Always write the BlockStructure object as a whole.

Writing the sumk_to_solver and solver_to_sumk elements individually is not implemented.

class dft.block_structure.BlockStructure(gf_struct_sumk=None, gf_struct_solver=None, solver_to_sumk=None, sumk_to_solver=None, solver_to_sumk_block=None)[source]

Bases: object

Contains information about the Green function structure.

This class contains information about the structure of the solver and sumk Green functions and the mapping between them.

Parameters:

gf_struct_sumk : list of list of tuple

gf_struct_sumk[ish][idx] = (block_name,list of indices in block)

for correlated shell ish; idx is just a counter in the list

gf_struct_solver : list of dict

gf_struct_solver[ish][block] = list of indices in that block

for inequivalent correlated shell ish

solver_to_sumk : list of dict

solver_to_sumk[ish][(from_block,from_idx)] = (to_block,to_idx)

maps from the solver block and index to the sumk block and index for inequivalent correlated shell ish

sumk_to_solver : list of dict

sumk_to_solver[ish][(from_block,from_idx)] = (to_block,to_idx)

maps from the sumk block and index to the solver block and index for inequivalent correlated shell ish

solver_to_sumk_block : list of dict

solver_to_sumk_block[ish][from_block] = to_block

maps from the solver block to the sumk block for inequivalent correlated shell ish

approximate_as_diagonal()[source]

Create a structure for a GF with zero off-diagonal elements.

Warning

In general, this will throw away non-zero elements of the Green’s function. Be sure to verify whether this approximation is justified.

convert_gf(G, G_struct, ish=0, show_warnings=True, **kwargs)[source]

Convert BlockGf from its structure to this structure.

Warning

Elements that are zero in the new structure due to the new block structure will be just ignored, thus approximated to zero.

Parameters:

G : BlockGf

the Gf that should be converted

G_struct : GfStructure

the structure ofthat G

ish : int

shell index

show_warnings : bool

whether to show warnings when elements of the Green’s function get thrown away

**kwargs : :

options passed to the constructor for the new Gf

create_gf(ish=0, gf_function=<type 'pytriqs.gf.local.gf.GfImFreq'>, **kwargs)[source]

Create a zero BlockGf having the gf_struct_solver structure.

When using GfImFreq as gf_function, typically you have to supply beta as keyword argument.

Parameters:

ish : int

shell index

gf_function : constructor

function used to construct the Gf objects constituting the individual blocks; default: GfImFreq

**kwargs : :

options passed on to the Gf constructor for the individual blocks

classmethod full_structure(gf_struct, corr_to_inequiv)[source]

Construct structure that maps to itself.

This has the same structure for sumk and solver, and the mapping solver_to_sumk and sumk_to_solver is one-to-one.

Parameters:

gf_struct : list of dict

gf_struct[ish][block] = list of indices in that block

for (inequivalent) correlated shell ish

corr_to_inequiv : list

gives the mapping from correlated shell csh to inequivalent correlated shell icsh, so that corr_to_inequiv[csh]=icsh e.g. SumkDFT.corr_to_inequiv

if None, each inequivalent correlated shell is supposed to be correspond to just one correlated shell with the same index; there is not default, None has to be set explicitly!

map_gf_struct_solver(mapping)[source]

Map the Green function structure from one struct to another.

Parameters:

mapping : list of dict

the dict consists of elements (from_block,from_index) : (to_block,to_index) that maps from one structure to the other

pick_gf_struct_solver(new_gf_struct)[source]

Pick selected orbitals within blocks.

This throws away parts of the Green’s function that (for some reason - be sure that you know what you’re doing) shouldn’t be included in the calculation.

To drop an entire block, just don’t include it. To drop a certain index within a block, just don’t include it.

If it was before:

[{‘up’:[0,1],’down’:[0,1],’left’:[0,1]}]

to choose the 0th index of the up block and the 1st index of the down block and drop the left block, the new_gf_struct would have to be

[{‘up’:[0],’down’:[1]}]

Note that the indices will be renamed to be a 0-based sequence of integers, i.e. the new structure will actually be [{‘up’:[0],’down’:[0]}].

For dropped indices, sumk_to_solver will map to (None,None).

Parameters:

new_gf_struct : list of dict

formatted the same as gf_struct_solver:

new_gf_struct[ish][block]=list of indices in that block.

pick_gf_struct_sumk(new_gf_struct)[source]

Pick selected orbitals within blocks.

This throws away parts of the Green’s function that (for some reason - be sure that you know what you’re doing) shouldn’t be included in the calculation.

To drop an entire block, just don’t include it. To drop a certain index within a block, just don’t include it.

If it was before:

[{‘up’:[0,1],’down’:[0,1],’left’:[0,1]}]

to choose the 0th index of the up block and the 1st index of the down block and drop the left block, the new_gf_struct would have to be

[{‘up’:[0],’down’:[1]}]

Note that the indices will be renamed to be a 0-based sequence of integers.

For dropped indices, sumk_to_solver will map to (None,None).

Parameters:

new_gf_struct : list of dict

formatted the same as gf_struct_solver:

new_gf_struct[ish][block]=list of indices in that block.

However, the indices are not according to the solver Gf but the sumk Gf.