9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 05:53:37 +01:00

Better fix for pt2_max

This commit is contained in:
Anthony Scemama 2023-05-04 11:54:29 +02:00
parent ba2e783e8c
commit e8782546c1
2 changed files with 14 additions and 2 deletions

View File

@ -130,7 +130,13 @@ subroutine run_cipsi
if (qp_stop()) exit if (qp_stop()) exit
enddo enddo
if ((.not.qp_stop()).and.(N_det > N_det_max)) then ! If stopped because N_det > N_det_max, do an extra iteration to compute the PT2
if ((.not.qp_stop()).and. &
(N_det > N_det_max) .and. &
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) .and. &
(maxval(abs(pt2_data % variance(1:N_states))) > variance_max) .and.&
(correlation_energy_ratio <= correlation_energy_ratio_max) &
) then
if (do_pt2) then if (do_pt2) then
call pt2_dealloc(pt2_data) call pt2_dealloc(pt2_data)
call pt2_dealloc(pt2_data_err) call pt2_dealloc(pt2_data_err)

View File

@ -119,7 +119,13 @@ subroutine run_stochastic_cipsi
if (qp_stop()) exit if (qp_stop()) exit
enddo enddo
if ((.not.qp_stop()).and.(N_det > N_det_max)) then ! If stopped because N_det > N_det_max, do an extra iteration to compute the PT2
if ((.not.qp_stop()).and. &
(N_det > N_det_max) .and. &
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) .and. &
(maxval(abs(pt2_data % variance(1:N_states))) > variance_max) .and.&
(correlation_energy_ratio <= correlation_energy_ratio_max) &
) then
call pt2_dealloc(pt2_data) call pt2_dealloc(pt2_data)
call pt2_dealloc(pt2_data_err) call pt2_dealloc(pt2_data_err)
call pt2_alloc(pt2_data, N_states) call pt2_alloc(pt2_data, N_states)