        PROGRAM centermass
      Integer NDIM,L,N3
      PARAMETER(NDIM=486,L=7,N3=162)
      REAL*8 X(NDIM)
      REAL*8 xm,ym,zm,gesmass,xyzmass(N3)
      Integer N,I,J,JJ,LA,Lha,Lnum,Natoms(N3) 
      Data Natoms/6,6,7,6,6,8,6,7,6,6,8,6,7,6,6,8,
     * 6,7,6,6,8,6,7,6,6,8,6,7,6,6,8,6,
     * 7,6,6,8,6,7,6,6,8,6,7,6,6,8,6,7,
     * 6,6,8,6,7,6,6,8,6,7,6,6,8,6,7,6,
     * 6,8,6,7,6,6,8,6,7,6,6,8,6,7,6,8,
     * 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     * 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     * 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     * 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     * 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     * 1,1/
       OPEN(13,FILE='palapoint.dat') 
       OPEN(55,FILE='palapointmwg.dat') 
       OPEN(56,FILE='palapointmw.dat')

       N=NDIM 
       rewind 13
       READ(13,*)(X(I),I=1,N)

       do 43,I=1,N/3
43     xyzmass(I)=1.0d0
c ccc                   *Natoms(I)*2.0d0

        xm=0.0d0
        ym=0.0d0
        zm=0.0d0
       gesmass=N/3
       do 44,I=1,N/3
           JJ=3*(I-1)
         xm= xm + X(JJ+1) *xyzmass(I)/ gesmass
         ym= ym + X(JJ+2) *xyzmass(I)/ gesmass
         zm= zm + X(JJ+3) *xyzmass(I)/ gesmass
44     continue
       write(6,*) 'old center of mass:  ( ', xm, ym, zm, '  )'
       do 45,I=1,N/3
           JJ=3*(I-1)
         X(JJ+1)=-xm + X(JJ+1)
         X(JJ+2)=-ym + X(JJ+2)
         X(JJ+3)=-zm + X(JJ+3)
45      continue
        write(6,*) ' new point X '
        do 4447, J=1,N3
        write(56,*)' ',      (X(3*(J-1)+I),I=1,3)
4447    write(55,*)Natoms(J),(X(3*(J-1)+I),I=1,3)
        write(55,*) ' ' 
          STOP
          END
