formats

A module containing different formats related to the io subpackage.

Summary

Classes:

BoxFileFormat

An enumeration of the supported box file formats.

FileWritingMode

An enumeration of the supported file write modes.

OutputFileFormat

An enumeration of the supported output file formats.

Reference

class BoxFileFormat(
value,
names=<not given>,
*values,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)[source]

Bases: BaseEnumFormat

An enumeration of the supported box file formats.

DATA = 'data'
VMD = 'vmd'
class FileWritingMode(
value,
names=<not given>,
*values,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)[source]

Bases: BaseEnumFormat

An enumeration of the supported file write modes.

APPEND = 'a'

The write mode for appending to a file.

OVERWRITE = 'o'

The write mode for overwriting a file.

WRITE = 'w'

The write mode for writing to a file

class OutputFileFormat(
value,
names=<not given>,
*values,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)[source]

Bases: BaseEnumFormat

An enumeration of the supported output file formats.

__eq__(other: object) bool[source]

This method checks if the enumeration is equal to the other object.

Parameters:

other (object) – The object to compare with.

Returns:

True if the enumeration is equal to the other object, False otherwise.

Return type:

bool

classmethod file_extensions()[source]

Get the file extensions of the different file formats.

Returns:

The file extensions of the different file formats.

Return type:

dict[str, list[str]]

classmethod find_matching_files(
file_path: list[str],
output_file_format: OutputFileFormat | str,
extension: str | None = None,
) list[str][source]

Find the files that match the given file format.

Parameters:
  • file_path (List[str]) – The file paths to search for the files.

  • output_file_format (OutputFileFormat | str) – The file format to search for.

  • extension (str | None, optional) – The extension to search for, by default None. If None, all files with the given file format are returned. Else, only the files with the given extension are returned.

Returns:

The files that match the given file format.

Return type:

List[str]

classmethod get_file_extensions(
file_format: OutputFileFormat | str,
) list[str][source]

Get the file extensions of the given file format.

Parameters:

file_format (OutputFileFormat) – The file format to get the file extensions for.

Returns:

The file extensions of the given file format.

Return type:

list[str]

classmethod infer_format_from_extension(
file_path: str,
) OutputFileFormat[source]

Infer the file format from the file extension.

Parameters:

file_path (str) – The file path to infer the file format from.

Returns:

The inferred file format.

Return type:

OutputFileFormat

lower() str[source]

This method returns the lower case representation of the enumeration.

Returns:

The lower case representation of the enumeration.

Return type:

str

AUTO = 'auto'

inference of the file format from the file extension

CHARGE = 'charge'

The charge file format.

ENERGY = 'energy'

The ENERGY file format.

FORCE = 'force'

The force file format.

INFO = 'info'

The Info file format.

INSTANTANEOUS_ENERGY = 'instant_en'

The INSTANTANEOUS ENERGY file format.

RESTART = 'restart'

The restart file format.

STRESS = 'stress'

The STRESS file format.

VEL = 'vel'

The vel file format.

VIRIAL = 'virial'

The VIRIAL file format.

XYZ = 'xyz'

The xyz file format.