ncSileSiesta¶
-
class
sisl.io.siesta.
ncSileSiesta
(filename, mode='r', lvl=0, access=1, *args, **kwargs)[source]¶ Generic NetCDF output file containing a large variety of information
Attributes
base_file
File of the current Sile file
File of the current Sile Methods
__init__
(filename[, mode, lvl, access])Initialize self. close
()dir_file
([filename])File of the current Sile exist
()Query whether the file exists grids
()Return a list of available grids in this file. 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_basis
()Returns a set of atoms corresponding to the basis-sets in the nc file read_density_matrix
(**kwargs)Returns a density matrix from the underlying NetCDF file read_dynamical_matrix
(**kwargs)Returns a dynamical matrix from the underlying NetCDF file read_energy_density_matrix
(**kwargs)Returns energy density matrix from the underlying NetCDF file read_force
()Returns a vector with final forces contained. read_force_constant
()Reads the force-constant stored in the nc 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 Hamiltonian from the underlying NetCDF file read_overlap
(**kwargs)Returns a overlap matrix from the underlying NetCDF file read_supercell
()Returns a SuperCell object from a Siesta.nc file read_supercell_nsc
()Returns number of supercell connections write
(*args, **kwargs)Generic write method which should be overloaded in child-classes write_basis
(atom)Write the current atoms orbitals as the basis write_density_matrix
(DM, **kwargs)Writes density matrix model to file write_dynamical_matrix
(D, **kwargs)Writes dynamical matrix model to file write_energy_density_matrix
(EDM, **kwargs)Writes energy density matrix model to file write_geometry
(geom)Creates the NetCDF file and writes the geometry information write_hamiltonian
(H, **kwargs)Writes Hamiltonian model to file write_overlap
(**kwargs)Write the overlap matrix to the NetCDF file -
base_file
¶ File of the current Sile
-
close
()¶
-
dir_file
(filename=None)¶ File of the current Sile
-
exist
()¶ Query whether the file exists
-
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 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_dynamical_matrix
(**kwargs)[source]¶ Returns a dynamical matrix from the underlying NetCDF file
This assumes that the dynamical matrix is stored in the field “H” as would the Hamiltonian. This is counter-intuitive but is required when using PHtrans.
-
read_energy_density_matrix
(**kwargs)[source]¶ Returns energy density matrix from the underlying NetCDF file
-
read_force_constant
()[source]¶ Reads the force-constant stored in the nc file
Returns: - force constants : numpy.ndarray with 5 dimensions containing all the forces. The 2nd dimensions contains
contains the directions, and 3rd dimensions contains -/+ displacements.
-
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 or array_like, optional
the spin-index for retrieving one of the components. If a vector is passed it refers to the fraction per indexed component. I.e.
[0.5, 0.5]
will return sum of half the first two components. Default to the first component.
-
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_basis
(atom)[source]¶ Write the current atoms orbitals as the basis
Parameters: - atom : Atoms
atom specifications to write.
-
write_density_matrix
(DM, **kwargs)[source]¶ Writes density matrix model to file
Parameters: - DM : DensityMatrix
the model to be saved in the NC file
-
write_dynamical_matrix
(D, **kwargs)[source]¶ Writes dynamical matrix model to file
Parameters: - D : DynamicalMatrix
the model to be saved in the NC file
-
write_energy_density_matrix
(EDM, **kwargs)[source]¶ Writes energy density matrix model to file
Parameters: - EDM : EnergyDensityMatrix
the model to be saved in the NC file
-