deepmd.dpmodel.utils.neighbor_graph.ase_builder#
Carry-all NeighborGraph builder backed by ASE’s O(N) cell list (optional dep).
build_neighbor_graph_ase is a carry-all search backend: it uses ASE’s neighbor_list("ijS", ...) to enumerate EVERY neighbor within rcut (no sel cutoff), then routes the resulting sparse (i, j, S) edge list through neighbor_graph_from_ijs() so edge_vec is recomputed differentiably from coord/box – ASE’s own distance vectors are intentionally NOT used, to keep the geometry convention and autograd leaf consistent with every other builder. ASE is an OPTIONAL dependency, imported lazily inside the function.
Functions#
Build a CARRY-ALL NeighborGraph using ASE's O(N) cell-list search. |
Module Contents#
- deepmd.dpmodel.utils.neighbor_graph.ase_builder.build_neighbor_graph_ase(coord: deepmd.dpmodel.array_api.Array, atype: deepmd.dpmodel.array_api.Array, box: deepmd.dpmodel.array_api.Array | None, rcut: float, layout: deepmd.dpmodel.utils.neighbor_graph.graph.GraphLayout | None = None) deepmd.dpmodel.utils.neighbor_graph.graph.NeighborGraph[source]#
Build a CARRY-ALL NeighborGraph using ASE’s O(N) cell-list search.
Per frame, ASE
neighbor_list("ijS", atoms, rcut)returns centeri, neighborjand periodic shiftSsuch that the neighbor image sits atpositions[j] + S @ cell. These map directly to the graph convention (src=neighbor=j, dst=center=i), and the edge list is fed toneighbor_graph_from_ijs()which recomputesedge_vecfromcoord/box(ASE’s distance vectors are discarded for convention + differentiability consistency).- Parameters:
- coord
(nf, nloc, 3) local coordinates.
- atype
(nf, nloc) local atom types (unused for the search; carried for API parity).
- box
(nf, 3, 3) simulation cell, or
Nonefor non-periodic.- rcut
cutoff radius.
- layout
edge-axis length policy;
None=> dynamic (torch) withmin_edgesguards.
- Returns:
graphThe carry-all
NeighborGraphover the LOCAL atoms (n_node = nlocper frame), withedge_vecrecomputed differentiably fromcoord/box.
- Raises:
ImportErrorif the optional
asepackage is not installed.