sisl.io.siesta.gridncSileSiesta
- class sisl.io.siesta.gridncSileSiesta(filename, mode='r', lvl=0, access=1, *args, **kwargs)
Bases:
SileCDFSiesta
NetCDF real-space grid file
The grid sile will automatically convert the units from Siesta units (Bohr, Ry) to sisl units (Ang, eV) provided the correct extension is present.
Methods
close
()dir_file
([filename, filename_base])File of the current Sile
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_grid
([spin, name])Reads a grid in the current Siesta.grid.nc file
Returns a SuperCell object from a Siesta.grid.nc file
write
(*args, **kwargs)Generic write method which should be overloaded in child-classes
write_grid
(grid[, spin, nspin])Write a grid to the grid.nc file
write_supercell
(sc)Write a supercell to the grid.nc file
File of the current Sile
File of the current Sile
- __init__(filename, mode='r', lvl=0, access=1, *args, **kwargs)
- 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
- 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
- plot
Handles all plotting possibilities for a class
- 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_grid(spin=0, name='gridfunc', *args, **kwargs)[source]
Reads a grid in the current Siesta.grid.nc file
Enables the reading and processing of the grids created by Siesta
- to_json()
- 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.