mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-22 20:35:19 +01:00
mrcc_zmq updated for recent changes (#57)
This commit is contained in:
parent
61d1a2b551
commit
87e00d415b
@ -925,7 +925,6 @@ end
|
|||||||
E_CI_before = mrcc_E0_denominator(1) + nuclear_repulsion
|
E_CI_before = mrcc_E0_denominator(1) + nuclear_repulsion
|
||||||
threshold_selectors = 1.d0
|
threshold_selectors = 1.d0
|
||||||
threshold_generators = 1d0
|
threshold_generators = 1d0
|
||||||
!errr = errr / 2d0
|
|
||||||
if(errr /= 0d0) then
|
if(errr /= 0d0) then
|
||||||
errr = errr / 2d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1
|
errr = errr / 2d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1
|
||||||
else
|
else
|
||||||
@ -934,7 +933,7 @@ end
|
|||||||
relative_error = errr
|
relative_error = errr
|
||||||
print *, "RELATIVE ERROR", relative_error
|
print *, "RELATIVE ERROR", relative_error
|
||||||
call ZMQ_mrcc(E_CI_before, mrcc, delta_ij_mrcc_zmq, delta_ij_s2_mrcc_zmq, abs(relative_error))
|
call ZMQ_mrcc(E_CI_before, mrcc, delta_ij_mrcc_zmq, delta_ij_s2_mrcc_zmq, abs(relative_error))
|
||||||
!errr =
|
|
||||||
mrcc_previous_E(:) = mrcc_E0_denominator(:)
|
mrcc_previous_E(:) = mrcc_E0_denominator(:)
|
||||||
do i=N_det_non_ref,1,-1
|
do i=N_det_non_ref,1,-1
|
||||||
delta_ii_mrcc_zmq(:,1) -= delta_ij_mrcc_zmq(:, i, 1) / psi_ref_coef(1,1) * psi_non_ref_coef(i, 1)
|
delta_ii_mrcc_zmq(:,1) -= delta_ij_mrcc_zmq(:, i, 1) / psi_ref_coef(1,1) * psi_non_ref_coef(i, 1)
|
||||||
@ -950,7 +949,6 @@ END_PROVIDER
|
|||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
integer :: i, j, i_state
|
integer :: i, j, i_state
|
||||||
|
|
||||||
!mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc
|
!mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc
|
||||||
if(mrmode == 4) then
|
if(mrmode == 4) then
|
||||||
do i = 1, N_det_ref
|
do i = 1, N_det_ref
|
||||||
|
@ -516,7 +516,7 @@ end
|
|||||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull
|
integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull
|
||||||
|
|
||||||
integer :: KKsize = 1000000
|
integer :: KKsize = 1000000
|
||||||
|
integer, external :: add_task_to_taskserver
|
||||||
|
|
||||||
call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'mrsc2')
|
call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'mrsc2')
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ END_PROVIDER
|
|||||||
|
|
||||||
|
|
||||||
subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
|
subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
|
||||||
use dress_types
|
!use dress_types
|
||||||
use f77_zmq
|
use f77_zmq
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
@ -24,14 +24,14 @@ subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
|
|||||||
|
|
||||||
double precision, external :: omp_get_wtime
|
double precision, external :: omp_get_wtime
|
||||||
double precision :: time
|
double precision :: time
|
||||||
double precision :: w(N_states)
|
double precision :: w!(N_states)
|
||||||
|
integer, external :: add_task_to_taskserver
|
||||||
|
|
||||||
|
|
||||||
provide nproc fragment_first fragment_count mo_bielec_integrals_in_map mo_mono_elec_integral mrcc_weight psi_selectors
|
provide nproc fragment_first fragment_count mo_bielec_integrals_in_map mo_mono_elec_integral mrcc_weight psi_selectors
|
||||||
|
|
||||||
w(:) = 0.d0
|
w = 0.d0
|
||||||
w(mrcc_stoch_istate) = 1.d0
|
w = 1.d0
|
||||||
call update_psi_average_norm_contrib(w)
|
call update_psi_average_norm_contrib(w)
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
|
|||||||
integer, external :: zmq_put_N_det_generators
|
integer, external :: zmq_put_N_det_generators
|
||||||
integer, external :: zmq_put_N_det_selectors
|
integer, external :: zmq_put_N_det_selectors
|
||||||
integer, external :: zmq_put_dvector
|
integer, external :: zmq_put_dvector
|
||||||
|
integer, external :: zmq_set_running
|
||||||
if (zmq_put_psi(zmq_to_qp_run_socket,1) == -1) then
|
if (zmq_put_psi(zmq_to_qp_run_socket,1) == -1) then
|
||||||
stop 'Unable to put psi on ZMQ server'
|
stop 'Unable to put psi on ZMQ server'
|
||||||
endif
|
endif
|
||||||
@ -98,7 +98,6 @@ subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
|
|||||||
stop 'Unable to add task to task server'
|
stop 'Unable to add task to task server'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (zmq_set_running(zmq_to_qp_run_socket) == -1) then
|
if (zmq_set_running(zmq_to_qp_run_socket) == -1) then
|
||||||
print *, irp_here, ': Failed in zmq_set_running'
|
print *, irp_here, ': Failed in zmq_set_running'
|
||||||
endif
|
endif
|
||||||
@ -107,7 +106,7 @@ subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
|
|||||||
!$OMP PRIVATE(i)
|
!$OMP PRIVATE(i)
|
||||||
i = omp_get_thread_num()
|
i = omp_get_thread_num()
|
||||||
if (i==0) then
|
if (i==0) then
|
||||||
call mrcc_collector(zmq_socket_pull,E(mrcc_stoch_istate), relative_error, delta, delta_s2, mrcc)
|
call mrcc_collector(zmq_socket_pull,E, relative_error, delta, delta_s2, mrcc)
|
||||||
|
|
||||||
else
|
else
|
||||||
call mrcc_slave_inproc(i)
|
call mrcc_slave_inproc(i)
|
||||||
@ -152,7 +151,7 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||||
|
|
||||||
integer(ZMQ_PTR), external :: new_zmq_pull_socket
|
integer(ZMQ_PTR), external :: new_zmq_pull_socket
|
||||||
integer(ZMQ_PTR) :: zmq_socket_pull
|
!integer(ZMQ_PTR) :: zmq_socket_pull
|
||||||
|
|
||||||
integer :: more
|
integer :: more
|
||||||
integer :: i, j, k, i_state, N, ntask
|
integer :: i, j, k, i_state, N, ntask
|
||||||
@ -167,6 +166,8 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
logical, allocatable :: actually_computed(:)
|
logical, allocatable :: actually_computed(:)
|
||||||
integer :: total_computed
|
integer :: total_computed
|
||||||
|
|
||||||
|
delta = 0d0
|
||||||
|
delta_s2 = 0d0
|
||||||
allocate(delta_det(N_states, N_det_non_ref, 0:comb_teeth+1, 2))
|
allocate(delta_det(N_states, N_det_non_ref, 0:comb_teeth+1, 2))
|
||||||
allocate(cp(N_states, N_det_non_ref, N_cp, 2), mrcc_detail(N_states, N_det_generators))
|
allocate(cp(N_states, N_det_non_ref, N_cp, 2), mrcc_detail(N_states, N_det_generators))
|
||||||
allocate(delta_loc(N_states, N_det_non_ref, 2))
|
allocate(delta_loc(N_states, N_det_non_ref, 2))
|
||||||
@ -191,7 +192,7 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
actually_computed = .false.
|
actually_computed = .false.
|
||||||
|
|
||||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||||
zmq_socket_pull = new_zmq_pull_socket()
|
!zmq_socket_pull = new_zmq_pull_socket()
|
||||||
allocate(task_id(N_det_generators), ind(1))
|
allocate(task_id(N_det_generators), ind(1))
|
||||||
more = 1
|
more = 1
|
||||||
if (time0 < 0.d0) then
|
if (time0 < 0.d0) then
|
||||||
@ -262,7 +263,6 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
|
|
||||||
do i=2,N_det_generators
|
do i=2,N_det_generators
|
||||||
if(.not. actually_computed(mrcc_jobs(i))) then
|
if(.not. actually_computed(mrcc_jobs(i))) then
|
||||||
print *, "first not comp", i
|
|
||||||
cur_cp = done_cp_at(i-1)
|
cur_cp = done_cp_at(i-1)
|
||||||
exit
|
exit
|
||||||
end if
|
end if
|
||||||
@ -303,7 +303,6 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
print *, irp_here, ': Error in sending abort signal (2)'
|
print *, irp_here, ': Error in sending abort signal (2)'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
if (cur_cp > old_cur_cp) then
|
if (cur_cp > old_cur_cp) then
|
||||||
old_cur_cp = cur_cp
|
old_cur_cp = cur_cp
|
||||||
@ -316,7 +315,6 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
end do pullLoop
|
end do pullLoop
|
||||||
|
|
||||||
if(total_computed == N_det_generators) then
|
if(total_computed == N_det_generators) then
|
||||||
print *, "TOTALLY COMPUTED"
|
|
||||||
delta = 0d0
|
delta = 0d0
|
||||||
delta_s2 = 0d0
|
delta_s2 = 0d0
|
||||||
do i=comb_teeth+1,0,-1
|
do i=comb_teeth+1,0,-1
|
||||||
@ -325,22 +323,17 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
end do
|
end do
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
||||||
delta = cp(:,:,cur_cp,1)
|
delta = cp(:,:,cur_cp,1)
|
||||||
delta_s2 = cp(:,:,cur_cp,2)
|
delta_s2 = cp(:,:,cur_cp,2)
|
||||||
|
|
||||||
do i=cp_first_tooth(cur_cp)-1,0,-1
|
do i=cp_first_tooth(cur_cp)-1,0,-1
|
||||||
delta += delta_det(:,:,i,1)
|
delta += delta_det(:,:,i,1)
|
||||||
delta_s2 += delta_det(:,:,i,2)
|
delta_s2 += delta_det(:,:,i,2)
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
mrcc(1) = E
|
mrcc(1) = E
|
||||||
|
|
||||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||||
|
!call end_zmq_pull_socket(zmq_socket_pull)
|
||||||
call end_zmq_pull_socket(zmq_socket_pull)
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user