torch_sim.transformsΒΆ

Coordinate transformations and periodic boundary conditions.

This module provides functions for handling coordinate transformations and periodic boundary conditions in molecular simulations, including matrix inversions and general PBC wrapping.

Functions

build_linked_cell_neighborhood

Build the neighbor list of a given set of atomic structures using the linked cell algorithm.

build_naive_neighborhood

Build a naive neighborhood list for atoms based on positions

compute_cell_shifts

Compute the cell shifts based on the provided indices and cell matrix.

compute_distances_with_cell_shifts

Compute distances between pairs of positions, optionally

get_cell_shift_idx

Generate the indices for cell shifts based on the number of repeats.

get_fractional_coordinates

Convert Cartesian coordinates to fractional coordinates.

get_fully_connected_mapping

Generate a fully connected mapping of atom indices with optional cell shifts.

get_linear_bin_idx

Calculate the linear bin index for each position within a defined box.

get_number_of_cell_repeats

Determine the number of cell repeats required for a given

get_pair_displacements

Compute displacement vectors and distances between atom pairs.

high_precision_sum

Sums tensor elements over specified dimensions at 64-bit precision.

inverse_box

Compute the inverse of an affine transformation.

linked_cell

Determine the atomic neighborhood of the atoms of a given structure for a particular cutoff using the linked cell algorithm.

minimum_image_displacement

Apply minimum image convention to displacement vectors.

multiplicative_isotropic_cutoff

Creates a smoothly truncated version of an isotropic function.

pbc_wrap_batched

Apply periodic boundary conditions to batched systems.

pbc_wrap_general

Apply periodic boundary conditions using lattice

ravel_3d

Convert 3D indices into linear indices for an array of given shape.

safe_mask

Safely applies a function to masked values in a tensor.

scatter_bin_index

Convert a linear table of bin indices into a structured bin ID table.

strides_of

Calculate the cumulative strides of a flattened tensor.

translate_pretty

ASE pretty translation in pytorch.

unravel_3d

Convert linear indices back into 3D indices for an array of given shape.

wrap_positions

ASE wrap_positions in pytorch.