10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-04 13:13:57 +01:00
quantum_package/plugins/Full_CI_ZMQ/pt2_slave.irp.f

83 lines
2.1 KiB
Fortran
Raw Normal View History

2017-01-05 15:27:05 +01:00
program pt2_slave
implicit none
BEGIN_DOC
! Helper program to compute the PT2 in distributed mode.
END_DOC
read_wf = .False.
2017-05-17 22:49:15 +02:00
distributed_davidson = .False.
SOFT_TOUCH read_wf distributed_davidson
2017-01-05 15:27:05 +01:00
call provide_everything
call switch_qp_run_to_master
call run_wf
end
subroutine provide_everything
PROVIDE H_apply_buffer_allocated mo_bielec_integrals_in_map psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context
end
subroutine run_wf
use f77_zmq
implicit none
integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
double precision :: energy(N_states_diag)
character*(64) :: states(1)
integer :: rc, i
2017-11-29 15:15:10 +01:00
2017-11-29 13:52:52 +01:00
integer, external :: zmq_get_dvector
2017-11-29 15:15:10 +01:00
integer, external :: zmq_get_psi
2017-01-05 15:27:05 +01:00
call provide_everything
zmq_context = f77_zmq_ctx_new ()
states(1) = 'pt2'
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
do
call wait_for_states(states,zmq_state,1)
if(trim(zmq_state) == 'Stopped') then
exit
else if (trim(zmq_state) == 'pt2') then
! Selection
! ---------
print *, 'PT2'
2017-11-29 15:15:10 +01:00
if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle
2017-11-29 13:52:52 +01:00
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle
2017-05-15 12:33:41 +02:00
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
2018-05-22 17:09:12 +02:00
psi_energy(1:N_states) = energy(1:N_states)
TOUCH psi_energy
2017-05-15 12:33:41 +02:00
2017-01-05 15:27:05 +01:00
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
call pt2_slave_tcp(i, energy)
!$OMP END PARALLEL
print *, 'PT2 done'
endif
end do
end
subroutine pt2_slave_tcp(i,energy)
implicit none
double precision, intent(in) :: energy(N_states_diag)
integer, intent(in) :: i
2017-03-13 00:30:14 +01:00
logical :: lstop
lstop = .False.
call run_pt2_slave(0,i,energy,lstop)
2017-01-05 15:27:05 +01:00
end