      SUBROUTINE XYZMOV(XDIST,YDIST,ZDIST,NGROUP,IGROUP)
      INCLUDE 'SIZES'
*  X,Y,Z CARTESIAN MOVEMENT OF ATOMS IN MOLECULE
      IMPLICIT REAL (A-H, O-Z)
      DIMENSION IGROUP(*)
      COMMON /ATOMS/ CN(3,NUMATM), IE( NUMATM), NUATOM, ATCHG( NUMATM)
      COMMON /GEOM/ CO(3, NUMATM),NA( NUMATM),NB( NUMATM),NC( NUMATM)
      LOGICAL DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      COMMON /DEBCOM/ DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      DIMENSION XDIST( NUMATM),YDIST( NUMATM),ZDIST( NUMATM)
C
      IF (DEBUG) THEN
         WRITE (*,*) 'XYZMOV: NUATOM=',NUATOM,'; NGROUP=',NGROUP
         DO 1 I=1,NUATOM
            WRITE (*,*) XDIST(I),YDIST(I),ZDIST(I)
   1     CONTINUE
      ENDIF
      IF (NGROUP.GT.0) THEN
         DO 2 IA=1,NUATOM
            CN(1,IA)=CO(1,IA)
            CN(2,IA)=CO(2,IA)
   2        CN(3,IA)=CO(3,IA)
      ENDIF
      NLIMIT=NUATOM
      IF (NGROUP.GT.0) NLIMIT=NGROUP
      DO 10 IB=1,NLIMIT
         IA=IB
         IF (NGROUP.GT.0) IA=IGROUP(IB)
         CN(1,IA)=CO(1,IA)+XDIST(IA)
         CN(2,IA)=CO(2,IA)+YDIST(IA)
  10     CN(3,IA)=CO(3,IA)+ZDIST(IA)
      RETURN
      END
