spatial
torch_admp.spatial
Spatial operations for torch-admp.
This module provides spatial operations and utilities for molecular simulations, including periodic boundary condition handling, distance calculations, and coordinate transformations.
build_quasi_internal(r1: torch.Tensor, r2: torch.Tensor, dr: torch.Tensor, norm_dr: torch.Tensor) -> torch.Tensor
Build the quasi-internal frame between a pair of sites.
In this frame, the z-axis is pointing from r2 to r1.
| PARAMETER | DESCRIPTION |
|---|---|
r1
|
N * 3, positions of the first vector
TYPE:
|
r2
|
N * 3, positions of the second vector
TYPE:
|
dr
|
N * 3, vector pointing from r1 to r2
TYPE:
|
norm_dr
|
(N,), distances between r1 and r2
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
N * 3 * 3: local frames, three axes arranged in rows |
Source code in torch_admp/spatial.py
ds_pairs(positions: torch.Tensor, pairs: torch.Tensor, box: Optional[torch.Tensor] = None, pbc_flag: bool = True) -> torch.Tensor
Calculate distances between atom pairs.
| PARAMETER | DESCRIPTION |
|---|---|
positions
|
N * 3, positions of particles
TYPE:
|
pairs
|
M * 2, atom pair indices
TYPE:
|
box
|
3 * 3, box vectors arranged in rows, by default None
TYPE:
|
pbc_flag
|
Whether to apply periodic boundary conditions, by default True
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
M, distances between atom pairs |
Source code in torch_admp/spatial.py
pbc_shift(positions: torch.Tensor, box: torch.Tensor) -> torch.Tensor
wrap positions into the box
| PARAMETER | DESCRIPTION |
|---|---|
positions
|
N * 3, positions of the particles
TYPE:
|
box
|
3 * 3, box vectors arranged in rows
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
wrapped_positions
|
N * 3, wrapped positions
TYPE:
|