# sisl.io.tbtrans.tbtgfSileTBtrans

class sisl.io.tbtrans.tbtgfSileTBtrans(filename, mode='r', *args, **kwargs)

Bases: _gfSileSiesta

Surface Green function file containing, Hamiltonian, overlap matrix and self-energies

Do not mix read and write statements when using this code. Complete one or the other before doing the other thing. Fortran does not allow the same file opened twice, if this is needed you are recommended to make a symlink to the file and thus open two different files.

This small snippet reads/writes the GF file

>>> with sisl.io.tbtgfSileTBtrans("hello.GF") as f:
...    for ispin, new_k, k, E in f:
...        if new_k:


To write a file do:

>>> with sisl.io.tbtgfSileTBtrans("hello.GF") as f:
...    for ispin, new_k, k, E in f:
...        if new_k:
...            f.write_hamiltonian(H, S)
...        f.write_self_energy(SeHSE)


Methods

 Return the closest energy index corresponding to the energy E HkSk([k, spin]) Retrieve H and S for the given k-point dir_file([filename, filename_base]) File of the current Sile Calculate the estimated size of the resulting file Return the index of the k-point that is closests to the queried k-point (in reduced coordinates) read(*args, **kwargs) Generic read method which should be overloaded in child-classes Return current Hamiltonian and overlap matrix from the GF file Read the header of the file and open it for reading subsequently Read the currently reached bulk self-energy self_energy(E[, k, spin]) Retrieve self-energy for a given energy-point and k-point write(*args, **kwargs) Generic write method which should be overloaded in child-classes write_hamiltonian(H[, S]) Write the current energy, k-point and H and S to the file write_header(bz, E[, mu, obj]) Write to the binary file the header of the file Write the current self energy, k-point and H and S to the file base_file File of the current Sile file File of the current Sile
Eindex(E)

Return the closest energy index corresponding to the energy E

Parameters

E (float or int) – if int, return it-self, else return the energy index which is closests to the energy.

HkSk(k=(0, 0, 0), spin=0)

Retrieve H and S for the given k-point

Parameters
• k (int or array_like of float, optional) – k-point to read the corresponding Hamiltonian and overlap matrices for. If a specific k-point is passed kindex will be used to find the corresponding index.

• spin (int, optional) – spin-index for the Hamiltonian and overlap matrices

__init__(filename, mode='r', *args, **kwargs)
property base_file

File of the current Sile

dir_file(filename=None, filename_base='')

File of the current Sile

disk_usage()

Calculate the estimated size of the resulting file

Return type

estimated disk-space used in GB

property file

File of the current Sile

kindex(k)

Return the index of the k-point that is closests to the queried k-point (in reduced coordinates)

Parameters

k (array_like of float or int) – the queried k-point in reduced coordinates $$]-0.5;0.5]$$. If int return it-self.

plot

Handles all plotting possibilities for a class

Parameters

kwargs – keyword arguments will try and search for the attribute read_<> and call it with the remaining **kwargs as arguments.

Return current Hamiltonian and overlap matrix from the GF file

Returns

• complex128 (Hamiltonian matrix)

• complex128 (Overlap matrix)

NOTES: this method may change in the future

Returns

• nspin (number of spin-components stored (1 or 2))

• no_u (size of the matrices returned)

• k (k points in the GF file)

Read the currently reached bulk self-energy

The returned self-energy is:

$\boldsymbol \Sigma_{\mathrm{bulk}}(E) = \mathbf S E - \mathbf H - \boldsymbol \Sigma(E)$
Returns

complex128

Return type

Self-energy matrix

self_energy(E, k=0, spin=0)

Retrieve self-energy for a given energy-point and k-point

Parameters
• E (int or float) – energy to retrieve self-energy at

• k (int or array_like of float, optional) – k-point to retrieve k-point at

• spin (int, optional) – spin-index to retrieve self-energy at

to_json()
write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

Parameters

**kwargs – keyword arguments will try and search for the attribute write_ and call it with the remaining **kwargs as arguments.

write_hamiltonian(H, S=None)

Write the current energy, k-point and H and S to the file

Parameters
• H (matrix) – a square matrix corresponding to the Hamiltonian

• S (matrix, optional) – a square matrix corresponding to the overlap, for efficiency reasons it may be advantageous to specify this argument for orthogonal cells.

Write to the binary file the header of the file

Parameters
• bz (BrillouinZone) – contains the k-points, the weights and possibly the parent Hamiltonian (if obj is None)s

• E (array_like of cmplx or float) – the energy points. If obj is an instance of SelfEnergy where an associated eta is defined then E may be float, otherwise it has to be a complex array.

• mu (float, optional) – chemical potential in the file

• obj (..., optional) – an object that contains the Hamiltonian definitions, defaults to bz.parent

write_self_energy(SE)

Write the current self energy, k-point and H and S to the file

The self-energy must correspond to the bulk self-energy

$\boldsymbol \Sigma_{\mathrm{bulk}}(E) = \mathbf S E - \mathbf H - \boldsymbol \Sigma(E)$
Parameters

SE (matrix) – a square matrix corresponding to the self-energy (Green function)