symba5_nbodm.f 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. c*************************************************************************
  2. c SYMBA5_NBODM.F
  3. c*************************************************************************
  4. c Returns the location of the last massive body in the list
  5. c
  6. c Input:
  7. c nbod ==> number of massive bodies (int scalar)
  8. c mass ==> mass of bodies (real array)
  9. c mtiny ==> Small mass (real array)
  10. c Output:
  11. c nbodm ==> location of the last massive body
  12. c (int scalar)
  13. c
  14. c Remarks: If all the objects are massive, then nbodm=nbod-1 so that
  15. c the do loops will have the correct limits.
  16. c Authors: Hal Levison
  17. c Date: 3/20/97
  18. c Last revision: 1/29/06
  19. subroutine symba5_nbodm(nbod,mass,mtiny,nbodm)
  20. include '../swift.inc'
  21. include 'symba5.inc'
  22. c... Inputs Only:
  23. integer nbod
  24. real*8 mass(nbod),mtiny
  25. c... Outputs only
  26. integer nbodm
  27. c... Internals
  28. integer i
  29. c----
  30. c... Executable code
  31. if(mass(nbod).gt.mtiny) then
  32. nbodm = nbod - 1
  33. write(*,*) ' Of ',nbod,' objects, all are massive. '
  34. else
  35. nbodm = 1
  36. do i=1,nbod-1
  37. if(mass(i).gt.mtiny) then
  38. nbodm = i
  39. endif
  40. enddo
  41. write(*,*) ' Of ',nbod,' objects, ',nbodm,' are massive. '
  42. endif
  43. return
  44. end ! symba5_nbodm.f
  45. c--------------------------------------------------------