9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-13 16:15:18 +02:00

pass is_complex as argument to pt2_type_size

This commit is contained in:
Kevin Gasperich 2020-09-11 11:31:45 -05:00
parent d705956969
commit 43c7696001
6 changed files with 20 additions and 18 deletions

View File

@ -266,8 +266,8 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
mem_collector = 8.d0 * & ! bytes
( 1.d0*pt2_n_tasks_max & ! task_id, index
+ 0.635d0*N_det_generators & ! f,d
+ pt2_n_tasks_max*pt2_type_size(N_states) & ! pt2_data_task
+ N_det_generators*pt2_type_size(N_states) & ! pt2_data_I
+ pt2_n_tasks_max*pt2_type_size(N_states,is_complex) & ! pt2_data_task
+ N_det_generators*pt2_type_size(N_states,is_complex) & ! pt2_data_I
+ 4.d0*(pt2_N_teeth+1) & ! S, S2, T2, T3
+ 1.d0*(N_int*2.d0*N + N) & ! selection buffer
+ 1.d0*(N_int*2.d0*N + N) & ! sort selection buffer
@ -282,7 +282,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
nproc_target * 8.d0 * & ! bytes
( 0.5d0*pt2_n_tasks_max & ! task_id
+ 64.d0*pt2_n_tasks_max & ! task
+ pt2_type_size(N_states)*pt2_n_tasks_max*N_states & ! pt2, variance, overlap
+ pt2_type_size(N_states,is_complex)*pt2_n_tasks_max*N_states & ! pt2, variance, overlap
+ 1.d0*pt2_n_tasks_max & ! i_generator, subset
+ 1.d0*(N_int*2.d0*ii+ ii) & ! selection buffer
+ 1.d0*(N_int*2.d0*ii+ ii) & ! sort selection buffer

View File

@ -339,7 +339,7 @@ subroutine push_pt2_results_async_send(zmq_socket_push, index, pt2_data, b, task
endif
allocate(pt2_serialized (pt2_type_size(N_states),n_tasks) )
allocate(pt2_serialized (pt2_type_size(N_states,is_complex),n_tasks) )
do i=1,n_tasks
call pt2_serialize(pt2_data(i),N_states,pt2_serialized(1,i))
enddo
@ -480,7 +480,7 @@ subroutine pull_pt2_results(zmq_socket_pull, index, pt2_data, task_id, n_tasks,
stop 'pull'
endif
allocate(pt2_serialized (pt2_type_size(N_states),n_tasks) )
allocate(pt2_serialized (pt2_type_size(N_states,is_complex),n_tasks) )
rc = f77_zmq_recv( zmq_socket_pull, pt2_serialized, 8*size(pt2_serialized)*n_tasks, 0)
if (rc == -1) then
n_tasks = 1

View File

@ -145,7 +145,7 @@ subroutine push_selection_results(zmq_socket_push, pt2_data, b, task_id, ntasks)
endif
allocate(pt2_serialized (pt2_type_size(N_states)) )
allocate(pt2_serialized (pt2_type_size(N_states,is_complex)) )
call pt2_serialize(pt2_data,N_states,pt2_serialized)
rc = f77_zmq_send( zmq_socket_push, pt2_serialized, size(pt2_serialized)*8, ZMQ_SNDMORE)
@ -213,7 +213,7 @@ subroutine pull_selection_results(zmq_socket_pull, pt2_data, val, det, N, task_i
print *, 'f77_zmq_recv( zmq_socket_pull, N, 4, 0)'
endif
allocate(pt2_serialized (pt2_type_size(N_states)) )
allocate(pt2_serialized (pt2_type_size(N_states,is_complex)) )
rc = f77_zmq_recv( zmq_socket_pull, pt2_serialized, 8*size(pt2_serialized), 0)
if (rc == -1) then
ntasks = 1

View File

@ -2096,7 +2096,7 @@ subroutine fill_buffer_double_complex(i_generator, sp, h1, h2, bannedOrb, banned
logical, intent(in) :: bannedOrb(mo_num, 2), banned(mo_num, mo_num)
double precision, intent(in) :: fock_diag_tmp(mo_num)
double precision, intent(in) :: E0(N_states)
type(pt2_type), intent(inout) :: pt2_date
type(pt2_type), intent(inout) :: pt2_data
type(selection_buffer), intent(inout) :: buf
logical :: ok
integer :: s1, s2, p1, p2, ib, j, istate, jstate
@ -2209,7 +2209,7 @@ subroutine fill_buffer_double_complex(i_generator, sp, h1, h2, bannedOrb, banned
e_pert(istate) = 0.5d0 * (tmp - delta_E)
!TODO: check conjugate for coef
if (cdabs(alpha_h_psi) > 1.d-4) then
coef(istate) = e_pert / alpha_h_psi
coef(istate) = e_pert(istate) / alpha_h_psi
else
coef(istate) = alpha_h_psi / delta_E
endif

View File

@ -11,14 +11,23 @@ module selection_types
double precision, allocatable :: rpt2(:)
double precision, allocatable :: variance(:)
double precision, allocatable :: overlap(:,:)
double precision, allocatable :: overlap_imag(:,:)
endtype
contains
integer function pt2_type_size(N)
integer function pt2_type_size(N,has_imag)
implicit none
integer, intent(in) :: N
if (is_complex) then
logical, intent(in), optional :: has_imag
logical :: has_imag_tmp
if(present(has_imag)) then
has_imag_tmp = has_imag
else
has_imag_tmp = .False.
endif
if (has_imag_tmp) then
pt2_type_size = (3*n + 2*n*n)
else
pt2_type_size = (3*n + n*n)

View File

@ -105,12 +105,6 @@ subroutine ZMQ_selection(N_in, pt2_data)
f(:) = 1.d0
if (.not.do_pt2) then
<<<<<<< HEAD
double precision :: f(N_states), u_dot_u
do k=1,min(N_det,N_states)
f(k) = 1.d0 / u_dot_u(psi_selectors_coef(1,k), N_det_selectors)
enddo
=======
double precision :: f(N_states), u_dot_u
if (is_complex) then
double precision :: u_dot_u_complex
@ -122,7 +116,6 @@ subroutine ZMQ_selection(N_in, pt2_data)
f(k) = 1.d0 / u_dot_u(psi_selectors_coef(1,k), N_det_selectors)
enddo
endif
>>>>>>> origin/cleaning_kpts
endif
!$OMP PARALLEL DEFAULT(shared) SHARED(b, pt2_data) PRIVATE(i) NUM_THREADS(nproc_target+1)