Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d8b27ce
feat(pt-expt): add DPA4C-LR model with non-periodic LES/SOG long-rang…
YuzhiLiu-ai Sep 17, 2026
017d769
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 17, 2026
b30b119
fix(dpmodel): skip neighbor-count cap for symbolic shapes
YuzhiLiu-ai Sep 17, 2026
5a75539
fix(dpmodel): only cap neighbor count for mixed-types descriptors
YuzhiLiu-ai Sep 18, 2026
1430ce8
fix(dpmodel): restrict neighbor-count cap to sentinel capacities
YuzhiLiu-ai Sep 18, 2026
29713bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 22, 2026
1080806
test(pt-expt): pass empty LR edge placeholders to compiled graph lowe…
YuzhiLiu-ai Sep 22, 2026
063d2cc
fix(pt-expt): address DPA4C-LR review comments
YuzhiLiu-ai Oct 15, 2026
dca5758
perf(pt-expt): ragged-native unordered all-pairs graph for DPA4C-LR
YuzhiLiu-ai Oct 15, 2026
71b39b9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 15, 2026
69e8b79
style(pt-expt): explicit dtype in all-pairs graph builder arange calls
YuzhiLiu-ai Oct 15, 2026
013c057
ci: retrigger wheel builds after cibuildwheel download outage
YuzhiLiu-ai Oct 15, 2026
b3b3f92
Merge branch 'master' into merge_dpa4C
OutisLi Oct 18, 2026
4d5795c
refactor(pt_expt): make LES/SOG a long-range module of the atomic ene…
OutisLi Oct 18, 2026
043c253
feat(pt_expt): freeze models with a long-range module
OutisLi Oct 18, 2026
c60df4a
feat(pt_expt): compressed DPA4C inference with a long-range module
OutisLi Oct 18, 2026
c8ba94f
feat(api_cc): evaluate long-range models in C++ and LAMMPS
OutisLi Oct 18, 2026
16f40a2
fix(dpmodel): default the SOG amplitudes to a discretized 1/r
OutisLi Oct 19, 2026
91e6b15
feat(lmp): evaluate compressed long-range models on several MPI ranks
OutisLi Oct 19, 2026
c34d04f
fix(dpmodel): form the DPA4C angular moments by broadcasting
OutisLi Oct 19, 2026
b55b8a0
fix(pt_expt): address the review of the long-range module
OutisLi Oct 19, 2026
47c0df3
Merge remote-tracking branch 'upstream/master' into pr/6031-longrange
OutisLi Oct 19, 2026
f7ab0d8
feat(long-range): evaluate latent-charge modules on periodic cells in…
YuzhiLiu-ai Oct 20, 2026
f6c8396
update long range
YuzhiLiu-ai Oct 21, 2026
8fc95cd
feat(long-range): add fixed k-grid mode and decoupled cutoff option
YuzhiLiu-ai Oct 22, 2026
50c108c
feat(long-range): evaluate periodic systems on a static charge mesh (…
YuzhiLiu-ai Oct 23, 2026
17a102d
perf(long-range): eliminate GEMMs from the PME branch and halve the FFT
YuzhiLiu-ai Oct 23, 2026
15b4361
Merge branch 'dpa4c+period' of github.com:YuzhiLiu-ai/deepmd-kit-dens…
OutisLi Oct 23, 2026
faadbaa
Merge remote-tracking branch 'upstream/master' into pr/6031-longrange
OutisLi Oct 23, 2026
56e6732
feat(long-range): serve periodic systems in frozen models, C++ and LA…
OutisLi Oct 23, 2026
1cc7884
perf(long-range): float32 mesh pipeline and leaner host side of the o…
OutisLi Oct 23, 2026
c75fde9
perf(long-range): spread the kernel-parameter gradient of the mesh en…
OutisLi Oct 23, 2026
2b729e4
feat(long-range): per-frame blocked k grid, mesh evaluation by default
OutisLi Oct 24, 2026
ceefa8f
perf(long-range): first-order strain in the reciprocal-space energy
OutisLi Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 85 additions & 1 deletion deepmd/dpmodel/atomic_model/base_atomic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,67 @@ def fused_decomposition(self) -> "tuple[Any, Any] | None":
"""
return None

def has_long_range(self) -> bool:
"""Whether the atomic energy carries a long-range module beside a fitting.

Generic capability (concrete default ``False``): a model wrapping the
atomic model asks it whether the energy holds a long-range interaction,
e.g. before combining it with a scheme defined for a learned local
energy alone.
"""
return False

def required_topologies(self) -> tuple[str, ...]:
"""Names of the topologies the graph forward reads beside the neighbor graph.

Generic capability (concrete default: none) in the sense of
:meth:`uses_graph_lower`: a long-range module, whose interaction has no
cutoff, declares the topology it is evaluated on (see
:func:`~deepmd.dpmodel.utils.neighbor_graph.build_topologies`), and
every caller of the graph forward builds what is declared.
"""
return ()

def topology_params(self) -> dict[str, dict[str, Any]]:
"""The build parameters of the topologies of :meth:`required_topologies`.

Generic capability (concrete default: none) in the sense of
:meth:`required_topologies`: a module whose topology depends on its
own state, such as the wave-number cutoff of a periodic long-range
module, which follows its kernel, gives it here, by topology name.
"""
return {}

def build_topologies(
self,
coord: Any,
n_node: Any,
box: Any,
*,
atype: Any,
node_mask: Any = None,
pair_excl: Any = None,
) -> dict[str, Any]:
"""Build the topologies of :meth:`required_topologies` for one batch.

See :func:`~deepmd.dpmodel.utils.neighbor_graph.build_topologies`;
the build parameters are those of :meth:`topology_params`.
"""
from deepmd.dpmodel.utils.neighbor_graph import (
build_topologies,
)

return build_topologies(
self.required_topologies(),
coord,
n_node,
box,
node_mask,
atype=atype,
pair_excl=pair_excl,
topology_params=self.topology_params(),
)

def supports_native_spin(self) -> bool:
"""Returns whether this atomic model consumes a per-atom spin input.

Expand Down Expand Up @@ -494,6 +555,8 @@ def forward_common_atomic_graph(
charge_spin: Array | None = None,
spin: Array | None = None,
comm_dict: dict | None = None,
topologies: dict[str, Any] | None = None,
node_mask: Array | None = None,
) -> dict:
"""Graph analogue of :meth:`forward_common_atomic` on the flat node axis.

Expand Down Expand Up @@ -530,6 +593,13 @@ def forward_common_atomic_graph(
(and, from there, the descriptor's ``call_graph``). ``None`` for
non-parallel inference (default). Mirrors :meth:`forward_common_atomic`'s
``comm_dict`` on the dense route.
topologies
the topologies of :meth:`required_topologies` by name, built on the
node axis of ``graph``; ``None`` when none is required.
node_mask
flat mask of the nodes an enclosing model counts (real, owned and
not excluded there), combined with this model's own; ``None``
imposes nothing further. N

Returns
-------
Expand All @@ -538,6 +608,8 @@ def forward_common_atomic_graph(

"""
graph, atype_clamped, output_mask = self._prepare_graph_inputs(graph, atype)
if node_mask is not None:
output_mask = output_mask & node_mask
ret_dict = self.forward_atomic_graph(
graph,
atype_clamped,
Expand All @@ -546,6 +618,8 @@ def forward_common_atomic_graph(
charge_spin=charge_spin,
spin=spin,
comm_dict=comm_dict,
topologies=topologies,
node_mask=output_mask,
)
return self._finalize_atomic_ret(ret_dict, output_mask, atype)

Expand Down Expand Up @@ -1014,9 +1088,18 @@ def model_forward(
self.get_rcut(),
pair_excl=self.pair_excl,
)
atype_flat = xp.reshape(atype, (-1,))
topologies = self.build_topologies(
xp.reshape(coord, (-1, 3)),
graph.n_node,
box,
atype=atype_flat,
node_mask=atype_flat >= 0,
pair_excl=self.pair_excl,
)
atomic_ret = self.forward_common_atomic_graph(
graph,
xp.reshape(atype, (-1,)),
atype_flat,
fparam=fparam,
aparam=(
xp.reshape(
Expand All @@ -1028,6 +1111,7 @@ def model_forward(
),
charge_spin=charge_spin,
spin=None if spin is None else xp.reshape(spin, (-1, 3)),
topologies=topologies,
)
# The graph route works on a flat node axis; restore the
# per-frame layout the dense route returns.
Expand Down
Loading
Loading