







C







C


C

C


C


C


C


C

C


C


C


C


C


C


C


C

C


C


C


C


C


C


C
      SUBROUTINE DRW001 (IAT,JAT)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'SOLIDS.INC'
      INTEGER       IAT, JAT, IERR
      LOGICAL       CAN_DRAW







      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 998



      IF (CAN_DRAW(IAT,JAT)) THEN
         IF (ISOLID) THEN
            CALL DRW002 (IAT,JAT)
            CALL DRW002 (JAT,IAT)
            IF (.NOT.SOLDON(IAT)) THEN
               CALL GRA251 (IAT,IERR)
               SOLDON(IAT)=.TRUE.
            END IF
            IF (.NOT.SOLDON(JAT)) THEN
               CALL GRA251 (JAT,IERR)
               SOLDON(JAT)=.TRUE.
            END IF
         ELSE
            CALL DRW060 (IAT,JAT)
         END IF
      END IF



 998  CONTINUE


      RETURN
      END   
      SUBROUTINE DRW002 (IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAT
      LOGICAL       CAN_DRAW







      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 998



      IF (CAN_DRAW(IAT,JAT)) THEN
         CALL DRW061 (IAT,JAT)
      END IF



 998  CONTINUE


      RETURN
      END   
      SUBROUTINE DRW003 (IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'SOLIDS.INC'
      INTEGER       IAT, JAT
      LOGICAL       CAN_DRAW







      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 998




      IF (CAN_DRAW(IAT,JAT)) THEN
         IF (ISOLID) THEN
            CALL DRW061 (IAT,JAT)
            CALL DRW061 (JAT,IAT)
         ELSE
            CALL DRW004 (IAT,JAT)
            CALL DRW004 (JAT,IAT)
         END IF
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE DRW004 (IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INCLUDE       'VECTOR.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IAT, JAT, I, J, IS10



      REAL          ENDN(3), ENDC(3), RMAT(3,3), ANGLE, CVEC(3),
     +              N18(3,19), C18(3,19), POLYG(2,18), GVFDTR
      LOGICAL       CAN_DRAW
      EQUIVALENCE   (N18(1,1),ESPACE(2001))
      EQUIVALENCE   (C18(1,1),ESPACE(4001))
      EQUIVALENCE   (POLYG(1,1),ESPACE(6001))







      CALL ESPSET (2001,6000+2*18,18)



      IF (.NOT.CAN_DRAW(IAT,JAT)) GOTO 997
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 997



      ENDN(1)=XCOORD(IAT)
      ENDN(2)=YCOORD(IAT)
      ENDN(3)=ZCOORD(IAT)
      ENDC(1)=(XCOORD(IAT)+XCOORD(JAT))/2.0
      ENDC(2)=(YCOORD(IAT)+YCOORD(JAT))/2.0
      ENDC(3)=(ZCOORD(IAT)+ZCOORD(JAT))/2.0










      IS10=10
      IF (SCVAL.LT.0.2) IS10=4
      CALL GVSTV3 (CVEC,ENDC,ENDN)
      CALL GVSVXC (CVEC,0.25,3)
      CALL GVSCP3 (CV,ENDN,ENDC)
      CALL GVSNM3 (CV)
      CALL GVSVXC (CV,FLOAT(WIFPAR(93))/100.0,3)



      DO 10 I=1,IS10



         ANGLE=GVFDTR(360.0/FLOAT(IS10))*FLOAT(I)
         CALL GVSMGM (RMAT,CVEC,ANGLE)
         CALL GVSMV3 (N18(1,I),RMAT,CV)
   10 CONTINUE



      DO 30 I=1,IS10
         CALL GVSCPR (XYZ,N18(1,I),3)




         NUMGRV=NUMGRV+1
         CALL GVSCPR (XMOL(1,NUMGRV),ENDN,3)
         CALL GVSCPR (YMOL(1,NUMGRV),ENDN,3)
         CALL GVSAV3 (YMOL(1,NUMGRV),XYZ)
         HUEVAL(NUMGRV)=ATCOLR(IAT)



         DO 20 J=1,4
            NUMGRV=NUMGRV+1
            CALL GVSCPR (XMOL(1,NUMGRV),YMOL(1,NUMGRV-1),3)
            CALL GVSBV3 (YMOL(1,NUMGRV),XMOL(1,NUMGRV),CVEC)
            IF (J.LE.2) THEN
               HUEVAL(NUMGRV)=ATCOLR(IAT)
            ELSE
               HUEVAL(NUMGRV)=ATCOLR(JAT)
            END IF
   20    CONTINUE



         NUMGRV=NUMGRV+1
         CALL GVSCPR (XMOL(1,NUMGRV),YMOL(1,NUMGRV-1),3)
         CALL GVSCPR (YMOL(1,NUMGRV),ENDC,3)
         HUEVAL(NUMGRV)=ATCOLR(JAT)



         CALL GVSCPR (C18(1,I),XMOL(1,NUMGRV),3)
         IF (.NOT.USE300) CALL GRTVIN
         CALL GRASAVE
   30 CONTINUE



 997  CONTINUE


      RETURN
      END
      SUBROUTINE DRW005 (IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAT
      LOGICAL       CAN_DRAW







      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 998



      IF (CAN_DRAW(IAT,JAT)) THEN
         CALL DRW006 (IAT,JAT)
         CALL DRW006 (JAT,IAT)
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE DRW006 (IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INCLUDE       'VECTOR.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IAT, JAT, IERR



      REAL          ENDN(3), ENDC(3)
      LOGICAL       CAN_DRAW








      IF (.NOT.CAN_DRAW(IAT,JAT)) GOTO 998
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 998



      ENDN(1)=XCOORD(IAT)
      ENDN(2)=YCOORD(IAT)
      ENDN(3)=ZCOORD(IAT)
      ENDC(1)=(XCOORD(IAT)+XCOORD(JAT))/2.0
      ENDC(2)=(YCOORD(IAT)+YCOORD(JAT))/2.0
      ENDC(3)=(ZCOORD(IAT)+ZCOORD(JAT))/2.0







      CALL GRTLIN (ENDN(1),ENDN(2),ENDN(3),ENDC(1),ENDC(2),
     + ENDC(3),ATCOLR(IAT),IERR)



 998  CONTINUE


      RETURN
      END
      SUBROUTINE DRW041 (IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INCLUDE       'VECTOR.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IAT, JAT, I, J, IS10
      REAL          ENDN(3), ENDC(3), RMAT(3,3), ANGLE, CVEC(3),
     +              N18(3,19), C18(3,19), POLYG(2,18), GVFDTR
      LOGICAL       CAN_DRAW
      EQUIVALENCE   (N18(1,1),ESPACE(2001))
      EQUIVALENCE   (C18(1,1),ESPACE(4001))
      EQUIVALENCE   (POLYG(1,1),ESPACE(6001))







      CALL ESPSET (2001,6000+2*18,18)



      IF (.NOT.CAN_DRAW(IAT,JAT)) GOTO 997






      IS10=10
      IF (SCVAL.LT.0.2) IS10=4
      CALL GVSTV3 (CVEC,ENDC,ENDN)
      CALL GVSVXC (CVEC,0.25,3)
      CALL GVSCP3 (CV,ENDN,ENDC)
      CALL GVSNM3 (CV)
      CALL GVSVXC (CV,FLOAT(WIFPAR(93))/100.0,3)



      DO 10 I=1,IS10



         ANGLE=GVFDTR(360.0/FLOAT(IS10))*FLOAT(I)
         CALL GVSMGM (RMAT,CVEC,ANGLE)
         CALL GVSMV3 (N18(1,I),RMAT,CV)
   10 CONTINUE



      DO 30 I=1,IS10
         CALL GVSCPR (XYZ,N18(1,I),3)




         NUMGRV=NUMGRV+1
         CALL GVSCPR (XMOL(1,NUMGRV),ENDN,3)
         CALL GVSCPR (YMOL(1,NUMGRV),ENDN,3)
         CALL GVSAV3 (YMOL(1,NUMGRV),XYZ)
         HUEVAL(NUMGRV)=ATCOLR(IAT)



         DO 20 J=1,4
            NUMGRV=NUMGRV+1
            CALL GVSCPR (XMOL(1,NUMGRV),YMOL(1,NUMGRV-1),3)
            CALL GVSBV3 (YMOL(1,NUMGRV),XMOL(1,NUMGRV),CVEC)
            IF (J.LE.2) THEN
               HUEVAL(NUMGRV)=ATCOLR(IAT)
            ELSE
               HUEVAL(NUMGRV)=ATCOLR(JAT)
            END IF
   20    CONTINUE



         NUMGRV=NUMGRV+1
         CALL GVSCPR (XMOL(1,NUMGRV),YMOL(1,NUMGRV-1),3)
         CALL GVSCPR (YMOL(1,NUMGRV),ENDC,3)
         HUEVAL(NUMGRV)=ATCOLR(JAT)



         CALL GVSCPR (C18(1,I),XMOL(1,NUMGRV),3)
         IF (.NOT.USE300) CALL GRTVIN
         CALL GRASAVE
   30 CONTINUE



 997  CONTINUE


      RETURN
      END
      SUBROUTINE DRW051 (IAT1,IAT2,ISTEP)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT1, IAT2, ISTEP, IERR
      REAL          V1(3), V2(3)
      LOGICAL       CAN_DRAW







      IF (IAT1.EQ.IAT2) THEN
         IF (WIFPAR(1012).EQ.1) CALL GVSTTB ('?NEWB31')
         GOTO 998
      END IF
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1).OR.PROTON(IAT2))) GOTO 998
      IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



      V1(1)=XCOORD(IAT1)
      V1(2)=YCOORD(IAT1)
      V1(3)=ZCOORD(IAT1)
      V2(1)=XCOORD(IAT2)
      V2(2)=YCOORD(IAT2)
      V2(3)=ZCOORD(IAT2)



      IF (ATCOLR(IAT1).EQ.ATCOLR(IAT2)) THEN
         CALL GRTDSH (V1(1),V1(2),V1(3),V2(1),V2(2),V2(3),
     +    ATCOLR(IAT1),ISTEP,IERR)
      ELSE
         CALL GRT_H_DSH (V1,V2,ATCOLR(IAT1),ISTEP)
         CALL GRT_H_DSH (V2,V1,ATCOLR(IAT2),ISTEP)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE DRW052 (IAT1,IAT2,ISTEP,VECT)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT1, IAT2, ISTEP, IERR
      REAL          V1(3),V2(3), VECT(3)
      LOGICAL       CAN_DRAW







      IF (IAT1.EQ.IAT2) THEN
         IF (WIFPAR(1012).EQ.1) CALL GVSTTB ('?NEWB32')
         GOTO 998
      END IF
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1).OR.PROTON(IAT2))) GOTO 998
      IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



      V1(1)=XCOORD(IAT1)+VECT(1)
      V1(2)=YCOORD(IAT1)+VECT(2)
      V1(3)=ZCOORD(IAT1)+VECT(3)
      V2(1)=XCOORD(IAT2)+VECT(1)
      V2(2)=YCOORD(IAT2)+VECT(2)
      V2(3)=ZCOORD(IAT2)+VECT(3)



      IF (ATCOLR(IAT1).EQ.ATCOLR(IAT2)) THEN
         CALL GRTDSH (V1(1),V1(2),V1(3),V2(1),V2(2),V2(3),
     +    ATCOLR(IAT1),ISTEP,IERR)
      ELSE
         CALL GRT_H_DSH (V1,V2,ATCOLR(IAT1),ISTEP)
         CALL GRT_H_DSH (V2,V1,ATCOLR(IAT2),ISTEP)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE DRW053 (IAT1,IAT2,ISTEP,VECT)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT1, IAT2, ISTEP
      REAL          V1(3),V2(3), VECT(3)
      LOGICAL       CAN_DRAW







      IF (IAT1.EQ.IAT2) THEN
         IF (WIFPAR(1012).EQ.1) CALL GVSTTB ('?NEWB33')
         GOTO 998
      END IF
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1).OR.PROTON(IAT2))) GOTO 998
      IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



      V1(1)=XCOORD(IAT1)+VECT(1)
      V1(2)=YCOORD(IAT1)+VECT(2)
      V1(3)=ZCOORD(IAT1)+VECT(3)
      V2(1)=XCOORD(IAT2)+VECT(1)
      V2(2)=YCOORD(IAT2)+VECT(2)
      V2(3)=ZCOORD(IAT2)+VECT(3)



      CALL GRT_H_DSH (V1,V2,ATCOLR(IAT1),ISTEP)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE DRW054 (IAT1,IAT2,ISTEP,ICOL)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT1, IAT2, ISTEP, LOCSTP, IVEC, IERR, ICOL
      REAL          MID(3), VECTOR(3)
      LOGICAL       CAN_DRAW







      IF (IAT1.EQ.IAT2) GOTO 998
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1).OR.PROTON(IAT2))) GOTO 998
      IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



      LOCSTP=ISTEP+1-MOD(ISTEP,4)



      MID(1)=(XCOORD(IAT1)+XCOORD(IAT2))/2.0
      MID(2)=(YCOORD(IAT1)+YCOORD(IAT2))/2.0
      MID(3)=(ZCOORD(IAT1)+ZCOORD(IAT2))/2.0
      VECTOR(1)=(XCOORD(IAT2)-XCOORD(IAT1))/FLOAT(LOCSTP)
      VECTOR(2)=(YCOORD(IAT2)-YCOORD(IAT1))/FLOAT(LOCSTP)
      VECTOR(3)=(ZCOORD(IAT2)-ZCOORD(IAT1))/FLOAT(LOCSTP)



      DO 20 IVEC=1,LOCSTP/2,2
         CALL GRTLIN (XCOORD(IAT1)+(IVEC-1)*VECTOR(1),
     +    YCOORD(IAT1)+(IVEC-1)*VECTOR(2),
     +    ZCOORD(IAT1)+(IVEC-1)*VECTOR(3),
     +    XCOORD(IAT1)+IVEC*VECTOR(1),
     +    YCOORD(IAT1)+IVEC*VECTOR(2),
     +    ZCOORD(IAT1)+IVEC*VECTOR(3),ICOL,IERR)
         CALL GRTLIN (XCOORD(IAT2)-(IVEC-1)*VECTOR(1),
     +    YCOORD(IAT2)-(IVEC-1)*VECTOR(2),
     +    ZCOORD(IAT2)-(IVEC-1)*VECTOR(3),
     +    XCOORD(IAT2)-IVEC*VECTOR(1),
     +    YCOORD(IAT2)-IVEC*VECTOR(2),
     +    ZCOORD(IAT2)-IVEC*VECTOR(3),ICOL,IERR)
   20 CONTINUE



      CALL GRTLIN (MID(1)-0.5*VECTOR(1),MID(2)-0.5*VECTOR(2),
     + MID(3)-0.5*VECTOR(3),MID(1),MID(2),MID(3),ICOL,IERR)



      CALL GRTLIN (MID(1)+0.5*VECTOR(1),MID(2)+0.5*VECTOR(2),
     + MID(3)+0.5*VECTOR(3),MID(1),MID(2),MID(3),ICOL,IERR)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE DRW057 (IAT,XYZTO)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'VECTOR.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IAT, I, J, IS10
      REAL          ENDN(3), ENDC(3), RMAT(3,3), ANGLE, CVEC(3),
     +              N10(3,11), C10(3,11), POLYG(2,10), 
     +              GVFDTR, XYZTO(3)
      EQUIVALENCE   (N10(1,1),ESPACE(2001))
      EQUIVALENCE   (C10(1,1),ESPACE(4001))
      EQUIVALENCE   (POLYG(1,1),ESPACE(6001))







      CALL ESPSET (2001,6000+2*10,18)




      IS10=10
      IF (SCVAL.LT.0.2) IS10=4
      ENDN(1)=XCOORD(IAT)
      ENDN(2)=YCOORD(IAT)
      ENDN(3)=ZCOORD(IAT)
      CALL GVSCPR (ENDC,XYZTO,3)
      CALL GVSTV3 (CVEC,ENDC,ENDN)
      CALL GVSVXC (CVEC,0.25,3)
      CALL GVSCP3 (CV,ENDN,ENDC)
      CALL GVSNM3 (CV)
      CALL GVSVXC (CV,FLOAT(WIFPAR(93))/100.0,3)



      DO 10 I=1,IS10



         ANGLE=GVFDTR(360.0/FLOAT(IS10))*FLOAT(I)
         CALL GVSMGM (RMAT,CVEC,ANGLE)
         CALL GVSMV3 (N10(1,I),RMAT,CV)
   10 CONTINUE



      DO 30 I=1,IS10
         CALL GVSCPR (XYZ,N10(1,I),3)




         NUMGRV=NUMGRV+1
         CALL GVSCPR (XMOL(1,NUMGRV),ENDN,3)
         CALL GVSCPR (YMOL(1,NUMGRV),ENDN,3)
         CALL GVSAV3 (YMOL(1,NUMGRV),XYZ)
         HUEVAL(NUMGRV)=ATCOLR(IAT)



         DO 20 J=1,4
            NUMGRV=NUMGRV+1
            CALL GVSCPR (XMOL(1,NUMGRV),YMOL(1,NUMGRV-1),3)
            CALL GVSBV3 (YMOL(1,NUMGRV),XMOL(1,NUMGRV),CVEC)
            HUEVAL(NUMGRV)=ATCOLR(IAT)
   20    CONTINUE



         NUMGRV=NUMGRV+1
         CALL GVSCPR (XMOL(1,NUMGRV),YMOL(1,NUMGRV-1),3)
         CALL GVSCPR (YMOL(1,NUMGRV),ENDC,3)
         HUEVAL(NUMGRV)=ATCOLR(IAT)



         CALL GVSCPR (C10(1,I),XMOL(1,NUMGRV),3)
         IF (.NOT.USE300) CALL GRTVIN
         CALL GRASAVE
   30 CONTINUE





      RETURN
      END
      SUBROUTINE DRW060 (IAT1IN,IAT2IN)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT1IN, IAT2IN, IAT1, IAT2, IAA, IERR
      REAL          XYZ1(3), XYZ2(3), XHALF, YHALF, ZHALF
      CHARACTER*4   CHAR4
      LOGICAL       WIFITI, T54EQUAL, CAN_DRAW







      IF (.NOT.WIFITI(IAT1IN)) GOTO 998
      IF (.NOT.WIFITI(IAT2IN)) GOTO 998
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1IN).OR.PROTON(IAT2IN)))  
     + GOTO 998
      IF (.NOT.CAN_DRAW(IAT1IN,IAT2IN)) GOTO 998



      CALL GRASAVE



      IF (IAT1IN.LT.IAT2IN) THEN
         IAT1=IAT1IN
         IAT2=IAT2IN
      ELSE
         IAT1=IAT2IN
         IAT2=IAT1IN
      END IF



      IF (WIFPAR(121).NE.0) THEN
         CALL GVSRT0 (XYZ,3)
         CALL DRW052 (IAT1,IAT2,4*WIFPAR(121)+1,XYZ)
      ELSE



         IF (ATCOLR(IAT1).NE.ATCOLR(IAT2)) THEN



            XHALF=(XCOORD(IAT1)+XCOORD(IAT2))/2.0
            YHALF=(YCOORD(IAT1)+YCOORD(IAT2))/2.0
            ZHALF=(ZCOORD(IAT1)+ZCOORD(IAT2))/2.0



            IF (.NOT.USEAT(IAT1).AND.WIFPAR(869).EQ.1) GOTO 10
            CALL GRTLIN (XCOORD(IAT1),YCOORD(IAT1),ZCOORD(IAT1),
     +       XHALF,YHALF,ZHALF,ATCOLR(IAT1),IERR)



   10       CONTINUE
            IF (.NOT.USEAT(IAT1).AND.WIFPAR(869).EQ.1) GOTO 20
            CALL GRTLIN (XHALF,YHALF,ZHALF,XCOORD(IAT2),YCOORD(IAT2),
     +       ZCOORD(IAT2),ATCOLR(IAT2),IERR)
   20       CONTINUE
         ELSE



            CALL GRTLIN (XCOORD(IAT1),YCOORD(IAT1),ZCOORD(IAT1),
     +       XCOORD(IAT2),YCOORD(IAT2),ZCOORD(IAT2),ATCOLR(IAT2),IERR)
         END IF
      END IF



      IF (WIFPAR(122).EQ.1) THEN



         IF (T54EQUAL(ONESAT(IAT1),' C  ').AND.
     +       T54EQUAL(ONESAT(IAT2),' O  ')) THEN
            XYZ1(1)=XCOORD(IAT1)-XCOORD(IAT1-1)
            XYZ1(2)=YCOORD(IAT1)-YCOORD(IAT1-1)
            XYZ1(3)=ZCOORD(IAT1)-ZCOORD(IAT1-1)
            XYZ2(1)=XCOORD(IAT2)-XCOORD(IAT1)
            XYZ2(2)=YCOORD(IAT2)-YCOORD(IAT1)
            XYZ2(3)=ZCOORD(IAT2)-ZCOORD(IAT1)
            CALL GVSCP3 (XYZ,XYZ1,XYZ2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)
         END IF
         IAA=ATIAA(IAT1)
         CALL GVSSTX (CHAR4,ONESA3(IAA))
         CALL GVSSHL (CHAR4)



         IF (CHAR4(1:2).EQ.'AS'.AND.ONESAT(IAT2).EQ.' OD1 ') THEN
            XYZ(1)=XCOORD(IAT2+1)-XCOORD(IAT1)
            XYZ(2)=YCOORD(IAT2+1)-YCOORD(IAT1)
            XYZ(3)=ZCOORD(IAT2+1)-ZCOORD(IAT1)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'GLU '.AND.ONESAT(IAT2).EQ.' OE1 ') THEN
            XYZ(1)=XCOORD(IAT2+1)-XCOORD(IAT1)
            XYZ(2)=YCOORD(IAT2+1)-YCOORD(IAT1)
            XYZ(3)=ZCOORD(IAT2+1)-ZCOORD(IAT1)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'GLN '.AND.ONESAT(IAT2).EQ.' OE1 ') THEN
            XYZ(1)=XCOORD(IAT2+1)-XCOORD(IAT1)
            XYZ(2)=YCOORD(IAT2+1)-YCOORD(IAT1)
            XYZ(3)=ZCOORD(IAT2+1)-ZCOORD(IAT1)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'HIS '.AND.ONESAT(IAT1).EQ.' CG  '.AND.
     +       CHAR4.EQ.' CD2 ') THEN
            XYZ(1)=-XCOORD(IAT1)-XCOORD(IAT2)+2*XCOORD(IAT2+1)
            XYZ(2)=-YCOORD(IAT1)-YCOORD(IAT2)+2*YCOORD(IAT2+1)
            XYZ(3)=-ZCOORD(IAT1)-ZCOORD(IAT2)+2*ZCOORD(IAT2+1)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'HIS '.AND.ONESAT(IAT1).EQ.' CE1 '.AND.
     +       ONESAT(IAT2).EQ.' NE2 ') THEN
            XYZ(1)=-XCOORD(IAT1)-XCOORD(IAT2)+2*XCOORD(IAT2-4)
            XYZ(2)=-YCOORD(IAT1)-YCOORD(IAT2)+2*YCOORD(IAT2-4)
            XYZ(3)=-ZCOORD(IAT1)-ZCOORD(IAT2)+2*ZCOORD(IAT2-4)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'PHE '.AND.ONESAT(IAT1).EQ.' CG  '.AND.
     +       ONESAT(IAT2).EQ.' CD1 ') THEN
            XYZ(1)=+XCOORD(IAT1+4)+XCOORD(IAT2+4)-XCOORD(IAT1)-
     +       XCOORD(IAT2)
            XYZ(2)=+YCOORD(IAT1+4)+YCOORD(IAT2+4)-YCOORD(IAT1)-
     +       YCOORD(IAT2)
            XYZ(3)=+ZCOORD(IAT1+4)+ZCOORD(IAT2+4)-ZCOORD(IAT1)-
     +       ZCOORD(IAT2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'PHE '.AND.ONESAT(IAT1).EQ.' CD2 '.AND.
     +       ONESAT(IAT2).EQ.' CE2 ') THEN
            XYZ(1)=+XCOORD(IAT1-1)+XCOORD(IAT2-1)-XCOORD(IAT1)-
     +       XCOORD(IAT2)
            XYZ(2)=+YCOORD(IAT1-1)+YCOORD(IAT2-1)-YCOORD(IAT1)-
     +       YCOORD(IAT2)
            XYZ(3)=+ZCOORD(IAT1-1)+ZCOORD(IAT2-1)-ZCOORD(IAT1)-
     +       ZCOORD(IAT2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'PHE '.AND.ONESAT(IAT1).EQ.' CE1 '.AND.
     +       ONESAT(IAT2).EQ.' CZ  ') THEN
            XYZ(1)=XCOORD(IAT1-3)+XCOORD(IAT2-3)-XCOORD(IAT1)-
     +       XCOORD(IAT2)
            XYZ(2)=YCOORD(IAT1-3)+YCOORD(IAT2-3)-YCOORD(IAT1)-
     +       YCOORD(IAT2)
            XYZ(3)=ZCOORD(IAT1-3)+ZCOORD(IAT2-3)-ZCOORD(IAT1)-
     +       ZCOORD(IAT2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'TYR '.AND.ONESAT(IAT1).EQ.' CG  '.AND.
     +       ONESAT(IAT2).EQ.' CD1 ') THEN
            XYZ(1)=XCOORD(IAT1+4)+XCOORD(IAT2+4)-XCOORD(IAT1)-
     +       XCOORD(IAT2)
            XYZ(2)=YCOORD(IAT1+4)+YCOORD(IAT2+4)-YCOORD(IAT1)-
     +       YCOORD(IAT2)
            XYZ(3)=ZCOORD(IAT1+4)+ZCOORD(IAT2+4)-ZCOORD(IAT1)-
     +       ZCOORD(IAT2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'TYR '.AND.ONESAT(IAT1).EQ.' CD2 '.AND.
     +       ONESAT(IAT2).EQ.' CE2 ') THEN
            XYZ(1)=XCOORD(IAT1-1)+XCOORD(IAT2-1)-XCOORD(IAT1)-
     +       XCOORD(IAT2)
            XYZ(2)=YCOORD(IAT1-1)+YCOORD(IAT2-1)-YCOORD(IAT1)-
     +       YCOORD(IAT2)
            XYZ(3)=ZCOORD(IAT1-1)+ZCOORD(IAT2-1)-ZCOORD(IAT1)-
     +       ZCOORD(IAT2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'TYR '.AND.ONESAT(IAT1).EQ.' CE1 '.AND.
     +       ONESAT(IAT2).EQ.' CZ  ') THEN
            XYZ(1)=XCOORD(IAT1-3)+XCOORD(IAT2-3)-XCOORD(IAT1)-
     +       XCOORD(IAT2)
            XYZ(2)=YCOORD(IAT1-3)+YCOORD(IAT2-3)-YCOORD(IAT1)-
     +       YCOORD(IAT2)
            XYZ(3)=ZCOORD(IAT1-3)+ZCOORD(IAT2-3)-ZCOORD(IAT1)-
     +       ZCOORD(IAT2)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'ARG '.AND.ONESAT(IAT2).EQ.' NH1 ') THEN
            XYZ(1)=XCOORD(IAT2+1)-XCOORD(IAT1)
            XYZ(2)=YCOORD(IAT2+1)-YCOORD(IAT1)
            XYZ(3)=ZCOORD(IAT2+1)-ZCOORD(IAT1)
            CALL GVSNM3 (XYZ)
            CALL GVSSCV (XYZ,0.15)
            CALL DRW062 (IAT1,IAT2,XYZ)



         ELSE IF (CHAR4.EQ.'TRP ') THEN
            IF (ONESAT(IAT1).EQ.' CG  '.AND.ONESAT(IAT2).EQ.' CD1 ')THEN
               XYZ(1)=-XCOORD(IAT1)-XCOORD(IAT2)+2*XCOORD(IAT2+3)
               XYZ(2)=-YCOORD(IAT1)-YCOORD(IAT2)+2*YCOORD(IAT2+3)
               XYZ(3)=-ZCOORD(IAT1)-ZCOORD(IAT2)+2*ZCOORD(IAT2+3)
               CALL GVSNM3 (XYZ)
               CALL GVSSCV (XYZ,0.15)
               CALL DRW062 (IAT1,IAT2,XYZ)
            ELSE IF (ONESAT(IAT1).EQ.' CD2 '.AND.
     +          ONESAT(IAT2).EQ.' CE2 ') THEN
               XYZ(1)=-XCOORD(IAT1)-XCOORD(IAT2)+2*XCOORD(IAT2-3)
               XYZ(2)=-YCOORD(IAT1)-YCOORD(IAT2)+2*YCOORD(IAT2-3)
               XYZ(3)=-ZCOORD(IAT1)-ZCOORD(IAT2)+2*ZCOORD(IAT2-3)
               CALL GVSNM3 (XYZ)
               CALL GVSSCV (XYZ,0.15)
               CALL DRW062 (IAT1,IAT2,XYZ)
            ELSE IF (ONESAT(IAT1).EQ.' CE3 '.AND.
     +          ONESAT(IAT2).EQ.' CZ3 ') THEN
               XYZ(1)=XCOORD(IAT1-1)+XCOORD(IAT2-1)-XCOORD(IAT1)-
     +          XCOORD(IAT2)
               XYZ(2)=YCOORD(IAT1-1)+YCOORD(IAT2-1)-YCOORD(IAT1)-
     +          YCOORD(IAT2)
               XYZ(3)=ZCOORD(IAT1-1)+ZCOORD(IAT2-1)-ZCOORD(IAT1)-
     +          ZCOORD(IAT2)
               CALL GVSNM3 (XYZ)
               CALL GVSSCV (XYZ,0.15)
               CALL DRW062 (IAT1,IAT2,XYZ)
            ELSE IF (ONESAT(IAT1).EQ.' CZ2 '.AND.
     +          ONESAT(IAT2).EQ.' CH2 ') THEN
               XYZ(1)=XCOORD(IAT1-4)+XCOORD(IAT2-3)-XCOORD(IAT1)-
     +          XCOORD(IAT2)
               XYZ(2)=YCOORD(IAT1-4)+YCOORD(IAT2-3)-YCOORD(IAT1)-
     +          YCOORD(IAT2)
               XYZ(3)=ZCOORD(IAT1-4)+ZCOORD(IAT2-3)-ZCOORD(IAT1)-
     +          ZCOORD(IAT2)
               CALL GVSNM3 (XYZ)
               CALL GVSSCV (XYZ,0.15)
               CALL DRW062 (IAT1,IAT2,XYZ)
            END IF
         END IF
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE DRW061 (IAT1,IAT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INTEGER       IAT1, IAT2, IERR
      REAL          XHALF, YHALF, ZHALF




      LOGICAL       CAN_DRAW







      IF (WIFPAR(121).NE.0) THEN
         CALL GVSRT0 (XYZ,3)
         CALL DRW053 (IAT1,IAT2,4*WIFPAR(121)+1,XYZ)
      ELSE
         IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1).OR.PROTON(IAT2))) 
     +    GOTO 998
         IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



         XHALF=(XCOORD(IAT1)+XCOORD(IAT2))/2.0
         YHALF=(YCOORD(IAT1)+YCOORD(IAT2))/2.0
         ZHALF=(ZCOORD(IAT1)+ZCOORD(IAT2))/2.0




            CALL GRTLIN (XCOORD(IAT1),YCOORD(IAT1),ZCOORD(IAT1),
     +       XHALF,YHALF,ZHALF,ATCOLR(IAT1),IERR)

      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE DRW062 (IAT1,IAT2,VECT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'IRIGRA.INC'
      INCLUDE       'SOLIDS.INC'
      INTEGER       IAT1, IAT2, IERR
      REAL          VECT(3), XHALF, YHALF, ZHALF
      LOGICAL       CAN_DRAW







      IF (WIFPAR(121).NE.0) THEN
         CALL DRW052 (IAT1,IAT2,17,VECT)
         GOTO 998
      END IF
      IF (PROTON(IAT1).OR.PROTON(IAT2)) GOTO 998
      IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



      IF (ISOLID) THEN
         CALL DRW003 (IAT1,IAT2)
         GOTO 998
      END IF



      IF (ATCOLR(IAT1).NE.ATCOLR(IAT2)) THEN



         XHALF=(XCOORD(IAT1)+XCOORD(IAT2))/2.0
         YHALF=(YCOORD(IAT1)+YCOORD(IAT2))/2.0
         ZHALF=(ZCOORD(IAT1)+ZCOORD(IAT2))/2.0




         CALL GRTLIN (XCOORD(IAT1)+VECT(1),YCOORD(IAT1)+VECT(2),
     +    ZCOORD(IAT1)+VECT(3),XHALF+VECT(1),YHALF+VECT(2),
     +    ZHALF+VECT(3),ATCOLR(IAT1),IERR)



         CALL GRTLIN (XHALF+VECT(1),YHALF+VECT(2),ZHALF+VECT(3),
     +    XCOORD(IAT2)+VECT(1),YCOORD(IAT2)+VECT(2),
     +    ZCOORD(IAT2)+VECT(3),ATCOLR(IAT2),IERR)
      ELSE




         CALL GRTLIN (XCOORD(IAT1)+VECT(1),YCOORD(IAT1)+VECT(2),
     +    ZCOORD(IAT1)+VECT(3),XCOORD(IAT2)+VECT(1),
     +    YCOORD(IAT2)+VECT(2),ZCOORD(IAT2)+VECT(3),ATCOLR(IAT2),IERR)
      END IF



  998 CONTINUE


      RETURN
      END
      LOGICAL FUNCTION DRW100(IAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT
      LOGICAL       WIFITI







      DRW100=.FALSE.



      IF (.NOT.WIFITI(IAT)) GOTO 998



      IF (.NOT.ISATOK(IAT)) GOTO 998



      IF (WIFPAR(15).EQ.1.AND.PROTON(IAT)) GOTO 998



      DRW100=.TRUE.



  998 CONTINUE


      RETURN
      END   
      LOGICAL FUNCTION CAN_DRAW(IAT,JAT)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IAT, JAT
      LOGICAL       WIFITI, XYZNUL







      CAN_DRAW=.FALSE.



      IF (.NOT.WIFITI(IAT)) GOTO 998
      IF (.NOT.WIFITI(JAT)) GOTO 998
      IF (.NOT.ISATOK(IAT)) GOTO 998
      IF (.NOT.ISATOK(JAT)) GOTO 998
      IF (ALTATM(IAT).NE.ALTATM(JAT).AND.ALTATM(IAT).NE.' '.AND.
     + ALTATM(JAT).NE.' ') GOTO 998
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT).OR.PROTON(JAT))) GOTO 998
      IF (XYZNUL(IAT)) GOTO 998
      IF (XYZNUL(JAT)) GOTO 998



      IF (WIFPAR(15).EQ.1) THEN
         IF (PROTON(IAT).OR.PROTON(JAT)) THEN
            GOTO 998
         END IF
      END IF



      IF (WIFPAR(324).NE.0) THEN
         IF ((XCOORD(IAT)-XCOORD(JAT))**2+(YCOORD(IAT)-YCOORD(JAT))**2+
     +       (ZCOORD(IAT)-ZCOORD(JAT))**2.GT.
     +        (FLOAT(WIFPAR(135))/100.0)**2) THEN
            GOTO 998
         END IF
      END IF



      CAN_DRAW=.TRUE.



  998 CONTINUE


      RETURN
      END

      SUBROUTINE DRW_DASH_L_SYM (IAT1,IAT2,ISTEP,ISYM)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'SYMINC.INC'
      INTEGER       IAT1, IAT2, ISTEP, ISYM, IERR
      REAL          V1(3),V2(3)
      LOGICAL       CAN_DRAW







      IF (IAT1.EQ.IAT2.AND.ISYM.LE.1) THEN
         IF (WIFPAR(1012).NE.0) CALL GVSTTB ('?NEWB34')
         GOTO 998
      END IF
      IF (WIFPAR(1427).NE.0.AND.(PROTON(IAT1).OR.PROTON(IAT2))) GOTO 998
      IF (.NOT.CAN_DRAW(IAT1,IAT2)) GOTO 998



      V1(1)=XCOORD(IAT1)
      V1(2)=YCOORD(IAT1)
      V1(3)=ZCOORD(IAT1)
      V2(1)=XCOORD(IAT2)
      V2(2)=YCOORD(IAT2)
      V2(3)=ZCOORD(IAT2)



      CALL GVSMPV (V2,SYMMAT(1,1,ISYM),SYMVEC(1,ISYM))



      IF (ATCOLR(IAT1).EQ.ATCOLR(IAT2)) THEN
         CALL GRTDSH (V1(1),V1(2),V1(3),V2(1),V2(2),V2(3),
     +    ATCOLR(IAT1),ISTEP,IERR)
      ELSE
         CALL GRT_H_DSH (V1,V2,ATCOLR(IAT1),ISTEP)
         CALL GRT_H_DSH (V2,V1,ATCOLR(IAT2),ISTEP)
      END IF



  998 CONTINUE


      RETURN
      END
