Protect sqrt of negative number
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 11 May 2001 16:37:42 +0000 (16:37 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 11 May 2001 16:37:42 +0000 (16:37 +0000)
HIJING/hijing1_36/attrad.F

index 6fdc61b..8654762 100644 (file)
@@ -62,7 +62,7 @@ C.....BOOST TO REST SYSTEM FOR PARTICLES JL AND JL+1.....
        CALL ATROBO(0.,0.,BEX,BEY,BEZ,IMIN,IMAX,IERROR)
        IF(IERROR.NE.0) RETURN
 C.....ROTATE TO Z-AXIS....
-       CTH=P(JL,3)/SQRT(P(JL,4)**2-P(JL,5)**2)
+       CTH=P(JL,3)/SQRT(MAX(0,P(JL,4)**2-P(JL,5)**2))
        IF(ABS(CTH).GT.1.0)  CTH=MAX(-1.,MIN(1.,CTH))
        THETA=ACOS(CTH)
        PHI=ULANGL_HIJING(P(JL,1),P(JL,2))