iotools Package
iotools
Package
- class abipy.iotools.ETSF_Reader(path)[source]
Bases:
EtsfReader
Provides high-level API to read data from netcdf files written following the ETSF-IO specifications described in [Caliste2008]
- read_structure()[source]
Overrides the
read_structure
method so that we always return an instance of AbiPyabipy.core.structure.Structure
object
- typeidx_from_symbol(symbol: str) int [source]
Returns the type index from the chemical symbol. Note python convention.
visualizer
Module
Classes used to execute a visualizer within the Python interpreter.
- class abipy.iotools.visualizer.Visualizer(filepath: str)[source]
Bases:
object
Handle the visualization of data.
- is_macosx_app = False
- Error
alias of
VisualizerError
- property cmdarg
Arguments that must be used to visualize the file.
- classmethod get_available(ext=None) list [source]
List of visualizers available on the local host. If ext is not None, only the visualizers supporting this extension are returned.
- classmethod from_file(filepath: str)[source]
Initialize a subclass of
Visualizer
from filepath, the application is chosen automatically depending on the file extension.- Raises:
VisualizerError –
- classmethod supported_extensions() list [source]
List of file extensions supported by the visualizer.
xsf
Module
Tools for writing Xcrysden files.
- abipy.iotools.xsf.xsf_write_structure_and_data_to_path(filepath, structure, datar, **kwargs) None [source]
Simplified interface to write structure and data to filepath in XSF format.
- abipy.iotools.xsf.xsf_write_structure(file, structures: list) None [source]
Write the crystalline structure in the Xcrysden format (XSF)
- Parameters:
file – file-like object.
structures –
Structure
or list ofStructure
objects.
- abipy.iotools.xsf.xsf_write_data(file, structure, data, add_replicas=True, cplx_mode=None, idname='data', tag='_UNKNOWN') None [source]
Write data in the Xcrysden format (XSF)
- Parameters:
file – file-like object.
structure –
Structure
object.data – array-like object in C-order, i.e data[nx, ny, nz] or data[ngrids, nx, ny, nz]
add_replicas – If True, data is padded with redundant data points. in order to have a periodic 3D array of shape: (nx+1, ny+1, nz+1).
cplx_mode –
string defining the data to print when data is a complex array. Possible choices are (case-insensitive):
”re” for real part.
”im” for imaginary part.
”abs” for the absolute value
- abipy.iotools.xsf.bxsf_write(file, structure, nsppol, nband, ngkpt, ucdata_sbk, fermie, unit='eV') None [source]
Write band structure data in the Xcrysden format (XSF)
- Parameters:
file – file-like object.
structure –
Structure
object.nsppol – Number of spins.
nband – Number of bands.
ngkpt – Number of divisions of the full k-mesh.
ucdata_sbk – Array [nsppol, nband, ngkpt[0], ngkpt[1], ngkpt[2]] with energies in the unit cell mesh in unit unit.
fermie – Fermi energy.
writing. (unit=Unit of input ucdata_sbk and fermie. Energies will be converted to Hartree before)
Note
The k-points must span the reciprocal unit cell, not the Brillouin zone.
The mesh must be closed and centered on Gamma.
Energies are written in row-major (i.e. C) order.
# Energies are in Hartree.
See also http://www.xcrysden.org/doc/XSF.html