amber-developers: qmmm2/neb_gb ; ./Run.neb_link_atoms_qmgb2 crash on Sun

From: John Mongan <>
Date: Mon, 27 Mar 2006 14:34:29 -0700

Divide by zero exception in this function:

subroutine normalize(vector,dim)
    !normalize a vector of components of a dim dimensional vector
    !Very small vectors need to be considered zero for simulated
    !These are trapped below and not normalized.
    implicit none
     _REAL_ vector(*),vlength
     integer dim, i

    vlength = 0.d0
    do i = 1, dim
       vlength = vlength + vector(i)*vector(i)
    end do
    vlength = 1.0d0/sqrt(vlength) !DIVIDE BY ZERO
    if (vlength<1000.0d0) then
       vector(1:dim) = vector(1:dim)*vlength
       vector(1:dim) = 0.d0
    end if

end subroutine normalize

at line 140 of pimd_force.f

You get a divide by zero when all the components of vector are == 0.
Again, not sure why we're not seeing this on other platforms.

I'll leave it to people more familiar with this part of the code to
determine whether the bug is that normalize can't handle the zero vector
or that the zero vector should never have been passed to normalize.

Received on Wed Apr 05 2006 - 23:49:35 PDT
Custom Search