Serialization¶
- metatomic.torch.save(file: str | Path | BinaryIO, system: System) None[source]¶
Save a System object to a file.
The provided System must contain float64 data and be on the CPU device.
The saved file will be a zip archive containing the following files:
types.npy, containing the atomic types in numpy’s NPY format;positions.npy, containing the systems’ positions in numpy’s NPY format;cell.npy, containing the systems’ cell in numpy’s NPY format;pbc.npy, containing the periodic boundary conditions in numpy’s NPY format;
For each neighbor list in the System object, the following files will be saved (where
{nl_idx}is the index of the neighbor list):pairs/{nl_idx}/options.json: theNeighborListOptionsobject converted to a JSON string.pairs/{nl_idx}/data.mts: the neighbor listTensorBlockobject
For each extra data in the System object, the following file will be saved (where
{name}is the name of the extra data):data/{name}.mts: The extra dataTensorMap
- metatomic.torch.load_system(file: str | Path | BinaryIO) System[source]¶
Load a System object from a file.
The loaded System object will be on the CPU device and contain float64 data.
- metatomic.torch.save_buffer(system: System) Tensor[source]¶
Save the given
systemto an in-memory buffer, represented as a 1-dimensionaltorch.Tensorwithuint8dtype.