From b79ff2ee6b32e9d1ddcd339b8102f7205367d5db Mon Sep 17 00:00:00 2001 From: Anouar Benali Date: Fri, 21 Apr 2017 10:16:20 -0500 Subject: [PATCH] Add correlation_energy_ratio_max as an exit criterion --- plugins/Full_CI_ZMQ/fci_zmq.irp.f | 23 ++++++++++++++++++++++- plugins/Perturbation/EZFIO.cfg | 10 +++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/plugins/Full_CI_ZMQ/fci_zmq.irp.f b/plugins/Full_CI_ZMQ/fci_zmq.irp.f index fcc38954..9337834f 100644 --- a/plugins/Full_CI_ZMQ/fci_zmq.irp.f +++ b/plugins/Full_CI_ZMQ/fci_zmq.irp.f @@ -9,7 +9,13 @@ program fci_zmq double precision :: threshold_davidson_in allocate (pt2(N_states)) - + + IF (correlation_energy_ratio_max .NE. 1.d0) THEN + + DOUBLE PRECISION :: hf_energy_ref + CALL ezfio_get_hartree_fock_energy(hf_energy_ref) + END IF + pt2 = 1.d0 threshold_davidson_in = threshold_davidson threshold_davidson = threshold_davidson_in * 100.d0 @@ -41,8 +47,23 @@ program fci_zmq E_CI_before(1:N_states) = CI_energy(1:N_states) n_det_before = 0 + do while ( (N_det < N_det_max) .and. (maxval(abs(pt2(1:N_states))) > pt2_max) ) + + + IF (correlation_energy_ratio_max .NE. 1.d0) THEN + DOUBLE PRECISION :: correlation_energy_var, correlation_energy_var_ratio + + correlation_energy_var = MAXVAL(E_CI_before) - hf_energy_ref + correlation_energy_var_ratio = correlation_energy_var / (correlation_energy_var + MAXVAL(pt2(:))) + + IF (correlation_energy_ratio_max < correlation_energy_var_ratio) THEN + EXIT + ENDIF + ENDIF + + print *, 'N_det = ', N_det print *, 'N_states = ', N_states do k=1, N_states diff --git a/plugins/Perturbation/EZFIO.cfg b/plugins/Perturbation/EZFIO.cfg index 4f0457a2..0477e87b 100644 --- a/plugins/Perturbation/EZFIO.cfg +++ b/plugins/Perturbation/EZFIO.cfg @@ -14,10 +14,18 @@ default: 0.0001 [var_pt2_ratio] type: Normalized_float doc: The selection process stops when the energy ratio variational/(variational+PT2) - is equal to var_pt2_ratio + is equal to var_pt2_ratio. (Obsolete. Need to be removed) interface: ezfio,provider,ocaml default: 0.75 +[correlation_energy_ratio_max] +type: Normalized_float +doc: The selection process stops at a fixed correlation ratio (usefull for getting same accuracy between molecules) + Defined as (E_CI-E_HF)/ (E_CI+PT2 - E_HF) + If Ratio==1 it will not be used. (E_HF) is not required. +interface: ezfio,provider,ocaml +default: 1.00 + [threshold_generators_pt2] type: Threshold doc: Thresholds on generators (fraction of the norm) for final PT2 calculation