9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 19:43:32 +01:00

Update guess in CISD (see f093592124)

This commit is contained in:
Anthony Scemama 2022-06-14 18:10:32 +02:00
parent c1188c05ce
commit 1d4ec1ce93
4 changed files with 48 additions and 28 deletions

@ -1 +1 @@
Subproject commit 57a1466d8707a8b0b1dfef8eede8e4f770b349cf Subproject commit 242151e03d1d6bf042387226431d82d35845686a

View File

@ -47,6 +47,37 @@ program cisd
PROVIDE N_states PROVIDE N_states
read_wf = .False. read_wf = .False.
SOFT_TOUCH read_wf 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 call run
end end
@ -56,13 +87,7 @@ subroutine run
double precision :: cisdq(N_states), delta_e double precision :: cisdq(N_states), delta_e
double precision,external :: diag_h_mat_elem 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 psi_coef = ci_eigenvectors
SOFT_TOUCH psi_coef
call save_wavefunction_truncated(save_threshold) call save_wavefunction_truncated(save_threshold)
call ezfio_set_cisd_energy(CI_energy) call ezfio_set_cisd_energy(CI_energy)

View File

@ -264,29 +264,20 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
! =================== ! ===================
converged = .False. converged = .False.
call convertWFfromDETtoCSF(N_st_diag,u_in(1,1),U_csf(1,1))
do k=N_st+1,N_st_diag do k=N_st+1,N_st_diag
do i=1,sze do i=1,sze_csf
call random_number(r1) call random_number(r1)
call random_number(r2) call random_number(r2)
r1 = dsqrt(-2.d0*dlog(r1)) r1 = dsqrt(-2.d0*dlog(r1))
r2 = dtwo_pi*r2 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 enddo
u_in(k,k) = u_in(k,k) + 10.d0 U_csf(k,k) = u_csf(k,k) + 10.d0
enddo enddo
do k=1,N_st_diag do k=1,N_st_diag
call normalize(u_in(1,k),sze) call normalize(U_csf(1,k),sze_csf)
enddo 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)) call convertWFfromCSFtoDET(N_st_diag,U_csf(1,1),U(1,1))
do while (.not.converged) do while (.not.converged)

View File

@ -77,15 +77,19 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
END_DOC END_DOC
PROVIDE ezfio_filename PROVIDE ezfio_filename
logical :: exists logical :: exists
psi_det_size = N_states
PROVIDE mpi_master
if (read_wf) then
if (mpi_master) then if (mpi_master) then
call ezfio_has_determinants_n_det(exists) call ezfio_has_determinants_n_det(exists)
if (exists) then if (exists) then
call ezfio_get_determinants_n_det(psi_det_size) call ezfio_get_determinants_n_det(psi_det_size)
else else
psi_det_size = 1 psi_det_size = N_states
endif endif
call write_int(6,psi_det_size,'Dimension of the psi arrays') call write_int(6,psi_det_size,'Dimension of the psi arrays')
endif endif
endif
IRP_IF MPI_DEBUG IRP_IF MPI_DEBUG
print *, irp_here, mpi_rank print *, irp_here, mpi_rank
call MPI_BARRIER(MPI_COMM_WORLD, ierr) call MPI_BARRIER(MPI_COMM_WORLD, ierr)