mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-25 13:53:49 +01:00
shifted_bk_slave
This commit is contained in:
parent
8b7cb82cf8
commit
c786e9fe58
@ -25,8 +25,9 @@ subroutine run
|
|||||||
E_CI_before = pt2_E0_denominator(1) + nuclear_repulsion
|
E_CI_before = pt2_E0_denominator(1) + nuclear_repulsion
|
||||||
threshold_selectors = 1.d0
|
threshold_selectors = 1.d0
|
||||||
threshold_generators = 1d0
|
threshold_generators = 1d0
|
||||||
relative_error = 1.d-5
|
relative_error = 1.d-9
|
||||||
absolute_error = 1.d-5
|
absolute_error = 1.d-9
|
||||||
|
|
||||||
call ZMQ_pt2(E_CI_before, pt2, relative_error, absolute_error, eqt)
|
call ZMQ_pt2(E_CI_before, pt2, relative_error, absolute_error, eqt)
|
||||||
print *, 'Final step'
|
print *, 'Final step'
|
||||||
print *, 'N_det = ', N_det
|
print *, 'N_det = ', N_det
|
||||||
|
@ -33,14 +33,12 @@ subroutine run_wf
|
|||||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
call wait_for_states(states,zmq_state,1)
|
call wait_for_states(states,zmq_state,1)
|
||||||
|
if(zmq_state(:7) == 'Stopped') then
|
||||||
if(trim(zmq_state) == 'Stopped') then
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
else if (trim(zmq_state) == 'dress') then
|
else if (zmq_state(:5) == 'dress') then
|
||||||
|
|
||||||
! Selection
|
! Selection
|
||||||
! ---------
|
! ---------
|
||||||
@ -55,7 +53,7 @@ subroutine run_wf
|
|||||||
|
|
||||||
!$OMP PARALLEL PRIVATE(i)
|
!$OMP PARALLEL PRIVATE(i)
|
||||||
i = omp_get_thread_num()
|
i = omp_get_thread_num()
|
||||||
call dress_slave_tcp(i, energy)
|
call dress_slave_tcp(i+1, energy)
|
||||||
!$OMP END PARALLEL
|
!$OMP END PARALLEL
|
||||||
print *, 'dress done'
|
print *, 'dress done'
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ subroutine run_dress_slave(thread,iproc,energy)
|
|||||||
end do
|
end do
|
||||||
do
|
do
|
||||||
call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task)
|
call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task)
|
||||||
|
|
||||||
if(task_id /= 0) then
|
if(task_id /= 0) then
|
||||||
read (task,*) subset, i_generator
|
read (task,*) subset, i_generator
|
||||||
delta_ij_loc = 0d0
|
delta_ij_loc = 0d0
|
||||||
|
@ -5,103 +5,13 @@ program shifted_bk
|
|||||||
! TODO
|
! TODO
|
||||||
END_DOC
|
END_DOC
|
||||||
|
|
||||||
|
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
|
||||||
|
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
|
||||||
|
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
|
||||||
|
PROVIDE psi_bilinear_matrix_transp_order
|
||||||
|
|
||||||
|
|
||||||
call diagonalize_CI()
|
call diagonalize_CI()
|
||||||
call dress_zmq()
|
call dress_zmq()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, fock_diag_tmp_, (2,mo_tot_num+1,Nproc) ]
|
|
||||||
&BEGIN_PROVIDER [ integer, current_generator_, (Nproc) ]
|
|
||||||
&BEGIN_PROVIDER [ double precision, a_h_i, (N_det, Nproc) ]
|
|
||||||
&BEGIN_PROVIDER [ double precision, a_s2_i, (N_det, Nproc) ]
|
|
||||||
implicit none
|
|
||||||
current_generator_(:) = 0
|
|
||||||
a_h_i = 0d0
|
|
||||||
a_s2_i = 0d0
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minilist, det_minilist, n_minilist, alpha, iproc)
|
|
||||||
use bitmasks
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
!delta_ij_loc(:,:,1) : dressing column for H
|
|
||||||
!delta_ij_loc(:,:,2) : dressing column for S2
|
|
||||||
!i_gen : generator index in psi_det_generators
|
|
||||||
!minilist : indices of determinants connected to alpha ( in psi_det_sorted )
|
|
||||||
!n_minilist : size of minilist
|
|
||||||
!alpha : alpha determinant
|
|
||||||
END_DOC
|
|
||||||
integer, intent(in) :: Nint, Ndet, Nstates, n_minilist, iproc, i_gen
|
|
||||||
integer(bit_kind), intent(in) :: alpha(Nint,2), det_minilist(Nint, 2, n_minilist)
|
|
||||||
integer,intent(in) :: minilist(n_minilist)
|
|
||||||
double precision, intent(inout) :: delta_ij_loc(Nstates,N_det,2)
|
|
||||||
double precision :: haa, hij, sij
|
|
||||||
double precision, external :: diag_H_mat_elem_fock
|
|
||||||
integer :: i,j,k,l,m, l_sd
|
|
||||||
double precision :: hdress, sdress
|
|
||||||
double precision :: de, a_h_psi(Nstates), c_alpha
|
|
||||||
|
|
||||||
|
|
||||||
a_h_psi = 0d0
|
|
||||||
|
|
||||||
if(current_generator_(iproc) /= i_gen) then
|
|
||||||
current_generator_(iproc) = i_gen
|
|
||||||
call build_fock_tmp(fock_diag_tmp_(1,1,iproc),psi_det_generators(1,1,i_gen),N_int)
|
|
||||||
end if
|
|
||||||
|
|
||||||
haa = diag_H_mat_elem_fock(psi_det_generators(1,1,i_gen),alpha,fock_diag_tmp_(1,1,iproc),N_int)
|
|
||||||
|
|
||||||
do l_sd=1,n_minilist
|
|
||||||
call i_h_j_s2(alpha,det_minilist(1,1,l_sd),N_int,hij, sij)
|
|
||||||
a_h_i(l_sd, iproc) = hij
|
|
||||||
a_s2_i(l_sd, iproc) = sij
|
|
||||||
do i=1,Nstates
|
|
||||||
a_h_psi(i) += hij * psi_coef(minilist(l_sd), i)
|
|
||||||
end do
|
|
||||||
end do
|
|
||||||
|
|
||||||
|
|
||||||
do i=1,Nstates
|
|
||||||
de = E0_denominator(i) - haa
|
|
||||||
if(DABS(de) < 1D-5) cycle
|
|
||||||
|
|
||||||
c_alpha = a_h_psi(i) / de
|
|
||||||
|
|
||||||
do l_sd=1,n_minilist
|
|
||||||
hdress = c_alpha * a_h_i(l_sd, iproc)
|
|
||||||
sdress = c_alpha * a_s2_i(l_sd, iproc)
|
|
||||||
delta_ij_loc(i, minilist(l_sd), 1) += hdress
|
|
||||||
delta_ij_loc(i, minilist(l_sd), 2) += sdress
|
|
||||||
end do
|
|
||||||
end do
|
|
||||||
end subroutine
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ logical, initialize_E0_denominator ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! If true, initialize pt2_E0_denominator
|
|
||||||
END_DOC
|
|
||||||
initialize_E0_denominator = .True.
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROVIDER [ double precision, E0_denominator, (N_states) ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! E0 in the denominator of the PT2
|
|
||||||
END_DOC
|
|
||||||
if (initialize_E0_denominator) then
|
|
||||||
E0_denominator(1:N_states) = psi_energy(1:N_states)
|
|
||||||
! call ezfio_get_full_ci_zmq_energy(pt2_E0_denominator(1))
|
|
||||||
! pt2_E0_denominator(1) -= nuclear_repulsion
|
|
||||||
! pt2_E0_denominator(1:N_states) = HF_energy - nuclear_repulsion
|
|
||||||
! pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states)
|
|
||||||
else
|
|
||||||
E0_denominator = -huge(1.d0)
|
|
||||||
endif
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
||||||
|
97
plugins/shiftedbk/shifted_bk_routines.irp.f
Normal file
97
plugins/shiftedbk/shifted_bk_routines.irp.f
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, fock_diag_tmp_, (2,mo_tot_num+1,Nproc) ]
|
||||||
|
&BEGIN_PROVIDER [ integer, current_generator_, (Nproc) ]
|
||||||
|
&BEGIN_PROVIDER [ double precision, a_h_i, (N_det, Nproc) ]
|
||||||
|
&BEGIN_PROVIDER [ double precision, a_s2_i, (N_det, Nproc) ]
|
||||||
|
implicit none
|
||||||
|
current_generator_(:) = 0
|
||||||
|
a_h_i = 0d0
|
||||||
|
a_s2_i = 0d0
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minilist, det_minilist, n_minilist, alpha, iproc)
|
||||||
|
use bitmasks
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
!delta_ij_loc(:,:,1) : dressing column for H
|
||||||
|
!delta_ij_loc(:,:,2) : dressing column for S2
|
||||||
|
!i_gen : generator index in psi_det_generators
|
||||||
|
!minilist : indices of determinants connected to alpha ( in psi_det_sorted )
|
||||||
|
!n_minilist : size of minilist
|
||||||
|
!alpha : alpha determinant
|
||||||
|
END_DOC
|
||||||
|
integer, intent(in) :: Nint, Ndet, Nstates, n_minilist, iproc, i_gen
|
||||||
|
integer(bit_kind), intent(in) :: alpha(Nint,2), det_minilist(Nint, 2, n_minilist)
|
||||||
|
integer,intent(in) :: minilist(n_minilist)
|
||||||
|
double precision, intent(inout) :: delta_ij_loc(Nstates,N_det,2)
|
||||||
|
double precision :: haa, hij, sij
|
||||||
|
double precision, external :: diag_H_mat_elem_fock
|
||||||
|
integer :: i,j,k,l,m, l_sd
|
||||||
|
double precision :: hdress, sdress
|
||||||
|
double precision :: de, a_h_psi(Nstates), c_alpha
|
||||||
|
|
||||||
|
|
||||||
|
a_h_psi = 0d0
|
||||||
|
|
||||||
|
if(current_generator_(iproc) /= i_gen) then
|
||||||
|
current_generator_(iproc) = i_gen
|
||||||
|
call build_fock_tmp(fock_diag_tmp_(1,1,iproc),psi_det_generators(1,1,i_gen),N_int)
|
||||||
|
end if
|
||||||
|
|
||||||
|
haa = diag_H_mat_elem_fock(psi_det_generators(1,1,i_gen),alpha,fock_diag_tmp_(1,1,iproc),N_int)
|
||||||
|
|
||||||
|
do l_sd=1,n_minilist
|
||||||
|
call i_h_j_s2(alpha,det_minilist(1,1,l_sd),N_int,hij, sij)
|
||||||
|
a_h_i(l_sd, iproc) = hij
|
||||||
|
a_s2_i(l_sd, iproc) = sij
|
||||||
|
do i=1,Nstates
|
||||||
|
a_h_psi(i) += hij * psi_coef(minilist(l_sd), i)
|
||||||
|
end do
|
||||||
|
end do
|
||||||
|
|
||||||
|
|
||||||
|
do i=1,Nstates
|
||||||
|
de = E0_denominator(i) - haa
|
||||||
|
if(DABS(de) < 1D-5) cycle
|
||||||
|
|
||||||
|
c_alpha = a_h_psi(i) / de
|
||||||
|
|
||||||
|
do l_sd=1,n_minilist
|
||||||
|
hdress = c_alpha * a_h_i(l_sd, iproc)
|
||||||
|
sdress = c_alpha * a_s2_i(l_sd, iproc)
|
||||||
|
delta_ij_loc(i, minilist(l_sd), 1) += hdress
|
||||||
|
delta_ij_loc(i, minilist(l_sd), 2) += sdress
|
||||||
|
end do
|
||||||
|
end do
|
||||||
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ logical, initialize_E0_denominator ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! If true, initialize pt2_E0_denominator
|
||||||
|
END_DOC
|
||||||
|
initialize_E0_denominator = .True.
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, E0_denominator, (N_states) ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! E0 in the denominator of the PT2
|
||||||
|
END_DOC
|
||||||
|
if (initialize_E0_denominator) then
|
||||||
|
E0_denominator(1:N_states) = psi_energy(1:N_states)
|
||||||
|
! call ezfio_get_full_ci_zmq_energy(pt2_E0_denominator(1))
|
||||||
|
! pt2_E0_denominator(1) -= nuclear_repulsion
|
||||||
|
! pt2_E0_denominator(1:N_states) = HF_energy - nuclear_repulsion
|
||||||
|
! pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states)
|
||||||
|
else
|
||||||
|
E0_denominator = -huge(1.d0)
|
||||||
|
endif
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
16
plugins/shiftedbk/shifted_bk_slave.irp.f
Normal file
16
plugins/shiftedbk/shifted_bk_slave.irp.f
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
program shifted_bk
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! TODO
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
|
||||||
|
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
|
||||||
|
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
|
||||||
|
PROVIDE psi_bilinear_matrix_transp_order
|
||||||
|
|
||||||
|
call diagonalize_CI()
|
||||||
|
call dress_slave()
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user