@@ -537,16 +537,19 @@ def calc_ctmrg_env(
537
537
tmp_count = 0
538
538
corner_singular_vals = None
539
539
540
- while any (
541
- getattr (i , j ).shape [0 ] != i .chi or getattr (i , j ).shape [1 ] != i .chi
542
- for i in working_unitcell .get_unique_tensors ()
543
- for j in ("C1" , "C2" , "C3" , "C4" )
544
- ) or (
545
- hasattr (working_unitcell .get_unique_tensors ()[0 ], "T4_ket" )
546
- and any (
547
- getattr (i , j ).shape [0 ] != i .interlayer_chi
540
+ while tmp_count < varipeps_config .ctmrg_max_steps and (
541
+ any (
542
+ getattr (i , j ).shape [0 ] != i .chi or getattr (i , j ).shape [1 ] != i .chi
548
543
for i in working_unitcell .get_unique_tensors ()
549
- for j in ("T1_bra" , "T2_ket" , "T3_bra" , "T4_ket" )
544
+ for j in ("C1" , "C2" , "C3" , "C4" )
545
+ )
546
+ or (
547
+ hasattr (working_unitcell .get_unique_tensors ()[0 ], "T4_ket" )
548
+ and any (
549
+ getattr (i , j ).shape [0 ] != i .interlayer_chi
550
+ for i in working_unitcell .get_unique_tensors ()
551
+ for j in ("T1_bra" , "T2_ket" , "T3_bra" , "T4_ket" )
552
+ )
550
553
)
551
554
):
552
555
(
@@ -557,7 +560,7 @@ def calc_ctmrg_env(
557
560
_ ,
558
561
tmp_count ,
559
562
_ ,
560
- _ ,
563
+ norm_smallest_S ,
561
564
_ ,
562
565
_ ,
563
566
) = _ctmrg_body_func (
@@ -575,24 +578,28 @@ def calc_ctmrg_env(
575
578
)
576
579
)
577
580
578
- working_unitcell , converged , end_count , norm_smallest_S = _ctmrg_while_wrapper (
579
- (
580
- peps_tensors ,
581
- working_unitcell ,
582
- False ,
581
+ if tmp_count < varipeps_config .ctmrg_max_steps :
582
+ working_unitcell , converged , end_count , norm_smallest_S = _ctmrg_while_wrapper (
583
583
(
584
- corner_singular_vals
584
+ peps_tensors ,
585
+ working_unitcell ,
586
+ False ,
587
+ (
588
+ corner_singular_vals
585
589
if corner_singular_vals is not None
586
590
else init_corner_singular_vals
587
- ),
588
- eps ,
589
- tmp_count ,
590
- enforce_elementwise_convergence ,
591
- jnp .inf ,
592
- varipeps_global_state ,
593
- varipeps_config ,
591
+ ),
592
+ eps ,
593
+ tmp_count ,
594
+ enforce_elementwise_convergence ,
595
+ jnp .inf ,
596
+ varipeps_global_state ,
597
+ varipeps_config ,
598
+ )
594
599
)
595
- )
600
+ else :
601
+ converged = False
602
+ end_count = tmp_count
596
603
597
604
current_truncation_eps = (
598
605
varipeps_config .ctmrg_truncation_eps
0 commit comments