9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-14 00:25:17 +02:00

complex cis and cisd

This commit is contained in:
Kevin Gasperich 2020-07-01 13:20:35 -05:00
parent 10bcd38c45
commit d2dc64c422
5 changed files with 49 additions and 16 deletions

View File

@ -130,9 +130,15 @@ class H_apply(object):
!$OMP END PARALLEL !$OMP END PARALLEL
call dsort(H_jj,iorder,N_det) call dsort(H_jj,iorder,N_det)
do k=1,N_states if (is_complex) then
psi_coef(iorder(k),k) = 1.d0 do k=1,N_states
enddo psi_coef_complex(iorder(k),k) = (1.d0,0.d0)
enddo
else
do k=1,N_states
psi_coef(iorder(k),k) = 1.d0
enddo
endif
deallocate(H_jj,iorder) deallocate(H_jj,iorder)
""" """
@ -141,7 +147,11 @@ class H_apply(object):
if (s2_eig) then if (s2_eig) then
call make_s2_eigenfunction call make_s2_eigenfunction
endif endif
SOFT_TOUCH psi_det psi_coef N_det if (is_complex) then
SOFT_TOUCH psi_det psi_coef_complex N_det
else
SOFT_TOUCH psi_det psi_coef N_det
endif
""" """
s["printout_now"] = """write(6,*) & s["printout_now"] = """write(6,*) &
100.*float(i_generator)/float(N_det_generators), '% in ', wall_1-wall_0, 's'""" 100.*float(i_generator)/float(N_det_generators), '% in ', wall_1-wall_0, 's'"""

View File

@ -77,8 +77,13 @@ subroutine run
endif endif
call ezfio_set_cis_energy(CI_energy) call ezfio_set_cis_energy(CI_energy)
psi_coef = ci_eigenvectors if (is_complex) then
SOFT_TOUCH psi_coef psi_coef_complex = ci_eigenvectors_complex
SOFT_TOUCH psi_coef_complex
else
psi_coef = ci_eigenvectors
SOFT_TOUCH psi_coef
endif
call save_wavefunction call save_wavefunction
end end

View File

@ -61,16 +61,29 @@ subroutine run
else else
call H_apply_cisd call H_apply_cisd
endif endif
psi_coef = ci_eigenvectors if (is_complex) then
SOFT_TOUCH psi_coef psi_coef_complex = ci_eigenvectors_complex
SOFT_TOUCH psi_coef_complex
else
psi_coef = ci_eigenvectors
SOFT_TOUCH psi_coef
endif
call save_wavefunction call save_wavefunction
call ezfio_set_cisd_energy(CI_energy) call ezfio_set_cisd_energy(CI_energy)
do i = 1,N_states if (is_complex) then
k = maxloc(dabs(psi_coef_sorted(1:N_det,i)),dim=1) do i = 1,N_states
delta_E = CI_electronic_energy(i) - diag_h_mat_elem(psi_det_sorted(1,1,k),N_int) k = maxloc(cdabs(psi_coef_sorted_complex(1:N_det,i)),dim=1)
cisdq(i) = CI_energy(i) + delta_E * (1.d0 - psi_coef_sorted(k,i)**2) delta_E = CI_electronic_energy(i) - diag_h_mat_elem(psi_det_sorted(1,1,k),N_int)
enddo cisdq(i) = CI_energy(i) + delta_E * (1.d0 - cdabs(psi_coef_sorted_complex(k,i))**2)
enddo
else
do i = 1,N_states
k = maxloc(dabs(psi_coef_sorted(1:N_det,i)),dim=1)
delta_E = CI_electronic_energy(i) - diag_h_mat_elem(psi_det_sorted(1,1,k),N_int)
cisdq(i) = CI_energy(i) + delta_E * (1.d0 - psi_coef_sorted(k,i)**2)
enddo
endif
print *, 'N_det = ', N_det print *, 'N_det = ', N_det
print*,'' print*,''
print*,'******************************' print*,'******************************'

View File

@ -20,8 +20,13 @@ subroutine run_cisd
print*, i ,CI_energy(i) - CI_energy(1) print*, i ,CI_energy(i) - CI_energy(1)
enddo enddo
endif endif
psi_coef = ci_eigenvectors if (is_complex) then
SOFT_TOUCH psi_coef psi_coef_complex = ci_eigenvectors_complex
SOFT_TOUCH psi_coef_complex
else
psi_coef = ci_eigenvectors
SOFT_TOUCH psi_coef
endif
call save_wavefunction call save_wavefunction
call ezfio_set_cisd_energy(CI_energy) call ezfio_set_cisd_energy(CI_energy)

View File

@ -256,7 +256,7 @@ subroutine copy_H_apply_buffer_to_wf
call remove_duplicates_in_psi_det(found_duplicates) call remove_duplicates_in_psi_det(found_duplicates)
do k=1,N_states do k=1,N_states
call normalize(psi_coef_complex(1,k),N_det) call normalize_complex(psi_coef_complex(1,k),N_det)
enddo enddo
SOFT_TOUCH N_det psi_det psi_coef_complex SOFT_TOUCH N_det psi_det psi_coef_complex
else else