      SUBROUTINE DCHECK(RREF,RVEC,ISIZE)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DIMENSION RVEC(ISIZE),RREF(ISIZE)
      PI=DACOS(-1.D0)
      DO 55 I=6,ISIZE,3
       IF(DABS(RVEC(I)).GT.3.D0)THEN
        IF(SIGN(1.D0,RVEC(I)).NE.SIGN(1.D0,RREF(I)))
     &  RVEC(I)=SIGN(1.D0,RREF(I))*(2.D0*PI-DABS(RVEC(I)))
       ENDIF
 55   CONTINUE
      RETURN
      END
