sisl.io.siesta.ncSileSiesta

class sisl.io.siesta.ncSileSiesta(filename, mode='r', lvl=0, access=1, *args, **kwargs)

Bases: SileCDFSiesta

Generic NetCDF output file containing a large variety of information

Methods

base_directory([relative_to])

Retrieve the base directory of the file, relative to the path relative_to

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_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_fermi_level()

Returns the fermi-level

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[, index])

Reads a grid in the current Siesta.nc file

read_hamiltonian(**kwargs)

Returns a Hamiltonian from the underlying NetCDF file

read_lattice()

Returns a Lattice object from a Siesta.nc file

read_lattice_nsc()

Returns number of supercell connections

read_overlap(**kwargs)

Returns a overlap matrix from the underlying NetCDF file

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

base_file

File of the current Sile

file

File of the current Sile

grids

Return a list of available grids in this file.

__init__(filename, mode='r', lvl=0, access=1, *args, **kwargs)

Just to pass away the args and kwargs

base_directory(relative_to='.')

Retrieve the base directory of the file, relative to the path relative_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

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:

  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
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_basis()[source]

Returns a set of atoms corresponding to the basis-sets in the nc file

read_density_matrix(**kwargs)[source]

Returns a density matrix from the underlying NetCDF file

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_fermi_level()[source]

Returns the fermi-level

read_force()[source]

Returns a vector with final forces contained.

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_geometry()[source]

Returns Geometry object from a Siesta.nc file

read_grid(name, index=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

  • index (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.

  • spin (optional) – same as index argument. spin argument has precedence.

read_hamiltonian(**kwargs)[source]

Returns a Hamiltonian from the underlying NetCDF file

read_lattice()[source]

Returns a Lattice object from a Siesta.nc file

read_lattice_nsc()[source]

Returns number of supercell connections

read_overlap(**kwargs)[source]

Returns a overlap matrix from the underlying NetCDF 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_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_geometry(geometry)[source]

Creates the NetCDF file and writes the geometry information

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.

write_overlap(S, **kwargs)[source]

Write the overlap matrix to the NetCDF file