ncSileSiesta¶
-
class
sisl.io.siesta.
ncSileSiesta
(filename, mode='r', lvl=0, access=1, *args, **kwargs)¶ Bases:
sisl.io.siesta.SileCDFSiesta
Generic NetCDF output file containing a large variety of information
Attributes
__dict__
__doc__
__module__
__weakref__
list of weak references to the object (if defined)
_cmp_args
Returns the compression arguments for the NetCDF file
_write_default
_write_default_only
File of the current Sile
File of the current Sile
Return a list of available grids in this file.
Methods
_ArgumentParser_args_single
()Default arguments for the Sile
__delattr__
Implement delattr(self, name).
__dir__
Default dir() implementation.
__enter__
()Opens the output file and returns it self
__eq__
Return self==value.
__exit__
(type, value, traceback)__format__
Default object formatter.
__ge__
Return self>=value.
__getattr__
(name)Override to check the handle
__getattribute__
Return getattr(self, name).
__gt__
Return self>value.
__hash__
Return hash(self).
__init__
(filename[, mode, lvl, access])Initialize self.
__init_subclass__
This method is called when a class is subclassed.
__iter__
([group, dimension, variable, …])Iterator on all groups, variables and dimensions.
__le__
Return self<=value.
__lt__
Return self<value.
__ne__
Return self!=value.
__new__
Create and return a new object.
__reduce__
Helper for pickle.
__reduce_ex__
Helper for pickle.
__repr__
Return repr(self).
__setattr__
Implement setattr(self, name, value).
__sizeof__
Size of object in memory, in bytes.
__str__
()Return a representation of the Sile
__subclasshook__
Abstract classes can override this to customize issubclass().
_base_file
(f)Make f refer to the file with the appropriate base directory
_base_setup
(*args, **kwargs)Setup the Sile after initialization
_crt_dim
(n, name, l)_crt_grp
(n, name)_crt_var
(n, name, *args, **kwargs)_dimension
(name[, tree])Local method for obtaing the dimension in a certain tree
_dimensions
(n, name[, tree])Retrieve method to get the NetCDF variable
_read_class
(cls[, dim])_read_class_spin
(cls, **kwargs)_setup
(*args, **kwargs)Setup the Sile after initialization
_value
(name[, tree])Local method for obtaining the data from the SileCDF.
_variable
(name[, tree])Local method for obtaining the data from the SileCDF.
_variables
(n, name[, tree])Retrieve method to get the NetCDF variable
_write_overlap
(spgroup, csr, orthogonal, S_idx)_write_settings
()Internal method for writing settings.
_write_sparsity
(csr, nsc)close
()dir_file
([filename])File of the current Sile
exist
()Query whether the file exists
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
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
Returns the fermi-level
Returns a vector with final forces contained.
Reads the force-constant stored in the nc file
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
Returns a SuperCell object from a Siesta.nc file
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
(geometry)Creates the NetCDF file and writes the geometry information
write_hamiltonian
(H, **kwargs)Writes Hamiltonian model to file
write_overlap
(S, **kwargs)Write the overlap matrix to the NetCDF file
-
property
base_file
¶ File of the current Sile
-
close
()¶
-
dir_file
(filename=None)¶ File of the current Sile
-
exist
()¶ Query whether the file exists
-
property
file
¶ File of the current Sile
-
property
grids
¶ Return a list of available grids in this file.
-
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_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 – contains the directions, and 3rd dimensions contains -/+ displacements.
- Return type
numpy.ndarray with 5 dimensions containing all the forces. The 2nd dimensions contains
-
read_grid
(name, spin=0, **kwargs)[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
-
write_hamiltonian
(H, **kwargs)[source]¶ Writes Hamiltonian model to file
- Parameters
H (Hamiltonian) – the model to be saved in the NC file
Ef (float, optional) – the Fermi level of the electronic structure (in eV), default to 0.
-
property