From bc2ecb8b2d4a1641bb9d87343bc11f7869ac5d87 Mon Sep 17 00:00:00 2001 From: Emmanuel Giner Date: Thu, 22 Jul 2021 23:31:08 +0200 Subject: [PATCH] minor modifs in casscf --- devel/casscf/EZFIO.cfg | 18 ++++++++++++++++++ devel/casscf/casscf.irp.f | 22 ++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/devel/casscf/EZFIO.cfg b/devel/casscf/EZFIO.cfg index c8ce539..2a1f192 100644 --- a/devel/casscf/EZFIO.cfg +++ b/devel/casscf/EZFIO.cfg @@ -55,3 +55,21 @@ doc: Threshold on the convergence of the CASCF energy. interface: ezfio,provider,ocaml default: 1.e-06 + +[pt2_min_casscf] +type: Threshold +doc: Minimum value of the pt2_max parameter for the CIPSI in the CASSCF iterations. +interface: ezfio,provider,ocaml +default: 1.e-04 + +[n_big_act_orb] +type: integer +doc: Number of active orbitals from which the active space is considered as large, and therefore pt2_min_casscf is activated. +interface: ezfio,provider,ocaml +default: 16 + +[adaptive_pt2_max] +type: logical +doc: If |true|, the pt2_max value in the CIPSI iterations will automatically adapt, otherwise it is fixed at the value given in the EZFIO folder +interface: ezfio,provider,ocaml +default: True diff --git a/devel/casscf/casscf.irp.f b/devel/casscf/casscf.irp.f index 03d2638..39dc94d 100644 --- a/devel/casscf/casscf.irp.f +++ b/devel/casscf/casscf.irp.f @@ -6,8 +6,6 @@ program casscf call reorder_orbitals_for_casscf ! no_vvvv_integrals = .True. ! touch no_vvvv_integrals - pt2_max = 0.005 - SOFT_TOUCH pt2_max n_det_max_full = 500 touch n_det_max_full pt2_relative_error = 0.02 @@ -30,6 +28,10 @@ subroutine run state_following_casscf = .True. touch state_following_casscf ept2_before = 0.d0 + if(adaptive_pt2_max)then + pt2_max = 0.005 + SOFT_TOUCH pt2_max + endif do while (.not.converged) call run_stochastic_cipsi energy_old = energy @@ -66,8 +68,13 @@ subroutine run converged = dabs(delta_E) < thresh_casscf endif ept2_before = E_PT2 - pt2_max = dabs(energy_improvement / (pt2_relative_error)) - pt2_max = min(pt2_max, pt2_max_before) + if(adaptive_pt2_max)then + pt2_max = dabs(energy_improvement / (pt2_relative_error)) + pt2_max = min(pt2_max, pt2_max_before) + if(n_act_orb.ge.n_big_act_orb)then + pt2_max = max(pt2_max,pt2_min_casscf) + endif + endif print*,'' call write_double(6,pt2_max, 'PT2_MAX for next iteration = ') @@ -76,12 +83,15 @@ subroutine run call save_mos if(.not.converged)then iteration += 1 - N_det = max(N_det/2 ,N_states) + N_det = max(N_det/8 ,N_states) psi_det = psi_det_sorted psi_coef = psi_coef_sorted read_wf = .True. call clear_mo_map - SOFT_TOUCH mo_coef N_det pt2_max psi_det psi_coef + SOFT_TOUCH mo_coef N_det psi_det psi_coef + if(adaptive_pt2_max)then + SOFT_TOUCH pt2_max + endif if(iteration .gt. 3)then state_following_casscf = state_following_casscf_save soft_touch state_following_casscf