diff --git a/plugins/CISD/cisd.irp.f b/plugins/CISD/cisd.irp.f index e85f0940..53f111ee 100644 --- a/plugins/CISD/cisd.irp.f +++ b/plugins/CISD/cisd.irp.f @@ -17,6 +17,6 @@ subroutine run enddo psi_coef = ci_eigenvectors SOFT_TOUCH psi_coef - call save_wavefunction + call save_wavefunction_truncated(1.d-12) end diff --git a/src/Determinants/determinants.irp.f b/src/Determinants/determinants.irp.f index 38b08172..3db76eef 100644 --- a/src/Determinants/determinants.irp.f +++ b/src/Determinants/determinants.irp.f @@ -454,6 +454,26 @@ end +subroutine save_wavefunction_truncated(thr) + implicit none + double precision, intent(in) :: thr + use bitmasks + BEGIN_DOC + ! Save the wave function into the EZFIO file + END_DOC + integer :: N_det_save,i + N_det_save = N_det + do i=1,N_det + if (psi_average_norm_contrib_sorted(i) < thr) then + N_det_save = i + exit + endif + enddo + if (mpi_master) then + call save_wavefunction_general(N_det_save,min(N_states,N_det_save),psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted) + endif +end + subroutine save_wavefunction implicit none use bitmasks