      SUBROUTINE XYZMND( NATOMS, CARIN, NAIN, NBIN, NCIN, CINTR)
* CONVERT CARTESIAN TO INTERNAL
      INCLUDE 'SIZES'
      IMPLICIT REAL (A-H,O-Z)
      DIMENSION CARIN( 3, NATOMS), NAIN( NATOMS), NBIN( NATOMS)
      DIMENSION NCIN( NATOMS), CINTR( 3, NATOMS)
*
      ATDIST( I, J) = SQRT(( CARIN(1,I) - CARIN(1,J))**2+
     .          ( CARIN(2,I) - CARIN(2,J))**2+
     .          ( CARIN(3,I) - CARIN(3,J))**2)
C
      IF ( NATOMS .LT. 1) RETURN
C
      CINTR(1,1)=0.0D0
      CINTR(2,1)=0.0D0
      CINTR(3,1)=0.0D0
C
      IF ( NATOMS .LT. 2) RETURN
      CINTR( 1, 2) = ATDIST( 1, 2)
      CINTR(2,2)=0.0D0
      CINTR(3,2)=0.0D0
C
      IF ( NATOMS .LT. 3 ) RETURN
      I=3
      J=NAIN(3)
      K=NBIN(3)
      L=NCIN(3)
      CALL BANGLE(3,J,K,ANG1,CARIN)
      CINTR( 1, 3) = ATDIST( I, J )
      CINTR(2,3)=ANG1
      CINTR(3,3)=0.0D0
C
      DO 10 I=4,NATOMS
C?         IF ( IE( I) .EQ. 200 ) GOTO 10
         J=NAIN(I)
         K=NBIN(I)
         L=NCIN(I)
         DIST = ATDIST( I, J)
         CALL BANGLE(I,J,K,ANG1,CARIN)
         CALL DIHED(I,J,K,L,ANG2,CARIN)
         IF ( ANG2 .GT. 360.0D0 ) ANG2 = ANG2 - 360.0D0
         IF ( ANG2 .GT. 180.0D0 ) ANG2 = ANG2 - 360.0D0
         CINTR(1,I)=DIST
         CINTR(2,I)=ANG1
         CINTR(3,I)=ANG2
 10   CONTINUE
      RETURN
      END
