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.
Phonopy and phono3py IO#
This module provides functions for reading and writing data files in phonopy and phono3py formats.
- hiphive.input_output.phonopy.read_phonopy_fc2(filename, format=None)[source]#
Parses a second-order force constant file in phonopy format.
- Parameters:
filename (
str
) – Input file name.format (
str
) – Specify the file-format, ifNone
tries to guess the format from filename; possible values:'text'
,'hdf5'
.
- Returns:
Second-order force constant matrix (
N,N,3,3
array) whereN
is the number of atoms.- Return type:
- hiphive.input_output.phonopy.read_phonopy_fc3(filename)[source]#
Parses a third order force constant file in phonopy hdf5 format.
- Parameters:
filename (
str
) – Input file name.- Return type:
- Returns:
Third-order force constant matrix.
- hiphive.input_output.phonopy.write_phonopy_fc2(filename, fc2, format=None)[source]#
Writes second-order force constant matrix in phonopy format.
- Parameters:
filename (
str
) – Output file name.fc2 – Second-order force constant matrix as
ForceConstants
object or asnp.ndarray
.format (
str
) – Specify the file-format, ifNone
try to guess the format from filename; possible values:'text'
,'hdf5'
.
- Return type:
None
ShengBTE IO#
The io.shengBTE
module provides functions for reading and writing data
files in shengBTE format.
- hiphive.input_output.shengBTE.read_shengBTE_fc3(filename, prim, supercell, symprec=1e-05)[source]#
Reads third-order force constants file in shengBTE format.
- Parameters:
- Returns:
Third-order force constants for the specified supercell as
ForceConstants
object.
- hiphive.input_output.shengBTE.write_shengBTE_fc3(filename, fcs, prim, symprec=1e-05, cutoff=inf, fc_tol=1e-08)[source]#
Writes third-order force constants to file in shengBTE format.
- Parameters:
filename (
str
) – Output file name.fcs – Force constants in
ForceConstants
format; the supercell associated with this object must be based onprim
.prim (
Atoms
) – Primitive structure (must be equivalent to structure used in the shengBTE calculation).symprec (
float
) – Structural symmetry tolerance.cutoff (
float
) – All atoms in cluster must be within this cutoff.fc_tol (
float
) – If the absolute value of the largest entry in a force constant is less thanfc_tol
it will not be included in the output.
GPUMD IO#
- hiphive.input_output.gpumd.write_fcp_txt(fname, path, n_types, max_order, heat_current_order=2)[source]#
Write driver potential file for GPUMD.
- Parameters:
fname (
str
) – Output file name.path (
str
) – Path to directory with force constant file.n_types (
int
) – Number of atom types.max_order (
int
) – Maximum order of the force constant potential.heat_current_order (
int
) – Heat current order used in thermal conductivity.
- Return type:
None
Format is a simple file containing the following:
fcp number_of_atom_types highest_force_order heat_current_order path_to_force_constant_files
which in practice for a binary system with a sixth order model, consider third-order heat-currents, would mean:
fcp 2 6 3 /path/to/your/folder
- hiphive.input_output.gpumd.write_fcs_gpumd(fname_fc, fname_clusters, fcs, order, tol=1e-10)[source]#
Writes force constants of given order in GPUMD format.
- Parameters:
fname_fc (
str
) – Name of file which contains the lookup force constants.fname_clusters (
str
) – Name of file which contains the clusters and the force constant lookup index.fcs – Force constants in
ForceConstants
format.order (
int
) – Force constants for this order will be written to file.tol (
float
) – If the norm of a force constant term is less than this value it will be excluded from the output; if two force-constants differ by this value or less, they are considered equal.
- Return type:
None
Logging#
- hiphive.input_output.logging_tools.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
Progress bar#
- class hiphive.input_output.logging_tools.Progress(tot=None, mode='frac', estimate_remaining=True)[source]
Progress bar like functionality.