Skip to content

Commit f5e67d4

Browse files
committed
Save file with best tensors more often during the optimization
1 parent a16c4ec commit f5e67d4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

varipeps/optimization/optimizer.py

+24
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,30 @@ def random_noise(a):
755755
additional_input,
756756
)
757757

758+
if working_value < best_value:
759+
_autosave_wrapper(
760+
autosave_func,
761+
autosave_filename,
762+
working_tensors,
763+
working_unitcell,
764+
working_value,
765+
"best",
766+
random_noise_retries,
767+
max_trunc_error_list,
768+
step_energies,
769+
step_chi,
770+
step_conv,
771+
step_runtime,
772+
spiral_indices,
773+
additional_input,
774+
)
775+
776+
if working_value < best_value:
777+
best_value = working_value
778+
best_tensors = working_tensors
779+
best_unitcell = working_unitcell
780+
best_run = random_noise_retries
781+
758782
if working_value < best_value:
759783
best_value = working_value
760784
best_tensors = working_tensors

0 commit comments

Comments
 (0)