deltancSileTBtrans

class sisl.io.tbtrans.deltancSileTBtrans(filename, mode='r', lvl=0, access=1, *args, **kwargs)

Bases: sisl.io.tbtrans.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\mathbf\Sigma(E, \mathbf k)\]

This file may either be used directly as the \(\delta\mathbf H\) or the \(\delta\mathbf\Sigma\).

When writing \(\delta\) terms using write_delta one may add k or E arguments to make the \(\delta\) dependent on k and/or E.

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

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

_cmp_args

Returns the compression arguments for the NetCDF file

_write_default

_write_default_only

base_file

File of the current Sile

file

File of the current Sile

Methods

_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, lvl, access])

Initialize self.

__init_subclass__

This method is called when a class is subclassed.

__iter__([group, dimension, variable, …])

Iterator on all groups, variables and dimensions.

__le__

Return self<=value.

__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().

_add_lvl(ilvl)

Simply adds and returns a group if it does not exist it will be created

_base_file(f)

Make f refer to the file with the appropriate base directory

_base_setup(*args, **kwargs)

Setup the Sile after initialization

_crt_dim(n, name, l)

_crt_grp(n, name)

_crt_var(n, name, *args, **kwargs)

_dimension(name[, tree])

Local method for obtaing the dimension in a certain tree

_dimensions(n, name[, tree])

Retrieve method to get the NetCDF variable

_get_lvl(ilvl)

_get_lvl_k_E(**kwargs)

Return level, k and E indices, in that order.

_read_class(cls, **kwargs)

Reads a class model from a file

_setup(*args, **kwargs)

Setup the Sile after initialization

_value(name[, tree])

Local method for obtaining the data from the SileCDF.

_variable(name[, tree])

Local method for obtaining the data from the SileCDF.

_variables(n, name[, tree])

Retrieve method to get the NetCDF variable

close()

dir_file([filename])

File of the current Sile

exist()

Query whether the file exists

iter([group, dimension, variable, levels, root])

Iterator on all groups, variables and dimensions.

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

read_supercell()

Returns the SuperCell object from this file

write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

write_delta(delta, **kwargs)

Writes a \(\delta\) Hamiltonian to the file

write_geometry(geometry)

Creates the NetCDF file and writes the geometry information

write_supercell(sc)

Creates the NetCDF file and writes the supercell information

property base_file

File of the current Sile

close()
dir_file(filename=None)

File of the current Sile

exist()

Query whether the file exists

property file

File of the current Sile

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:

  1. Group

  2. Dimensions in group

  3. 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 instances

  • dimension (bool (True)) – whether the iterator yields Dimension instances

  • variable (bool (True)) – whether the iterator yields Variable instances

  • levels (int (-1)) – number of levels to traverse, with respect to root 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
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_delta(**kwargs)[source]

Reads a delta model from the file

read_geometry(*args, **kwargs)[source]

Returns the Geometry object from this file

read_supercell()[source]

Returns the SuperCell object from this file

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\) Hamiltonian 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 file

  • k (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.

write_geometry(geometry)[source]

Creates the NetCDF file and writes the geometry information

write_supercell(sc)[source]

Creates the NetCDF file and writes the supercell information