From abf9073a693e27f34ee6e71c4da4a900ea165e78 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 13 Mar 2017 00:30:14 +0100 Subject: [PATCH] Fixed pt2 stoch print --- plugins/Full_CI_ZMQ/pt2_slave.irp.f | 5 +++-- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 10 +++++----- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 2 +- plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f | 8 +++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_slave.irp.f b/plugins/Full_CI_ZMQ/pt2_slave.irp.f index e45bbc51..c112e040 100644 --- a/plugins/Full_CI_ZMQ/pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_slave.irp.f @@ -63,7 +63,8 @@ subroutine pt2_slave_tcp(i,energy) implicit none double precision, intent(in) :: energy(N_states_diag) integer, intent(in) :: i - - call run_pt2_slave(0,i,energy) + logical :: lstop + lstop = .False. + call run_pt2_slave(0,i,energy,lstop) end diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 8846a321..fd9c1a72 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -27,7 +27,7 @@ subroutine ZMQ_pt2(pt2,relative_error) double precision, external :: omp_get_wtime double precision :: time0, time - allocate(pt2_detail(N_states, N_det_generators), comb(N_det_generators), computed(N_det_generators), tbc(0:size_tbc)) + allocate(pt2_detail(N_states, N_det_generators), comb(N_det_generators/2), computed(N_det_generators), tbc(0:size_tbc)) sumabove = 0d0 sum2above = 0d0 Nabove = 0d0 @@ -105,12 +105,12 @@ subroutine ZMQ_pt2(pt2,relative_error) call pt2_slave_inproc(i) endif !$OMP END PARALLEL + call end_parallel_job(zmq_to_qp_run_socket, 'pt2') else pt2(1) = sum(pt2_detail(1,:)) endif - call end_parallel_job(zmq_to_qp_run_socket, 'pt2') tbc(0) = 0 if (pt2(1) /= 0.d0) then exit @@ -270,14 +270,14 @@ subroutine pt2_collector(b, tbc, comb, Ncomb, computed, pt2_detail, sumabove, su avg = E0 + (sumabove(tooth) / Nabove(tooth)) eqt = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) time = omp_get_wtime() - print "(3(E22.13), 4(I9))", "PT2stoch ", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth) if (dabs(eqt/avg) < relative_error) then pt2(1) = avg - exit pullLoop +! exit pullLoop endif + print "(4(G22.13), 4(I9))", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth) end if end do pullLoop - print "(3(E22.13), 4(I9))", "PT2stoch ", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth) + print "(4(G22.13), 4(I9))", time - time0, avg, eqt, Nabove(tooth), tooth, first_det_of_teeth(tooth)-1, done, first_det_of_teeth(tooth+1)-first_det_of_teeth(tooth) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index 4dd4374c..452b446b 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -43,7 +43,7 @@ subroutine run_pt2_slave(thread,iproc,energy) do call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id(ctask), task) - done = task_id(ctask) == 0 + done = task_id(ctask) == 0 if (done) then ctask = ctask - 1 else diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index 61b8734e..3d10612f 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -75,15 +75,17 @@ subroutine run_wf else if (trim(zmq_state) == 'pt2') then - ! Selection - ! --------- + ! PT2 + ! --- print *, 'PT2' call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) + logical :: lstop + lstop = .False. !$OMP PARALLEL PRIVATE(i) i = omp_get_thread_num() - call run_pt2_slave(0,i,energy) + call run_pt2_slave(0,i,energy,lstop) !$OMP END PARALLEL print *, 'PT2 done'