sisl.io.tbtrans.deltancSileTBtrans
- class sisl.io.tbtrans.deltancSileTBtrans(filename, mode='r', lvl=0, access=1, *args, **kwargs)
Bases:
SileCDFTBtrans
TBtrans \(\delta\) file object
The \(\delta\) file object is an extension enabled in TBtrans which allows changing the Hamiltonian in transport problems.
\[\mathbf H'(\mathbf k) = \mathbf H(\mathbf k) + \delta\mathbf H(E, \mathbf k) + \delta\boldsymbol\Sigma(E, \mathbf k)\]This file may either be used directly as the \(\delta\mathbf H\) or the \(\delta\boldsymbol\Sigma\).
When writing \(\delta\) terms using
write_delta
one may addk
orE
arguments to make the \(\delta\) dependent onk
and/orE
.Refer to the TBtrans manual on how to use this feature.
Examples
>>> H = Hamiltonian(geom.graphene(), dtype=np.complex128) >>> H[0, 0] = 1j >>> dH = get_sile('deltaH.dH.nc', 'w') >>> dH.write_delta(H) >>> H[1, 1] = 1. >>> dH.write_delta(H, k=[0, 0, 0]) # Gamma only >>> H[0, 0] += 1. >>> dH.write_delta(H, E=1.) # only at 1 eV >>> H[1, 1] += 1.j >>> dH.write_delta(H, E=1., k=[0, 0, 0]) # only at 1 eV and Gamma-point
Plotting
Plotting functions for the
deltancSileTBtrans
class.plot.geometry
(*args[, ...])Calls
read_geometry
and creates aGeometryPlot
from its output.Methods
base_directory
([relative_to])Retrieve the base directory of the file, relative to the path relative_to
close
()dir_file
([filename, filename_base])File of the current Sile
has_level
(ilvl)Query whether the file has level ilvl content
iter
([group, dimension, variable, levels, root])Iterator on all groups, variables and dimensions.
merge
(fname, *deltas, **kwargs)Merge several delta files into one Sile which contains the sum of the content
read
(*args, **kwargs)Generic read method which should be overloaded in child-classes
read_delta
(**kwargs)Reads a delta model from the file
read_geometry
(*args, **kwargs)Returns the Geometry object from this file
Returns the Lattice object from this file
write
(*args, **kwargs)Generic write method which should be overloaded in child-classes
write_delta
(delta, **kwargs)Writes a \(\delta\) term to the file
write_geometry
(geometry)Creates the NetCDF file and writes the geometry information
write_lattice
(lattice)Creates the NetCDF file and writes the supercell information
Attributes
File of the current Sile
File of the current Sile
- base_directory(relative_to='.')
Retrieve the base directory of the file, relative to the path relative_to
- close()
- dir_file(filename=None, filename_base='')
File of the current Sile
- has_level(ilvl)[source]
Query whether the file has level ilvl content
- Parameters:
ilvl (
int
) – the level to be queried, one of 1, 2, 3 or 4
- iter(group=True, dimension=True, variable=True, levels=-1, root=None)
Iterator on all groups, variables and dimensions.
This iterator iterates through all groups, variables and dimensions in the
Dataset
The generator sequence will _always_ be:
Group
Dimensions in group
Variables in group
As the dimensions are generated before the variables it is possible to copy groups, dimensions, and then variables such that one always ensures correct dependencies in the generation of a new
SileCDF
.- Parameters:
group (
bool
(True)) – whether the iterator yields Group instancesdimension (
bool
(True)) – whether the iterator yields Dimension instancesvariable (
bool
(True)) – whether the iterator yields Variable instanceslevels (
int
(-1)) – number of levels to traverse, with respect toroot
variable, i.e. number of sub-groups this iterator will return.root (
str
(None)) – the base root to start iterating from.
Examples
Script for looping and checking each instance.
>>> for gv in self.iter(): ... if self.isGroup(gv): ... # is group ... elif self.isDimension(gv): ... # is dimension ... elif self.isVariable(gv): ... # is variable
- classmethod merge(fname, *deltas, **kwargs)[source]
Merge several delta files into one Sile which contains the sum of the content
In cases where implementors use several different delta files it is necessary to merge them into a single delta file before use in TBtrans. This method does exactly that.
Notes
The code checks whether fname is different from all deltas and that all deltas are the same class.
- Parameters:
fname (
str
,Path
) – the output name of the merged file*deltas (
deltancSileTBtrans
,str
,Path
) – all the delta files that should be merged**kwargs – arguments passed directly to the init of
cls(fname, **kwargs)
- plot.geometry(*args, data_kwargs={}, axes: Axes = ['x', 'y', 'z'], atoms: AtomsIndex = None, atoms_style: Sequence[AtomsStyleSpec] = [], atoms_scale: float = 1.0, atoms_colorscale: Colorscale | None = None, drawing_mode: Literal['scatter', 'balls', None] = None, bind_bonds_to_ats: bool = True, points_per_bond: int = 20, bonds_style: StyleSpec = {}, bonds_scale: float = 1.0, bonds_colorscale: Colorscale | None = None, show_atoms: bool = True, show_bonds: bool = True, show_cell: Literal['box', 'axes', False] = 'box', cell_style: StyleSpec = {}, nsc: tuple[int, int, int] = (1, 1, 1), atoms_ndim_scale: tuple[float, float, float] = (16, 16, 1), bonds_ndim_scale: tuple[float, float, float] = (1, 1, 10), dataaxis_1d: np.ndarray | Callable | None = None, arrows: Sequence[AtomArrowSpec] = (), backend='plotly') GeometryPlot
Calls
read_geometry
and creates aGeometryPlot
from its output.- Parameters:
axes – The axes to project the geometry to.
atoms – The atoms to plot. If None, all atoms are plotted.
atoms_style – List of style specifications for the atoms. See the showcase notebooks for examples.
atoms_scale – Scaling factor for the size of all atoms.
atoms_colorscale – Colorscale to use for the atoms in case the color attribute is an array of values. If None, the default colorscale is used for each backend.
drawing_mode – The method used to draw the atoms.
bind_bonds_to_ats – Whether to display only bonds between atoms that are being displayed.
points_per_bond – When the points are drawn using points instead of lines (e.g. in some frameworks to draw multicolor bonds), the number of points used per bond.
bonds_style – Style specification for the bonds. See the showcase notebooks for examples.
bonds_scale – Scaling factor for the width of all bonds.
bonds_colorscale – Colorscale to use for the bonds in case the color attribute is an array of values. If None, the default colorscale is used for each backend.
show_atoms – Whether to display the atoms.
show_bonds – Whether to display the bonds.
show_cell – Mode to display the cell. If False, the cell is not displayed.
cell_style – Style specification for the cell. See the showcase notebooks for examples.
nsc – Number of unit cells to display in each direction.
atoms_ndim_scale – Scaling factor for the size of the atoms for different dimensionalities (1D, 2D, 3D).
bonds_ndim_scale – Scaling factor for the width of the bonds for different dimensionalities (1D, 2D, 3D).
dataaxis_1d – Only meaningful for 1D plots. The data to plot on the Y axis.
arrows – List of arrow specifications to display. See the showcase notebooks for examples.
backend – The backend to use to generate the figure.
See also
GeometryPlot
The plot class used to generate the plot.
read_geometry
The method called to get the data.
- 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.
- 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_delta(delta, **kwargs)[source]
Writes a \(\delta\) term to the file
This term may be of
level-1: no E or k dependence
level-2: k-dependent
level-3: E-dependent
level-4: k- and E-dependent
- Parameters:
delta (
SparseOrbitalBZSpin
) – the model to be saved in the NC filek (
array_like
, optional) – a specific k-point \(\delta\) term. I.e. only save the \(\delta\) term for the given k-point. May be combined with E for a specific k and energy point.E (
float
, optional) – an energy dependent \(\delta\) term. I.e. only save the \(\delta\) term for the given energy. May be combined with k for a specific k and energy point.
Notes
The input options for TBtrans determine whether this is a self-energy term or a Hamiltonian term.
- property base_file
File of the current Sile
- property file
File of the current Sile
- plot
Plotting functions for the
deltancSileTBtrans
class.