From 1d4ec1ce93415f93a3f4d4201fcf560850554d88 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 14 Jun 2022 18:10:32 +0200 Subject: [PATCH] Update guess in CISD (see f093592124457451eeb0b6817488b4591cf9295f) --- external/qp2-dependencies | 2 +- src/cisd/cisd.irp.f | 37 ++++++++++++++++--- .../diagonalization_hcsf_dressed.irp.f | 19 +++------- src/determinants/determinants.irp.f | 18 +++++---- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/external/qp2-dependencies b/external/qp2-dependencies index 57a1466d..242151e0 160000 --- a/external/qp2-dependencies +++ b/external/qp2-dependencies @@ -1 +1 @@ -Subproject commit 57a1466d8707a8b0b1dfef8eede8e4f770b349cf +Subproject commit 242151e03d1d6bf042387226431d82d35845686a diff --git a/src/cisd/cisd.irp.f b/src/cisd/cisd.irp.f index fca3b10e..86333852 100644 --- a/src/cisd/cisd.irp.f +++ b/src/cisd/cisd.irp.f @@ -47,6 +47,37 @@ program cisd PROVIDE N_states read_wf = .False. SOFT_TOUCH read_wf + + integer :: i,k + + if(pseudo_sym)then + call H_apply_cisd_sym + else + call H_apply_cisd + endif + double precision :: r1, r2 + double precision, allocatable :: U_csf(:,:) + + allocate(U_csf(N_csf,N_states)) + U_csf = 0.d0 + U_csf(1,1) = 1.d0 + do k=2,N_states + do i=1,N_csf + call random_number(r1) + call random_number(r2) + r1 = dsqrt(-2.d0*dlog(r1)) + r2 = dacos(-1.d0)*2.d0*r2 + U_csf(i,k) = r1*dcos(r2) + enddo + U_csf(k,k) = U_csf(k,k) +100.d0 + enddo + do k=1,N_states + call normalize(U_csf(1,k),N_csf) + enddo + call convertWFfromCSFtoDET(N_states,U_csf(1,1),psi_coef(1,1)) + deallocate(U_csf) + SOFT_TOUCH psi_coef + call run end @@ -56,13 +87,7 @@ subroutine run double precision :: cisdq(N_states), delta_e double precision,external :: diag_h_mat_elem - if(pseudo_sym)then - call H_apply_cisd_sym - else - call H_apply_cisd - endif psi_coef = ci_eigenvectors - SOFT_TOUCH psi_coef call save_wavefunction_truncated(save_threshold) call ezfio_set_cisd_energy(CI_energy) diff --git a/src/davidson/diagonalization_hcsf_dressed.irp.f b/src/davidson/diagonalization_hcsf_dressed.irp.f index f531fb3a..8ecc4d67 100644 --- a/src/davidson/diagonalization_hcsf_dressed.irp.f +++ b/src/davidson/diagonalization_hcsf_dressed.irp.f @@ -264,29 +264,20 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N ! =================== converged = .False. - + call convertWFfromDETtoCSF(N_st_diag,u_in(1,1),U_csf(1,1)) do k=N_st+1,N_st_diag - do i=1,sze + do i=1,sze_csf call random_number(r1) call random_number(r2) r1 = dsqrt(-2.d0*dlog(r1)) r2 = dtwo_pi*r2 - u_in(i,k) = r1*dcos(r2) * u_in(i,k-N_st) + U_csf(i,k) = r1*dcos(r2) * u_csf(i,k-N_st) enddo - u_in(k,k) = u_in(k,k) + 10.d0 + U_csf(k,k) = u_csf(k,k) + 10.d0 enddo do k=1,N_st_diag - call normalize(u_in(1,k),sze) + call normalize(U_csf(1,k),sze_csf) enddo - - do k=1,N_st_diag - do i=1,sze - U(i,k) = u_in(i,k) - enddo - enddo - - ! Make random verctors eigenstates of S2 - call convertWFfromDETtoCSF(N_st_diag,U(1,1),U_csf(1,1)) call convertWFfromCSFtoDET(N_st_diag,U_csf(1,1),U(1,1)) do while (.not.converged) diff --git a/src/determinants/determinants.irp.f b/src/determinants/determinants.irp.f index cb6c14a2..de819330 100644 --- a/src/determinants/determinants.irp.f +++ b/src/determinants/determinants.irp.f @@ -77,14 +77,18 @@ BEGIN_PROVIDER [ integer, psi_det_size ] END_DOC PROVIDE ezfio_filename logical :: exists - if (mpi_master) then - call ezfio_has_determinants_n_det(exists) - if (exists) then - call ezfio_get_determinants_n_det(psi_det_size) - else - psi_det_size = 1 + psi_det_size = N_states + PROVIDE mpi_master + if (read_wf) then + if (mpi_master) then + call ezfio_has_determinants_n_det(exists) + if (exists) then + call ezfio_get_determinants_n_det(psi_det_size) + else + psi_det_size = N_states + endif + call write_int(6,psi_det_size,'Dimension of the psi arrays') endif - call write_int(6,psi_det_size,'Dimension of the psi arrays') endif IRP_IF MPI_DEBUG print *, irp_here, mpi_rank