From 2d1f40cae70041ef9c6ccfb10e5657be97f7b829 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 8 Nov 2016 23:03:11 +0100 Subject: [PATCH] Better convergence of MRCC --- plugins/MRCC_Utils/mrcc_utils.irp.f | 30 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/plugins/MRCC_Utils/mrcc_utils.irp.f b/plugins/MRCC_Utils/mrcc_utils.irp.f index 48fa2e80..5a35a792 100644 --- a/plugins/MRCC_Utils/mrcc_utils.irp.f +++ b/plugins/MRCC_Utils/mrcc_utils.irp.f @@ -884,28 +884,26 @@ END_PROVIDER !$OMP END PARALLEL + + res = 0.d0 - - - if (res < resold) then - do a_coll=1,nactive ! nex - a_col = active_pp_idx(a_coll) - do j=1,N_det_non_ref - i = A_ind(j,a_coll) - if (i==0) exit - rho_mrcc(i,s) = rho_mrcc(i,s) + A_val(j,a_coll) * X_new(a_col) - enddo - res = res + (X_new(a_col) - X(a_col))*(X_new(a_col) - X(a_col)) - X(a_col) = X_new(a_col) - end do - factor = 1.d0 - else + do a_coll=1,nactive ! nex + a_col = active_pp_idx(a_coll) + do j=1,N_det_non_ref + i = A_ind(j,a_coll) + if (i==0) exit + rho_mrcc(i,s) = rho_mrcc(i,s) + A_val(j,a_coll) * X_new(a_col) + enddo + res = res + (X_new(a_col) - X(a_col))*(X_new(a_col) - X(a_col)) + X(a_col) = X_new(a_col) + end do + if (res > resold) then factor = -factor * 0.5d0 endif resold = res if(mod(k, 100) == 0) then - print *, "res ", k, res + print *, "res ", k, res, factor end if if(res < 1d-9) exit