ncSileHubbard

class hubbard.ncSileHubbard(filename, mode='r', lvl=0, access=1, *args, **kwargs)[source]

Bases: sisl.io.SileCDF

Read and write hubbard.HubbardHamiltonian object in binary files (netCDF4 support)

See also

sisl.io.SileCDF

sisl class

Attributes

base_file

File of the current Sile

file

File of the current Sile

Methods

ArgumentParser([p])

Returns the arguments that may be available for this Sile

ArgumentParser_out([p])

Appends additional arguments based on the output of the file

__init__(filename[, mode, lvl, access])

close()

dir_file([filename, filename_base])

File of the current Sile

isDataset(obj)

Return true if obj is an instance of the NetCDF4 Dataset type

isDimension(obj)

Return true if obj is an instance of the NetCDF4 Dimension type

isGroup(obj)

Return true if obj is an instance of the NetCDF4 Group type

isRoot(obj)

Return true if obj is an instance of the NetCDF4 Dataset type

isVariable(obj)

Return true if obj is an instance of the NetCDF4 Variable type

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_U([group, index])

Read Coulomb repulsion U parameter from netcdf file

read_density([group, index])

Read density from netcdf file

read_kT([group, index])

Read temperature from netcdf file

write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

write_density(n, U, kT, units[, Uij, group])

ArgumentParser(p=None, *args, **kwargs)

Returns the arguments that may be available for this Sile

Parameters

p (ArgumentParser) – the argument parser to add the arguments to.

ArgumentParser_out(p=None, *args, **kwargs)

Appends additional arguments based on the output of the file

Parameters

p (ArgumentParser) – the argument parser to add the arguments to.

property base_file

File of the current Sile

close()
dir_file(filename=None, filename_base='')

File of the current Sile

property file

File of the current Sile

classmethod isDataset(obj)

Return true if obj is an instance of the NetCDF4 Dataset type

This is just a wrapper for isinstance(obj, netCDF4.Dataset).

classmethod isDimension(obj)

Return true if obj is an instance of the NetCDF4 Dimension type

This is just a wrapper for isinstance(obj, netCDF4.Dimension).

classmethod isGroup(obj)

Return true if obj is an instance of the NetCDF4 Group type

This is just a wrapper for isinstance(obj, netCDF4.Group).

classmethod isRoot(obj)

Return true if obj is an instance of the NetCDF4 Dataset type

This is just a wrapper for isinstance(obj, netCDF4.Dataset).

classmethod isVariable(obj)

Return true if obj is an instance of the NetCDF4 Variable type

This is just a wrapper for isinstance(obj, netCDF4.Variable).

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_U(group=None, index=0)[source]

Read Coulomb repulsion U parameter from netcdf file

Parameters
  • group (str, optional) – netcdf group

  • index (int or list of ints, optional) – If there are groups in the file and no group is specified then it reads the U parameter from the index item in the groups dictionary

Return type

Float, numpy.ndarray or list depending on the saved U and if index is a list

read_density(group=None, index=0)[source]

Read density from netcdf file

Parameters
  • group (str, optional) – netcdf group

  • index (int or list of ints, optional) – If there are groups in the file and no group is specified then it reads the n variable (density) from the index item in the groups dictionary

Return type

numpy.ndarray or list of numpy.ndarrays, depending if index is a list

read_kT(group=None, index=0)[source]

Read temperature from netcdf file

Parameters
  • group (str, optional) – netcdf group

  • index (int or list of ints, optional) – If there are groups in the file and no group is specified then it reads the temperature (kT) from the index item in the groups dictionary

Return type

Float or list of floats containing the temperature times the Boltzmann constant (k)

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_density(n, U, kT, units, Uij=None, group=None)[source]