ncSileSiesta

class sisl.io.siesta.ncSileSiesta(filename, mode='r', lvl=0, access=1, _open=True)[source]

Siesta file object

Attributes

file Filename of the current Sile

Methods

__init__(filename[, mode, lvl, access, _open]) Creates/Opens a SileCDF
close()
exist() Query whether the file exists
grids() Return a list of available grids in this file.
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_density_matrix(**kwargs) Returns a density matrix from the underlying NetCDF file
read_energy_density_matrix(**kwargs) Returns energy density matrix from the underlying NetCDF file
read_geometry() Returns Geometry object from a Siesta.nc file
read_grid(name[, spin]) Reads a grid in the current Siesta.nc file
read_hamiltonian(**kwargs) Returns a tight-binding model from the underlying NetCDF file
read_hessian(**kwargs) Returns a tight-binding model from the underlying NetCDF file
read_supercell() Returns a SuperCell object from a Siesta.nc file
write(*args, **kwargs) Generic write method which should be overloaded in child-classes
write_geometry(geom) Creates the NetCDF file and writes the geometry information
write_hamiltonian(H, **kwargs) Writes Hamiltonian model to file
write_hessian(H, **kwargs) Writes Hessian model to file
close()
exist()

Query whether the file exists

file

Filename of the current Sile

grids()[source]

Return a list of available grids in this file.

isDataset(obj)

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

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

isDimension(obj)

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

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

isGroup(obj)

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

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

isRoot(obj)

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

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

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_density_matrix(**kwargs)[source]

Returns a density matrix from the underlying NetCDF file

read_energy_density_matrix(**kwargs)[source]

Returns energy density matrix from the underlying NetCDF file

read_geometry()[source]

Returns Geometry object from a Siesta.nc file

NOTE: Interaction range of the Atoms are currently not read.

read_grid(name, spin=0)[source]

Reads a grid in the current Siesta.nc file

Enables the reading and processing of the grids created by Siesta

Parameters:

name : str

name of the grid variable to read

spin : int

the spin-index

read_hamiltonian(**kwargs)[source]

Returns a tight-binding model from the underlying NetCDF file

read_hessian(**kwargs)[source]

Returns a tight-binding model from the underlying NetCDF file

read_supercell()[source]

Returns a SuperCell object from a Siesta.nc 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_geometry(geom)[source]

Creates the NetCDF file and writes the geometry information

write_hamiltonian(H, **kwargs)[source]

Writes Hamiltonian model to file

Parameters:

H : Hamiltonian model

the model to be saved in the NC file

Ef : double=0

the Fermi level of the electronic structure (in eV)

write_hessian(H, **kwargs)[source]

Writes Hessian model to file

Parameters:

H : Hessian model

the model to be saved in the NC file