diff --git a/devel/variance/variance b/devel/variance/variance index 641de16..a957fe4 100755 Binary files a/devel/variance/variance and b/devel/variance/variance differ diff --git a/devel/variance/variance.irp.f b/devel/variance/variance.irp.f index cafb6ce..0e76dec 100644 --- a/devel/variance/variance.irp.f +++ b/devel/variance/variance.irp.f @@ -94,9 +94,12 @@ program variance call save_iterations(psi_energy_with_nucl_rep(1:N_states),rpt2,N_det) call print_extrapolated_energy() N_iter += 1 - - if (qp_stop()) exit - + + if ( (maxval(abs(pt2(1:N_states))) <= pt2_max) .or. & + (maxval(abs(var(1:N_states))) <= variance_max) .or. & + qp_stop() ) then + exit + endif ! Add selected determinants call copy_H_apply_buffer_to_wf() call save_wavefunction @@ -112,28 +115,4 @@ program variance if (qp_stop()) exit enddo - if (.not.qp_stop()) then - if (N_det < N_det_max) then - call diagonalize_CI - call save_wavefunction - rpt2(:) = 0.d0 - call save_energy(psi_energy_with_nucl_rep, rpt2) - endif - - pt2 = 0.d0 - var = 0.d0 - norm = 0.d0 - call ZMQ_pt2(psi_energy_with_nucl_rep, pt2,relative_error,error,var, & - norm,0) ! Stochastic PT2 - call save_energy(psi_energy_with_nucl_rep, pt2) - - do k=1,N_states - rpt2(:) = pt2(:)/(1.d0 + norm(k)) - enddo - - call print_summary(psi_energy_with_nucl_rep(1:N_states),pt2,error,var,norm,N_det,N_occ_pattern,N_states,psi_s2) - call save_iterations(psi_energy_with_nucl_rep(1:N_states),rpt2,N_det) - call print_extrapolated_energy() - endif - end