[AMBER-Developers] Patch for sander hang with missing box

From: Tom Joseph <ttjoseph.gmail.com>
Date: Fri, 14 Aug 2009 22:56:29 +0100

AMBER 10 sander hangs when box information is expected but not present
in the inpcrd file. I've attached sample input that reproduces this
problem. Admittedly it's not necessarily the most common mistake but I
think an error message would be nice.

peek_ewald_inpcrd() in ew_setup.f returns zeros for a, b, c if they
are not found. This leads to check_prime_factors() being called with
n=0, which causes it to loop infinitely. Below are a couple of patches
that fix this. The first gives an error message before the infinite
loop, and the second fixes the infinite loop itself.

Thanks,
--Tom

--- orig/src/sander/ew_setup.f 2008-04-16 21:34:52.000000000 -0400
+++ new/src/sander/ew_setup.f 2009-08-14 17:39:41.000000000 -0400
.. -974,6 +974,11 ..
       call peek_ewald_inpcrd(inpcrd,ax,bx,cx,alphax,betax,gammax)
       end if

+ if ( a == 0.0d0 .and. b == 0.0d0 .and. c == 0.0d0) then
+ call sander_bomb('load_ewald_info', &
+ 'Box information expected but not found', '')
+ end if
+
    end if
    call read_ewald(ax,bx,cx,alphax,betax,gammax)

--- orig/src/sander/ew_setup.f 2008-04-16 21:34:52.000000000 -0400
+++ new/src/sander/ew_setup.f 2009-08-14 17:45:39.000000000 -0400
.. -268,6 +268,8 ..
    ! this routine checks n to see if its a product of powers of 2,3,5
    ! essential for FFTs
    ! result is 1 of it is such a product, 0 if not
+
+ if (n == 0) return 0

    ! don't hurt n
    nl = n

Received on Wed Aug 19 2009 - 22:33:26 PDT
Custom Search