sisl.io.siesta.outSileSiesta

class sisl.io.siesta.outSileSiesta(filename, mode='r', comment=None, *args, **kwargs)

Bases: sisl.io.siesta.SileSiesta

Output file from Siesta

This enables reading the output quantities from the Siesta output.

Methods

completed()

True if the full file has been read and “Job completed” was found.

dir_file([filename, filename_base])

File of the current Sile

exist()

Query whether the file exists

read(*args, **kwargs)

Generic read method which should be overloaded in child-classes

read_basis_block()

Reads the PAO.Basis block that Siesta writes

read_data(*args, **kwargs)

Read specific content in the Siesta out file

read_energy()

Reads the final energy distribution

read_force([last, all, total, max])

Reads the forces from the Siesta output file

read_geometry([last, all])

Reads the geometry from the Siesta output file

read_moment([orbitals, quantity, last, all])

Reads the moments from the Siesta output file

read_scf([key, iscf, imd, as_dataframe])

Parse SCF information and return a table of SCF information depending on what is requested

read_species()

Reads the species from the top of the output file.

read_stress([key, last, all])

Reads the stresses from the Siesta output file

write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

base_file

File of the current Sile

file

File of the current Sile

__init__(filename, mode='r', comment=None, *args, **kwargs)
property base_file

File of the current Sile

completed()[source]

True if the full file has been read and “Job completed” was found.

dir_file(filename=None, filename_base='')

File of the current Sile

exist()

Query whether the file exists

property file

File of the current Sile

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

Reads the PAO.Basis block that Siesta writes

read_data(*args, **kwargs)[source]

Read specific content in the Siesta out file

The currently implemented things are denoted in the parameters list. Note that the returned quantities are in the order of keywords, so:

>>> read_data(geometry=True, force=True)
<geometry>, <force>
>>> read_data(force=True, geometry=True)
<force>, <geometry>
Parameters
  • geometry (bool, optional) – read geometry, args are passed to read_geometry

  • force (bool, optional) – read force, args are passed to read_force

  • stress (bool, optional) – read stress, args are passed to read_stress

  • moment (bool, optional) – read moment, args are passed to read_moment (only for spin-orbit calculations)

  • energy (bool, optional) – read final energies, args are passed to read_energy

read_energy()[source]

Reads the final energy distribution

Currently the energies translated are:

band

band structure energy

kinetic

electronic kinetic energy

hartree

electronic electrostatic Hartree energy

dftu

DFT+U energy

spin_orbit

spin-orbit energy

extE

external field energy

xc

exchange-correlation energy

bulkV

bulk-bias correction energy

total

total energy

negf

NEGF energy

fermi

Fermi energy

ion.electron

ion-electron interaction energy

ion.ion

ion-ion interaction energy

ion.kinetic

kinetic ion energy

Any unrecognized key gets added as is.

Examples

>>> energies = sisl.get_sile("RUN.out").read_energy()
>>> ion_energies = energies.ion
>>> ion_energies.ion # ion-ion interaction energy
>>> ion_energies.kinetic # ion kinetic energy
>>> energies.fermi # fermi energy
Returns

PropertyDict

Return type

dictionary like lookup table ionic energies are stored in a nested PropertyDict at the key ion (all energies in eV)

read_force(last=True, all=False, total=False, max=False)[source]

Reads the forces from the Siesta output file

Parameters
  • last (bool, optional) – only read the last force

  • all (bool, optional) – return a list of all forces (like an MD) If True last is ignored

  • total (bool, optional) – return the total forces instead of the atomic forces.

  • max (bool, optional) –

    whether only the maximum atomic force should be returned for each step.

    Setting it to True is equivalent to max(outSile.read_force()) in case atomic forces are written in the output file (WriteForces .true. in the fdf file)

    Note that this is not the same as doing max(outSile.read_force(total=True)) since the forces returned in that case are averages on each axis.

Returns

returns None if the forces are not found in the output, otherwise forces will be returned

The shape of the array will be different depending on the type of forces requested:
  • atomic (default): (nMDsteps, nAtoms, 3)

  • total: (nMDsteps, 3)

  • max: (nMDsteps, )

If all is False, the first dimension does not exist. In the case of max, the returned value will therefore be just a float, not an array.

If total and max are both True, they are returned separately as a tuple: (total, max)

Return type

numpy.ndarray or None

read_geometry(last=True, all=False)[source]

Reads the geometry from the Siesta output file

Parameters
  • last (bool, optional) – only read the last geometry

  • all (bool, optional) – return a list of all geometries (like an MD) If True last is ignored

Returns

geometries – if all is False only one geometry will be returned (or None). Otherwise a list of geometries corresponding to the MD-runs.

Return type

list or Geometry or None

read_moment(orbitals=False, quantity='S', last=True, all=False)[source]

Reads the moments from the Siesta output file

These will only be present in case of spin-orbit coupling.

Parameters
  • orbitals (bool, optional) – return a table with orbitally resolved moments.

  • quantity ({'S', 'L'}, optional) – return the spin-moments or the L moments

  • last (bool, optional) – only read the last force

  • all (bool, optional) – return a list of all forces (like an MD) If True last is ignored

read_scf(key='scf', iscf=- 1, imd=None, as_dataframe=False)[source]

Parse SCF information and return a table of SCF information depending on what is requested

Parameters
  • key ({'scf', 'ts-scf'}) – parse SCF information from Siesta SCF or TranSiesta SCF

  • iscf (int, optional) – which SCF cycle should be stored. If -1 only the final SCF step is stored, for None all SCF cycles are returned. When iscf values queried are not found they will be truncated to the nearest SCF step.

  • imd (int or None, optional) – whether only a particular MD step is queried, if None, all MD steps are parsed and returned. A negative number wraps for the last MD steps.

  • as_dataframe (boolean, optional) – whether the information should be returned as a pandas.DataFrame. The advantage of this format is that everything is indexed and therefore you know what each value means.You can also perform operations very easily on a dataframe.

read_species()[source]

Reads the species from the top of the output file.

If wanting the species this HAS to be the first routine called.

It returns an array of Atom objects which may easily be indexed.

read_stress(key='static', last=True, all=False)[source]

Reads the stresses from the Siesta output file

Parameters
  • key ({'static', 'total'}) – which stress to read from the output.

  • last (bool, optional) – only read the last stress

  • all (bool, optional) – return a list of all stresses (like an MD) If True last is ignored

Returns

returns None if the stresses are not found in the output, otherwise stresses will be returned

Return type

numpy.ndarray or None

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.