I/O Read: CHRG/UHF#

Reader for the .CHRG and .UHF files.

tad_mctc.io.read.dotfiles.read_chrg(filepath, mode='r', encoding='utf-8', device=None, dtype=None)#

Read a .CHRG file.

Parameters:
  • file (PathLike) – Path of file containing the structure.

  • mode (str, optional) – Mode in which the file is opened. Defaults to "r".

  • encoding (str, optional) – Encoding for file. Defaults to "utf-8".

  • device (torch.device | None, optional) – Device to store the tensor on. Defaults to None.

  • dtype (torch.dtype | None, optional) – Floating point data type of the tensor. Defaults to None.

Returns:

Value stored in the file as tensor.

Return type:

Tensor

Raises:
  • EmptyFileError – File is empty (at least the first line).

  • FormatError – File does not conform with the expected format.

tad_mctc.io.read.dotfiles.read_spin(filepath, mode='r', encoding='utf-8', device=None, dtype=None)#

Read a .UHF file.

Parameters:
  • file (PathLike) – Path of file containing the structure.

  • mode (str, optional) – Mode in which the file is opened. Defaults to "r".

  • encoding (str, optional) – Encoding for file. Defaults to "utf-8".

  • device (torch.device | None, optional) – Device to store the tensor on. Defaults to None.

  • dtype (torch.dtype | None, optional) – Floating point data type of the tensor. Defaults to None.

Returns:

Value stored in the file as tensor.

Return type:

Tensor

Raises:
  • EmptyFileError – File is empty (at least the first line).

  • FormatError – File does not conform with the expected format.

tad_mctc.io.read.dotfiles.read_uhf(filepath, mode='r', encoding='utf-8', device=None, dtype=None)#

Read a .UHF file.

Parameters:
  • file (PathLike) – Path of file containing the structure.

  • mode (str, optional) – Mode in which the file is opened. Defaults to "r".

  • encoding (str, optional) – Encoding for file. Defaults to "utf-8".

  • device (torch.device | None, optional) – Device to store the tensor on. Defaults to None.

  • dtype (torch.dtype | None, optional) – Floating point data type of the tensor. Defaults to None.

Returns:

Value stored in the file as tensor.

Return type:

Tensor

Raises:
  • EmptyFileError – File is empty (at least the first line).

  • FormatError – File does not conform with the expected format.