tsgfSileSiesta¶
-
class
sisl.io.siesta.
tsgfSileSiesta
(filename, mode='r', *args, **kwargs)¶ Bases:
sisl.io.siesta._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)
Attributes
__dict__
__doc__
__module__
__weakref__
list of weak references to the object (if defined)
_write_default
_write_default_only
File of the current Sile
File of the current Sile
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
_ArgumentParser_args_single
()Default arguments for the Sile
__delattr__
Implement delattr(self, name).
__dir__
Default dir() implementation.
__enter__
()Opens the output file and returns it self
__eq__
Return self==value.
__exit__
(type, value, traceback)__format__
Default object formatter.
__ge__
Return self>=value.
__getattr__
(name)Override to check the handle
__getattribute__
Return getattr(self, name).
__gt__
Return self>value.
__hash__
Return hash(self).
__init__
(filename[, mode])Initialize self.
__init_subclass__
This method is called when a class is subclassed.
__iter__
()Iterate through the energies and k-points that this GF file is associated with
__le__
Return self<=value.
__len__
()__lt__
Return self<value.
__ne__
Return self!=value.
__new__
Create and return a new object.
__reduce__
Helper for pickle.
__reduce_ex__
Helper for pickle.
__repr__
Return repr(self).
__setattr__
Implement setattr(self, name, value).
__sizeof__
Size of object in memory, in bytes.
__str__
()Return a representation of the Sile
__subclasshook__
Abstract classes can override this to customize issubclass().
_base_file
(f)Make f refer to the file with the appropriate base directory
_base_setup
(*args, **kwargs)Setup the Sile after initialization
_close_gf
()_is_open
()_open_gf
(mode[, rewind])_setup
(*args, **kwargs)Simple setup that needs to be overwritten
_step_counter
(method, **kwargs)Method for stepping values must be called before doing the actual read to check correct values
dir_file
([filename])File of the current Sile
Calculate the estimated size of the resulting file
exist
()Query whether the file exists
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
-
Eindex
(E)¶ Return the closest energy index corresponding to the energy
E
-
HkSk
(k=0, 0, 0, spin=0)¶ Retrieve H and S for the given k-point
-
property
base_file
¶ File of the current Sile
-
dir_file
(filename=None)¶ File of the current Sile
-
disk_usage
()¶ Calculate the estimated size of the resulting file
- Returns
- Return type
estimated disk-space used in GB
-
exist
()¶ Query whether the file exists
-
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.
-
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
()¶ 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 of spin-components stored (1 or 2))
no_u (size of the matrices returned)
k (k points in the GF file)
E (energy points in the GF file)
-
read_self_energy
()¶ 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
-
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_header
(bz, E, mu=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)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)
-