10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-07 06:33:38 +01:00
qmcchem/src/ZMQ/utils.irp.f

56 lines
1.4 KiB
Forth

use f77_zmq
subroutine get_elec_coord_full(elec_coord_full_out,lda)
implicit none
integer, intent(in) :: lda
real, intent(out) :: elec_coord_full_out(lda,3,walk_num)
integer :: rc
integer :: i,j,k,l
character*(16) :: n
rc = f77_zmq_send(zmq_to_dataserver_socket, 'get_walkers', 11, ZMQ_SNDMORE)
write(n,*) walk_num
n = trim(n)
rc = f77_zmq_send(zmq_to_dataserver_socket, n, len(n), 0)
call worker_log(irp_here, 'Requesting walkers')
integer(ZMQ_PTR) :: msg
character*(32) :: buffer
integer :: sze
msg = f77_zmq_msg_new()
sze = 0
do k=1,walk_num
do j=1,3
do i=1,elec_num+1
rc = f77_zmq_msg_init(msg)
rc = -1
do l=1,2*block_time
rc = f77_zmq_msg_recv(msg,zmq_to_dataserver_socket,ZMQ_NOBLOCK)
if (rc > 0) then
exit
endif
if (l==2*block_time) then
call abrt(irp_here, 'Unable to get walkers')
endif
call sleep(1)
enddo
sze += rc
rc = f77_zmq_msg_copy_from_data(msg, buffer)
rc = f77_zmq_msg_close(msg)
buffer = trim(adjustl(buffer))
read(buffer, '(F20.14)') elec_coord_full_out(i,j,k)
enddo
enddo
enddo
call worker_log(irp_here, 'Walkers received')
rc = f77_zmq_msg_destroy(msg)
end