Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
19 changes: 19 additions & 0 deletions deepmd/dpmodel/descriptor/dpa3.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ class RepFlowArgs:
smooth_edge_update : bool, optional
Whether to make edge update smooth.
If True, the edge update from angle message will not use self as padding.
use_dynamic_sel : bool, optional
Whether to dynamically select neighbors within the cutoff radius.
If True, the exact number of neighbors within the cutoff radius is used
without padding to a fixed selection numbers.
When enabled, users can safely set larger values for `e_sel` or `a_sel` (e.g., 1200 or 300, respectively)
to guarantee capturing all neighbors within the cutoff radius.
sel_reduce_factor : float, optional
Reduction factor applied to neighbor-scale normalization when `use_dynamic_sel` is True.
In the dynamic selection case, neighbor-scale normalization will use `e_sel / sel_reduce_factor`
or `a_sel / sel_reduce_factor` instead of the raw `e_sel` or `a_sel` values,
accommodating larger selection numbers.
"""

def __init__(
Expand Down Expand Up @@ -150,6 +161,8 @@ def __init__(
skip_stat: bool = False,
optim_update: bool = True,
smooth_edge_update: bool = False,
use_dynamic_sel: bool = False,
sel_reduce_factor: float = 10.0,
) -> None:
self.n_dim = n_dim
self.e_dim = e_dim
Expand All @@ -176,6 +189,8 @@ def __init__(
self.a_compress_use_split = a_compress_use_split
self.optim_update = optim_update
self.smooth_edge_update = smooth_edge_update
self.use_dynamic_sel = use_dynamic_sel
self.sel_reduce_factor = sel_reduce_factor

def __getitem__(self, key):
if hasattr(self, key):
Expand Down Expand Up @@ -207,6 +222,8 @@ def serialize(self) -> dict:
"fix_stat_std": self.fix_stat_std,
"optim_update": self.optim_update,
"smooth_edge_update": self.smooth_edge_update,
"use_dynamic_sel": self.use_dynamic_sel,
"sel_reduce_factor": self.sel_reduce_factor,
}

@classmethod
Expand Down Expand Up @@ -303,6 +320,8 @@ def init_subclass_params(sub_data, sub_class):
fix_stat_std=self.repflow_args.fix_stat_std,
optim_update=self.repflow_args.optim_update,
smooth_edge_update=self.repflow_args.smooth_edge_update,
use_dynamic_sel=self.repflow_args.use_dynamic_sel,
sel_reduce_factor=self.repflow_args.sel_reduce_factor,
exclude_types=exclude_types,
env_protection=env_protection,
precision=precision,
Expand Down
Loading