Fix for Npart counting. The bug was causing FPE (Constantin)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Mar 2013 14:05:34 +0000 (14:05 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Mar 2013 14:05:34 +0000 (14:05 +0000)
HIJING/hijing1_36/hijing.F

index 0040018..07db9ce 100644 (file)
@@ -431,32 +431,34 @@ c *** cl glauber ***
  1140         continue
  1130      continue
 
-           xmeana=xmeana/IHNT2(1)
-           ymeana=ymeana/IHNT2(1)
-           xmeanb=xmeanb/IHNT2(3)
-           ymeanb=ymeanb/IHNT2(3)
-           xmeanp=xmeanp/npart
-           ymeanp=ymeanp/npart
-           xm2=xm2/npart
-           ym2=ym2/npart
-           xym=xym/npart
+           IF (npart.GT.0) THEN
+              xmeana=xmeana/IHNT2(1)
+              ymeana=ymeana/IHNT2(1)
+              xmeanb=xmeanb/IHNT2(3)
+              ymeanb=ymeanb/IHNT2(3)
+              xmeanp=xmeanp/npart
+              ymeanp=ymeanp/npart
+              xm2=xm2/npart
+              ym2=ym2/npart
+              xym=xym/npart
 
-           sx2=xm2-xmeanp*xmeanp
-           sy2=ym2-ymeanp*ymeanp
-           sxy=xym-xmeanp*ymeanp
+              sx2=xm2-xmeanp*xmeanp
+              sy2=ym2-ymeanp*ymeanp
+              sxy=xym-xmeanp*ymeanp
            
-           delx=xmeanb-xmeana
-           dely=ymeanb-ymeana
-           dtmp=delx**2+dely**2
-           bbtrue=sqrt(dtmp)
-           dnumt=(sy2-sx2)*(delx**2-dely**2)-4D0*sxy*delx*dely
-           ddent=(sy2+sx2)*bbtrue**2
-           eccrp=dnumt/ddent
-           dtmp=(sy2-sx2)*(sy2-sx2)+4D0*sxy*sxy
-           eccpart=sqrt(dtmp)/(sx2+sy2)
-           eccmc=(sy2-sx2)/(sy2+sx2)
-           write(*,*),'HOUT: ',bb,' ',bbtrue,' ',ncolt,' ',npart,
-     1          ' ',eccrp,' ',eccpart
+              delx=xmeanb-xmeana
+              dely=ymeanb-ymeana
+              dtmp=delx**2+dely**2
+              bbtrue=sqrt(dtmp)
+              dnumt=(sy2-sx2)*(delx**2-dely**2)-4D0*sxy*delx*dely
+              ddent=(sy2+sx2)*bbtrue**2
+              eccrp=dnumt/ddent
+              dtmp=(sy2-sx2)*(sy2-sx2)+4D0*sxy*sxy
+              eccpart=sqrt(dtmp)/(sx2+sy2)
+              eccmc=(sy2-sx2)/(sy2+sx2)
+              write(*,*),'HOUT: ',bb,' ',bbtrue,' ',ncolt,' ',npart,
+     1             ' ',eccrp,' ',eccpart
+           end if
         end if
 
 C              ********total number interactions proj and targ has