@@ -126,6 +126,18 @@ class RepFlowArgs:
126126 edge_init_use_dist : bool, optional
127127 Whether to use direct distance r to initialize the edge features instead of 1/r.
128128 Note that when using this option, the activation function will not be used when initializing edge features.
129+ use_dynamic_sel : bool, optional
130+ Whether to dynamically select neighbors within the cutoff radius.
131+ If True, the exact number of neighbors within the cutoff radius is used
132+ without padding to a fixed selection numbers.
133+ When enabled, users can safely set larger values for `e_sel` or `a_sel` (e.g., 1200 or 300, respectively)
134+ to guarantee capturing all neighbors within the cutoff radius.
135+ Note that when using dynamic selection, the `smooth_edge_update` must be True.
136+ sel_reduce_factor : float, optional
137+ Reduction factor applied to neighbor-scale normalization when `use_dynamic_sel` is True.
138+ In the dynamic selection case, neighbor-scale normalization will use `e_sel / sel_reduce_factor`
139+ or `a_sel / sel_reduce_factor` instead of the raw `e_sel` or `a_sel` values,
140+ accommodating larger selection numbers.
129141 """
130142
131143 def __init__ (
@@ -154,6 +166,8 @@ def __init__(
154166 optim_update : bool = True ,
155167 smooth_edge_update : bool = False ,
156168 edge_init_use_dist : bool = False ,
169+ use_dynamic_sel : bool = False ,
170+ sel_reduce_factor : float = 10.0 ,
157171 ) -> None :
158172 self .n_dim = n_dim
159173 self .e_dim = e_dim
@@ -181,6 +195,8 @@ def __init__(
181195 self .optim_update = optim_update
182196 self .smooth_edge_update = smooth_edge_update
183197 self .edge_init_use_dist = edge_init_use_dist
198+ self .use_dynamic_sel = use_dynamic_sel
199+ self .sel_reduce_factor = sel_reduce_factor
184200
185201 def __getitem__ (self , key ):
186202 if hasattr (self , key ):
@@ -213,6 +229,8 @@ def serialize(self) -> dict:
213229 "optim_update" : self .optim_update ,
214230 "smooth_edge_update" : self .smooth_edge_update ,
215231 "edge_init_use_dist" : self .edge_init_use_dist ,
232+ "use_dynamic_sel" : self .use_dynamic_sel ,
233+ "sel_reduce_factor" : self .sel_reduce_factor ,
216234 }
217235
218236 @classmethod
@@ -310,6 +328,8 @@ def init_subclass_params(sub_data, sub_class):
310328 optim_update = self .repflow_args .optim_update ,
311329 smooth_edge_update = self .repflow_args .smooth_edge_update ,
312330 edge_init_use_dist = self .repflow_args .edge_init_use_dist ,
331+ use_dynamic_sel = self .repflow_args .use_dynamic_sel ,
332+ sel_reduce_factor = self .repflow_args .sel_reduce_factor ,
313333 exclude_types = exclude_types ,
314334 env_protection = env_protection ,
315335 precision = precision ,
0 commit comments