tfep.utils.misc

Miscellanea utility functions.

Functions

atom_to_flattened(positions)

Compute a positions from standard atom to flattened format.

atom_to_flattened_indices(atom_indices[, ...])

Convert atom indices to the indices of the corresponding degrees of freedom in flattened format.

energies_array_to_tensor(energies[, ...])

Helper function to convert the a batch of energies from numpy array to PyTorch tensor.

ensure_tensor_sequence(x[, dtype])

If x is a sequence, return it as a torch.Tensor without copying the memory (if possible).

flattened_to_atom(positions[, space_dimension])

Compute a positions from flattened to standard atom format.

forces_array_to_tensor(forces[, ...])

Helper function to convert the a batch of forces from numpy array to PyTorch tensor.

remove_and_shift_sorted_indices(indices, ...)

Remove from indices the indices in removed_indices (by value).

temporary_cd(dir_path)

Context manager that temporarily sets the working directory.