Skip to main content

get_nearest_neighbours

Function get_nearest_neighbours 

Source
pub fn get_nearest_neighbours(
    cb: &Tensor,
    mask: &Tensor,
    y: &Tensor,
    y_t: &Tensor,
    y_m: &Tensor,
    number_of_ligand_atoms: i64,
) -> Result<(Tensor, Tensor, Tensor, Tensor)>
Expand description

Per-residue ligand atom context: the number_of_ligand_atoms ligand atoms nearest each residue’s Cβ.

Port of data_utils.get_nearest_neighbours. Given L residues and M ligand atoms it returns (Y, Y_t, Y_m, D_closest) shaped (L, N, 3), (L, N), (L, N) and (L,), where N is number_of_ligand_atoms.

Masked-out pairs are pushed to a distance of 1000 so they sort last, and when a structure has fewer than N ligand atoms the remaining slots are zero-filled — including Y_m, so the padding contributes nothing.

§Arguments

  • cb — virtual Cβ per residue, (L, 3) or (1, L, 3).
  • mask — per-residue validity, (L,) or (1, L).
  • y — ligand atom coordinates, (M, 3).
  • y_t — ligand atomic numbers, (M,).
  • y_m — ligand atom validity, (M,).