File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ class RldiagConfig:
78
78
79
79
# The initial configuration for the first step, which is usually the Hatree-Fock state for quantum chemistry system
80
80
initial_config : typing .Annotated [typing .Optional [str ], tyro .conf .arg (aliases = ["-i" ])] = None
81
+ # The maximum size of the configuration pool
82
+ max_pool_size : typing .Annotated [int , tyro .conf .arg (aliases = ["-n" ])] = 32768
81
83
# The learning rate for the local optimizer
82
84
learning_rate : typing .Annotated [float , tyro .conf .arg (aliases = ["-r" ])] = 1e-3
83
85
# The step of lanczos iteration for calculating the energy
@@ -158,9 +160,12 @@ def main(self) -> None:
158
160
# | pruned | remained | expanded |
159
161
# | new config pool |
160
162
action = score .real >= - self .alpha
161
- action [0 ] = True
162
163
_ , topk = torch .topk (score .real , k = score .size (0 ) // 2 , dim = 0 )
163
164
action [topk ] = True
165
+ if score .size (0 ) > self .max_pool_size :
166
+ _ , topk = torch .topk (- score .real , k = score .size (0 ) - self .max_pool_size )
167
+ action [topk ] = False
168
+ action [0 ] = True
164
169
remained_configs = configs [action ]
165
170
pruned_configs = configs [torch .logical_not (action )]
166
171
expanded_configs = model .single_relative (remained_configs ) # There are duplicated config here
You can’t perform that action at this time.
0 commit comments