build_quadruplets¶
- torch_sim.neighbors.nbody.build_quadruplets(main_edge_index, internal_edge_index, n_atoms, main_cell_offsets, internal_cell_offsets)[source]¶
Build quadruplet interaction indices
d→b→a←cfrom two edge sets.For each internal (short-cutoff) bond
b→a, pairs every main-graph neighbourdofbwith every main-graph neighbourcofa, excludingc == din the same periodic image. The resulting four-atom chains have a short central bond flanked by longer outer bonds:d ——(main)——> b ===(internal)===> a <——(main)—— c
Pure-PyTorch equivalent of GemNet-OC
get_quadruplets.- Parameters:
main_edge_index (Tensor) –
[2, n_main]— long-range (outer) graph edges.internal_edge_index (Tensor) –
[2, n_internal]— short-range (central) graph edges.n_atoms (int) – Total number of atoms.
main_cell_offsets (Tensor) –
[n_main, 3]periodic cell offsets for main graph.internal_cell_offsets (Tensor) –
[n_internal, 3]periodic cell offsets for internal graph.
- Returns:
"d_to_b_edge"— main-edge indices ford→b, shape[n_trip_in]."b_to_a_edge"— internal-edge indices for the central bondb→a, shape[n_trip_in]."b_to_a_edge_agg"— local aggregation index within eachb→aedge, shape[n_trip_in]."c_to_a_edge"— main-edge indices forc→a, shape[n_trip_out]."c_to_a_edge_agg"— local aggregation index within eachc→aedge, shape[n_trip_out]."quad_c_to_a_edge"— main-edge index of thec→abond for each quadruplet, shape[n_quads]."quad_d_to_b_trip_idx"— index intod_to_b_edge/b_to_a_edgefor each quadruplet, shape[n_quads]."quad_c_to_a_trip_idx"— index intoc_to_a_edgefor each quadruplet, shape[n_quads]."quad_c_to_a_agg"— local aggregation index within eachc→amain edge across quadruplets, shape[n_quads].
- Return type:
Dict with keys describing the quadruplet
d→b→a←c