I/O Read: General#
General reader for file from a path.
- tad_mctc.io.read.reader.read(filepath, ftype=None, mode='r', device=None, dtype=None, dtype_int=torch.int64, **kwargs)[source]#
Helper to read the structure from the given file path.
- Parameters:
file (PathLike) – Path of file containing the structure.
ftype (str | None, optional) – File type. Defaults to None, i.e., infered from the extension.
mode (str, optional) – Mode in which the file is opened. Defaults to “r”.
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.dtype_int (torch.dtype, optional) – Integer data type of the tensor. Defaults to torch.long.
- Returns:
(Possibly batched) tensors of atomic numbers and positions. Positions is a tensor of shape (batch_size, nat, 3) in atomic units.
- Return type:
(Tensor, Tensor)
- Raises:
FileNotFoundError – Given file does not exist.