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.

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

_job_completed

_write_default

_write_default_only

base_file

File of the current Sile

file

File of the current Sile

job_completed

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

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, comment])

Initialize self.

__init_subclass__

This method is called when a class is subclassed.

__iter__()

Iterator for file

__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

_open()

_read_geometry_atomic(line[, species])

Wrapper for reading the geometry as in the outcoor output

_read_geometry_outcoor(line[, species])

Wrapper for reading the geometry as in the outcoor output

_read_supercell_outcell()

Wrapper for reading the unit-cell from the outcoor block

_setup(*args, **kwargs)

Setup the Sile after initialization

_write(*args, **kwargs)

Wrapper to default the write statements

dir_file([filename])

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_data(*args, **kwargs)

Read specific content in the Siesta out file

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 These will only be present in case of spin-orbit coupling.

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

property base_file

File of the current Sile

dir_file(filename=None)

File of the current Sile

exist()

Query whether the file exists

property file

File of the current Sile

property job_completed

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

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

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, False) – return a table with orbitally resolved moments.

  • quantity (str, 'S') – return the spin-moments or the L moments

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

  • all (bool, False) – 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.