iotools Package

iotools Package

class abipy.iotools.ETSF_Reader(path)[source]

Bases: pymatgen.io.abinit.netcdf.ETSF_Reader

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 AbiPy abipy.core.structure.Structure object

chemical_symbols[source]

Chemical symbols char [number of atom species][symbol length].

read_string(varname)[source]
Parameters

varname – Name of the variable

none_if_masked_array(arr)[source]

Return None if arr is a MaskedArray else None.

read_amu_symbol()[source]

Read atomic masses and return dictionary element_symbol –> amu.

Note

Only netcdf files with phonon-related quantities contain this variable.

read_ngfft3()[source]

Return the number of FFT divisions.

visualizer Module

Classes used to execute a visualizer within the Python interpreter.

class abipy.iotools.visualizer.Visualizer(filepath)[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.

binpath[source]

Absolute path of the binary. None if app is not found

property is_available

True is the visualizer is available on the local machine.

classmethod get_available(ext=None)[source]

List of visualizers available on the local host. If ext is not None, only the visualizers supporting this extension are returned.

classmethod support_ext(ext)[source]

True if visualizer supports the extension ext.

classmethod from_file(filepath)[source]

Initialize a subclass of Visualizer from filepath, the application is chosen automatically depending on the file extension.

Raise:

VisualizerError if no visualizer is available for the given file.

classmethod supported_extensions()[source]

List of file extensions supported by the visualizer.

classmethod from_name(appname)[source]

Return the visualizer class from the name of the application.

classmethod all_visunames()[source]

List with the names of the visualizers supported.

xsf Module

Tools for writing Xcrysden files.

abipy.iotools.xsf.xsf_write_structure(file, structures)[source]

Write the crystalline structure in the Xcrysden format (XSF)

Parameters
  • file – file-like object.

  • structuresStructure or list of Structure objects.

abipy.iotools.xsf.xsf_write_structure_and_data_to_path(filepath, structure, datar, **kwargs)[source]

Simplified interface to xsf routines to write structure and data to filepath.

abipy.iotools.xsf.xsf_write_data(file, structure, data, add_replicas=True, cplx_mode=None)[source]

Write data in the Xcrysden format (XSF)

Parameters
  • file – file-like object.

  • structureStructure object.

  • data – array-like object in C-order, i.e data[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, ndivs, ucdata_sbk, fermie, unit='eV')[source]

Write band structure data in the Xcrysden format (XSF)

Parameters
  • file – file-like object.

  • structureStructure object.

  • nsppol – Number of spins.

  • nband – Number of bands.

  • ndivs – Number of divisions of the full k-mesh.

  • ucdata_sbk – Array [nsppol, nband, ndivs[0], ndivs[1], mpdvis[2]] with energies in the unic cell mesh in unit unit.

  • fermie – Fermi energy.

  • of input ucdata_sbk and fermie. Energies will be converted to Hartree before writing. (unit=Unit) –

Note

  1. The k-points must span the reciprocal unit cell, not the Brillouin zone.

  2. The mesh must be closed and centered on Gamma.

  3. Energies are written in row-major (i.e. C) order.

# Energies are in Hartree.

See also http://www.xcrysden.org/doc/XSF.html