      FUNCTION VGG(B,OMC,IG,IP)
C
C     'VGG' IS A FUNCTION WHICH EVALUATES THE CENTRIFUGAL POTENTIAL
C     FOR THE GRAVITY GRADIENT BODY.
C
      IMPLICIT REAL*8 (A-H,O-Z)
      REAL*8 IG(3,3),IP
C
      DIMENSION B(3,3),OMC(3),OC(3),OCIG(3)
C
C
      CALL MULTM(B,OMC,OC,3,1,3)
      DO 10 I=1,3
      OCIG(I)=0.0D0
      DO 10 J=1,3
   10 OCIG(I)=OCIG(I) + OC(J)*IG(J,I)
C
      OCSQR=0.0D0
      SUM=0.0D0
C
      DO 20 I=1,3
      OCSQR=OCSQR + OC(I)*OC(I)
   20 SUM=SUM + OCIG(I)*OC(I)
      VGG=(SUM - OCSQR*IP)/2
C
      RETURN
      END
