sisl.io.siesta.tsgfSileSiesta
- class sisl.io.siesta.tsgfSileSiesta(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.tsgfSileSiesta("hello.GF") as f: ... nspin, no, k, E = f.read_header() ... for ispin, new_k, k, E in f: ... if new_k: ... H, S = f.read_hamiltonian() ... SeHSE = f.read_self_energy()
To write a file do:
>>> with sisl.io.tsgfSileSiesta("hello.GF") as f: ... f.write_header(sisl.MonkhorstPack(...), E) ... for ispin, new_k, k, E in f: ... if new_k: ... f.write_hamiltonian(H, S) ... f.write_self_energy(SeHSE)
Methods
Eindex
(E)Return the closest energy index corresponding to the energy
E
HkSk
([k, spin])Retrieve H and S for the given k-point
base_directory
([relative_to])Retrieve the base directory of the file, relative to the path relative_to
dir_file
([filename, filename_base])File of the current Sile
Calculate the estimated size of the resulting file
kindex
(k)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
Attributes
File of the current Sile
File of the current Sile
- Eindex(E)
Return the closest energy index corresponding to the energy
E
- base_directory(relative_to='.')
Retrieve the base directory of the file, relative to the path relative_to
- dir_file(filename=None, filename_base='')
File of the current Sile
- disk_usage()
Calculate the estimated size of the resulting file
- Returns:
estimated disk-space used in GB
- kindex(k)
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
- Parameters:
kwargs – keyword arguments will try and search for the attribute
read_<>
and call it with the remaining**kwargs
as arguments.
- read_hamiltonian() tuple[ndarray, ndarray]
Return current Hamiltonian and overlap matrix from the GF file
- Returns:
complex128 (
Hamiltonian matrix
)complex128 (
Overlap matrix
)
- read_header()
Read the header of the file and open it for reading subsequently
NOTES: this method may change in the future
- Returns:
nspin (
number
ofspin-components stored (1
or2)
)no_u (
size
ofthe matrices returned
)k (
k points in the GF file
)E (
energy points in the GF file
)
- read_self_energy() ndarray
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 (
Self-energy matrix
)
- self_energy(E, k=0, spin: int = 0) ndarray
Retrieve self-energy for a given energy-point and k-point
- 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 HamiltonianS (
matrix
, optional) – a square matrix corresponding to the overlap, for efficiency reasons it may be advantageous to specify this argument for orthogonal cells.
- write_header(bz, E, mu: float = 0.0, obj=None)
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)sE (
array_like
ofcmplx
orfloat
) – the energy points. If obj is an instance of SelfEnergy where an associatedeta
is defined then E may be float, otherwise it has to be a complex array.mu – chemical potential in the file
obj (
...
, optional) – an object that contains the Hamiltonian definitions, defaults tobz.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)
- property base_file
File of the current Sile
- property file
File of the current Sile