build_triplets¶
- torch_sim.neighbors.nbody.build_triplets(edge_index, n_atoms)[source]¶
Build triplet interaction indices from an edge list.
For every pair of edges
(b→a)and(c→a)that share the same target atomawithedge_ba ≠ edge_ca, produces a tripletb→a←c.Uses only ops that are JIT/AOTInductor safe:
argsort,bincount,repeat_interleave, and boolean indexing.- Parameters:
- Returns:
"trip_in"— edge indices of the incoming edgeb→a, shape[n_triplets]."trip_out"— edge indices of the outgoing edgec→a, shape[n_triplets]."trip_out_agg"— per-segment local index for aggregation, shape[n_triplets]."center_atom"— atom indexafor each triplet, shape[n_triplets].
- Return type:
Dict with keys