anchor.diff:           ihpsi_current(k) = 1.d-32
          endif
          lambda_mrcc_old(k,i) = psi_non_ref_coef(i,k)/ihpsi_current(k) 
  -      if ( dabs(psi_non_ref_coef(i,k)*ihpsi_current(k)) < 1.d-5 ) then
  +      !if ( dabs(psi_non_ref_coef(i,k)*ihpsi_current(k)) < 1.d-5 .or. lambda_mrcc_old(k,i) > 0d0) then
  +      if ( dabs(ihpsi_current(k))*sqrt(psi_non_ref_coef(i,k)**2 / nurm) < 1.d-5 .or. lambda_mrcc_old(k,i) > 0d0) then
           i_pert_count += 1
           lambda_mrcc_old(k,i) = 0.d0
           if (lambda_mrcc_pt2_old(N_lambda_mrcc_pt2) /= i) then
  -           N_lambda_mrcc_pt2 += 1
  -           lambda_mrcc_pt2_old(N_lambda_mrcc_pt2) = i
  +          N_lambda_mrcc_pt2 += 1
  +          lambda_mrcc_pt2_old(N_lambda_mrcc_pt2) = i
           endif
  +      else
  +        if (lambda_mrcc_pt3_old(N_lambda_mrcc_pt3) /= i) then
  +          N_lambda_mrcc_pt3 += 1
  +          lambda_mrcc_pt3_old(N_lambda_mrcc_pt3) = i
  +        endif
  +      endif
   !         lambda_pert = 1.d0 / (psi_ref_energy_diagonalized(k)-hii)
   !         if((ihpsi_current(k) * lambda_pert) < 0.5d0 * psi_non_ref_coef_restart(i,k) ) then
   !            lambda_mrcc_old(k,i) = 0.d0
   !         endif
  -      endif
         
         if (lambda_mrcc_old(k,i) > x) then
           lambda_mrcc_old(k,i) = x
  
positive.code: 
  BEGIN_PROVIDER [ double precision, lambda_mrcc_old, (N_states,psi_det_size) ]
  &BEGIN_PROVIDER [ integer, lambda_mrcc_pt2_old, (0:psi_det_size) ]
   implicit none
   BEGIN_DOC
   cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
  
negative.code:   if(old_lambda) then
      lambda_mrcc = lambda_mrcc_old
      lambda_mrcc_pt2 = lambda_mrcc_pt2_old
      lambda_mrcc_pt3 = lambda_mrcc_pt3_old
    else
      i_pert_count = 0
      lambda_mrcc = 0.d0
  