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
File of the current Sile
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 NetCDF4Dataset
typeisDimension
(obj)Return true if
obj
is an instance of the NetCDF4Dimension
typeisGroup
(obj)Return true if
obj
is an instance of the NetCDF4Group
typeisRoot
(obj)Return true if
obj
is an instance of the NetCDF4Dataset
typeisVariable
(obj)Return true if
obj
is an instance of the NetCDF4Variable
typeiter
([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 NetCDF4Dataset
typeThis is just a wrapper for
isinstance(obj, netCDF4.Dataset)
.
- classmethod isDimension(obj)
Return true if
obj
is an instance of the NetCDF4Dimension
typeThis is just a wrapper for
isinstance(obj, netCDF4.Dimension)
.
- classmethod isGroup(obj)
Return true if
obj
is an instance of the NetCDF4Group
typeThis is just a wrapper for
isinstance(obj, netCDF4.Group)
.
- classmethod isRoot(obj)
Return true if
obj
is an instance of the NetCDF4Dataset
typeThis is just a wrapper for
isinstance(obj, netCDF4.Dataset)
.
- classmethod isVariable(obj)
Return true if
obj
is an instance of the NetCDF4Variable
typeThis 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:
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
- 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
- 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
- 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
- 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.