Input/output and logging

The functions and modules described below provide functionality for controlling the verbosity of the output as well as for reading and writing force constant matrices in different formats.

hiphive.io.read_force_constants(filename, format=None)[source]

Reads force constants from file. Several different file formats are supported including phonopy, phono3py, and shengBTE.

Parameters:
  • filename (str) – name of input file
  • format (str) –

    format of input file

    possible values: phonopy, phonopy-text, phonopy-hdf5, phono3py, shengbte

    In the case of phonopy hiphive will attempt to infer the file format (hdf5 or text) from the file name.

Returns:

second (phonopy) or third-order (phono3py, shengBTE) force constant matrix

Return type:

numpy.ndarray

Raises:

ValueError – if file format cannot be recognized

hiphive.io.write_force_constants(filename, fc, format=None)[source]

Writes force constants to file.

Parameters:
  • filename (str) – name of output file
  • fc (ForceConstants or numpy.ndarray) – force constant matrix
  • format (str) –

    format of output file

    possible values: phonopy, phonopy-text, phonopy-hdf5, phono3py, shengbte

    In the case of phonopy hiphive will attempt to infer the file format (hdf5 or text) from the file name.

Raises:

ValueError – if file format cannot be recognized

hiphive.io.logging.set_config(filename=None, level=None, continuous=None)[source]

Alters the way logging is handled.

Parameters:
  • filename (str) – name of file the log should be sent to
  • level (int) – verbosity level; see Python logging library for details
  • continuous (bool) – if True the progress will be continously updated