10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-05 13:43:57 +01:00
quantum_package/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f

95 lines
2.1 KiB
Fortran
Raw Normal View History

2017-05-23 19:30:51 +02:00
program prog_selection_slave
2016-11-16 14:52:12 +01:00
implicit none
BEGIN_DOC
! Helper program to compute the PT2 in distributed mode.
END_DOC
read_wf = .False.
2017-05-23 19:30:51 +02:00
distributed_davidson = .False.
SOFT_TOUCH read_wf distributed_davidson
2016-11-16 14:52:12 +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
PROVIDE pt2_e0_denominator mo_tot_num N_int
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
2016-11-16 15:18:24 +01:00
double precision :: energy(N_states)
2017-05-23 19:30:51 +02:00
character*(64) :: states(4)
2016-11-16 14:52:12 +01:00
integer :: rc, i
2017-11-29 15:15:10 +01:00
integer, external :: zmq_get_psi
2016-11-16 14:52:12 +01:00
call provide_everything
zmq_context = f77_zmq_ctx_new ()
states(1) = 'selection'
2017-05-23 19:30:51 +02:00
states(2) = 'davidson'
states(3) = 'pt2'
2016-11-16 14:52:12 +01:00
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
do
2017-05-24 15:24:51 +02:00
call wait_for_states(states,zmq_state,4)
2016-11-16 14:52:12 +01:00
if(trim(zmq_state) == 'Stopped') then
exit
else if (trim(zmq_state) == 'selection') then
! Selection
! ---------
print *, 'Selection'
2017-11-29 15:15:10 +01:00
if (zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) == -1) cycle
2016-11-16 14:52:12 +01:00
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
2017-05-23 19:30:51 +02:00
call run_selection_slave(0, i, energy)
2016-11-16 14:52:12 +01:00
!$OMP END PARALLEL
print *, 'Selection done'
2017-05-23 19:30:51 +02:00
else if (trim(zmq_state) == 'davidson') then
! Davidson
! --------
print *, 'Davidson'
2017-11-29 15:15:10 +01:00
if (zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) == -1) cycle
2017-05-23 19:30:51 +02:00
call omp_set_nested(.True.)
call davidson_slave_tcp(0)
call omp_set_nested(.False.)
print *, 'Davidson done'
else if (trim(zmq_state) == 'pt2') then
! PT2
! ---
print *, 'PT2'
2017-11-29 15:15:10 +01:00
if (zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) == -1) cycle
2017-05-23 19:30:51 +02:00
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
call run_selection_slave(0, i, energy)
!$OMP END PARALLEL
print *, 'PT2 done'
2016-11-16 14:52:12 +01:00
endif
end do
end