From 832585a6ca2a006dd66fe1c13563dffffdb4a0c2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 1 Feb 2017 15:17:50 +0100 Subject: [PATCH] Acceleration of pt2_find --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 00e1893f..0cf719e5 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -284,9 +284,9 @@ integer function pt2_find(v, w, sze, imin, imax) integer :: i,l,h l = imin - h = imax-1 + h = imax - do while(h >= l) + do while(h-l > 4) i = ishft(h+l,-1) if(w(i+1) > v) then h = i-1 @@ -294,7 +294,14 @@ integer function pt2_find(v, w, sze, imin, imax) l = i+1 end if end do - pt2_find = l+1 + do i=l,h + if ( w(i) <= v) then + cycle + else + pt2_find = i-1 + return + endif + enddo end function