sisl.io.axsfSile

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

Bases: sisl.io.xsfSile

AXSF file for XCrySDen

When creating an AXSF file one must denote how many geometries to write out. It is also necessary to use the axsf in a context manager, otherwise it will overwrite itself repeatedly.

>>> with axsfSile('file.axsf', 'w', steps=100) as axsf:
...     for i in range(100):
...         axsf.write_geometry(geom)

Methods

dir_file([filename, filename_base])

File of the current Sile

read(*args, **kwargs)

Generic read method which should be overloaded in child-classes

read_geometry([index, ret_data])

Geometries and (possibly) associated data stored in the AXSF file

write(*args, **kwargs)

Generic write method which should be overloaded in child-classes

write_geometry(geometry[, fmt, data])

Writes the geometry to the contained file

write_supercell(sc[, fmt])

Writes the supercell to the contained file

base_file

File of the current Sile

file

File of the current Sile

write_grid

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

File of the current Sile

dir_file(filename=None, filename_base='')

File of the current Sile

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_geometry(index=- 1, ret_data=False)[source]

Geometries and (possibly) associated data stored in the AXSF file

Parameters
  • index (int or iterable of int or None, optional) – The indices to load (0-indexed). If None, load all. If an integer is passed, a single Geometry is returned, and the leading dimension on data is removed.

  • ret_data (bool, optional) – in case the file has auxiliary data, return that as well.

Returns

  • geometries (list of Geometry or Geometry) – A list of geometries (or a single Geometries) corresponding to requested indices.

  • data (ndarray of shape (nindex, natoms, nperatom) and dtype float64) – Only returned if data is True.

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_geometry(geometry, fmt='.8f', data=None)[source]

Writes the geometry to the contained file

Parameters
  • geometry (Geometry) – the geometry to be written

  • fmt (str, optional) – used format for the precision of the data

  • data ((geometry.na, 3), optional) – auxiliary data associated with the geometry to be saved along side. Internally in XCrySDen this data is named Forces

write_grid = None
write_supercell(sc, fmt='.8f')

Writes the supercell to the contained file

Parameters
  • sc (SuperCell) – the supercell to be written

  • fmt (str, optional) – used format for the precision of the data