9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-18 11:23:38 +01:00

working on complex cipsi

This commit is contained in:
Kevin Gasperich 2020-02-26 17:01:41 -06:00
parent 47d27186dc
commit 20d5bcd9d5
6 changed files with 62 additions and 10 deletions

View File

@ -17,7 +17,11 @@ BEGIN_PROVIDER [ double precision, pt2_E0_denominator, (N_states) ]
pt2_E0_denominator(1:N_states) = psi_energy(1:N_states) pt2_E0_denominator(1:N_states) = psi_energy(1:N_states)
else if (h0_type == "HF") then else if (h0_type == "HF") then
do i=1,N_states do i=1,N_states
j = maxloc(abs(psi_coef(:,i)),1) if (is_complex) then
j = maxloc(cdabs(psi_coef_complex(:,i)),1)
else
j = maxloc(abs(psi_coef(:,i)),1)
endif
pt2_E0_denominator(i) = psi_det_hii(j) pt2_E0_denominator(i) = psi_det_hii(j)
enddo enddo
else if (h0_type == "Barycentric") then else if (h0_type == "Barycentric") then

View File

@ -140,7 +140,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
pt2=0.d0 pt2=0.d0
variance=0.d0 variance=0.d0
norm=0.d0 norm=0.d0
call ZMQ_selection(N_in, pt2, variance, norm) call zmq_selection(N_in, pt2, variance, norm)
error(:) = 0.d0 error(:) = 0.d0
else else

View File

@ -36,7 +36,7 @@ subroutine run_stochastic_cipsi
if (s2_eig) then if (s2_eig) then
call make_s2_eigenfunction call make_s2_eigenfunction
endif endif
call diagonalize_CI call diagonalize_ci
call save_wavefunction call save_wavefunction
call ezfio_has_hartree_fock_energy(has) call ezfio_has_hartree_fock_energy(has)
@ -48,9 +48,15 @@ subroutine run_stochastic_cipsi
if (N_det > N_det_max) then if (N_det > N_det_max) then
psi_det = psi_det_sorted psi_det = psi_det_sorted
psi_coef = psi_coef_sorted if (is_complex) then
N_det = N_det_max psi_coef_complex = psi_coef_sorted_complex
soft_touch N_det psi_det psi_coef N_det = N_det_max
soft_touch N_det psi_det psi_coef_complex
else
psi_coef = psi_coef_sorted
N_det = N_det_max
soft_touch N_det psi_det psi_coef
endif
if (s2_eig) then if (s2_eig) then
call make_s2_eigenfunction call make_s2_eigenfunction
endif endif
@ -78,7 +84,7 @@ subroutine run_stochastic_cipsi
pt2 = 0.d0 pt2 = 0.d0
variance = 0.d0 variance = 0.d0
norm = 0.d0 norm = 0.d0
call ZMQ_pt2(psi_energy_with_nucl_rep,pt2,relative_error,error, variance, & call zmq_pt2(psi_energy_with_nucl_rep,pt2,relative_error,error, variance, &
norm, to_select) ! Stochastic PT2 and selection norm, to_select) ! Stochastic PT2 and selection
do k=1,N_states do k=1,N_states

View File

@ -37,7 +37,11 @@ program fci
END_DOC END_DOC
if (.not.is_zmq_slave) then if (.not.is_zmq_slave) then
PROVIDE psi_det psi_coef mo_two_e_integrals_in_map if (is_complex) then
PROVIDE psi_det psi_coef_complex mo_two_e_integrals_in_map
else
PROVIDE psi_det psi_coef mo_two_e_integrals_in_map
endif
if (do_pt2) then if (do_pt2) then
call run_stochastic_cipsi call run_stochastic_cipsi

View File

@ -30,8 +30,7 @@ BEGIN_PROVIDER [ integer, N_det_selectors]
call write_int(6,N_det_selectors,'Number of selectors') call write_int(6,N_det_selectors,'Number of selectors')
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_selectors, (N_int,2,psi_selectors_size) ] BEGIN_PROVIDER [ integer(bit_kind), psi_selectors, (N_int,2,psi_selectors_size) ]
&BEGIN_PROVIDER [ double precision, psi_selectors_coef, (psi_selectors_size,N_states) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Determinants on which we apply <i|H|psi> for perturbation. ! Determinants on which we apply <i|H|psi> for perturbation.
@ -44,6 +43,16 @@ END_PROVIDER
psi_selectors(k,2,i) = psi_det_sorted(k,2,i) psi_selectors(k,2,i) = psi_det_sorted(k,2,i)
enddo enddo
enddo enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, psi_selectors_coef, (psi_selectors_size,N_states) ]
implicit none
BEGIN_DOC
! Determinants on which we apply <i|H|psi> for perturbation.
END_DOC
integer :: i,k
do k=1,N_states do k=1,N_states
do i=1,N_det_selectors do i=1,N_det_selectors
psi_selectors_coef(i,k) = psi_coef_sorted(i,k) psi_selectors_coef(i,k) = psi_coef_sorted(i,k)
@ -52,4 +61,19 @@ END_PROVIDER
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ complex*16, psi_selectors_coef_complex, (psi_selectors_size,N_states) ]
implicit none
BEGIN_DOC
! Determinants on which we apply <i|H|psi> for perturbation.
END_DOC
integer :: i,k
do k=1,N_states
do i=1,N_det_selectors
psi_selectors_coef_complex(i,k) = psi_coef_sorted_complex(i,k)
enddo
enddo
END_PROVIDER

View File

@ -32,3 +32,17 @@ BEGIN_PROVIDER [ double precision, psi_selectors_diag_h_mat, (psi_selectors_size
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ complex*16, psi_selectors_coef_transp_complex, (N_states,psi_selectors_size) ]
implicit none
BEGIN_DOC
! Transposed psi_selectors
END_DOC
integer :: i,k
do i=1,N_det_selectors
do k=1,N_states
psi_selectors_coef_transp_complex(k,i) = psi_selectors_coef_complex(i,k)
enddo
enddo
END_PROVIDER