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
annealing.
!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
else
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.
John
Received on Wed Apr 05 2006 - 23:49:35 PDT