      SUBROUTINE EDITMR( INTRNL )
* TO MERGE A SECOND GEOMETRY DESCRIPTION WITH THE CURRENT ONE
C
C         Notice of Public Domain nature of this Program
C
C      'This computer program is a work of the United States 
C       Government and as such is not subject to protection by 
C       copyright (17 U.S.C. # 105.)  Any person who fraudulently 
C       places a copyright notice or does any other act contrary 
C       to the provisions of 17 U.S. Code 506(c) shall be subject 
C       to the penalties provided therein.  This notice shall not 
C       be altered or removed from this software and is to be on 
C       all reproductions.'
C
      INCLUDE 'SIZES'
      IMPLICIT REAL (A-H,O-Z)
      REAL CART
      INTEGER*2 ATBOND
      LOGICAL DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      LOGICAL ERROR,MODATA,INTRNL,LCLDBG,LINALL,AMODE,EDMADE, REDRAW
      COMMON /ATOMS/ CO(3, NUMATM),IE( NUMATM),NATOMS, ATCHG( NUMATM)
      COMMON /GEOM/ COOLD(3, NUMATM),NA( NUMATM),NB( NUMATM),NC( NUMATM)
      COMMON /INTCOR/ XNDOGM(3, NUMATM),INTFRE(3, NUMATM)
      COMMON /EDIT/ MODATA, REDRAW
      CHARACTER*6 ATSYMB
      COMMON /ATSYMB/ ATSYMB( 200)
      CHARACTER COMAND*80, ICCC*2, STRTMP*80, OLDFIL*80, FTYPE*3
      COMMON /VALNCE/ MAXVAL(200)
C?      COMMON /VANRAD/ VANRAD(200)
      COMMON /DEBCOM/ DEBUG, DEBUGL, DEBUGN, DEBUGO, DEBUGP, DEBUGI
      COMMON /DISPLY/ IREM(200), BSCALE, ATBOND( NUMATM, NUMATM),
     .                ISTYPE, LATYPE, IMASK( NUMATM), ISCOLO
      COMMON /LINES/ CART(2, NUMATM),LIST( NUMATM), LATOMS, LINALL
      DIMENSION CO2( 3, NUMATM), XNDOG2( 3, NUMATM)
      DIMENSION NA2( NUMATM) , NB2( NUMATM), NC2( NUMATM)
      DIMENSION IE2( NUMATM)
      DIMENSION IVAL( NUMATM)
      DIMENSION ROTPRD( 3, 3)
*
*   LOGICAL INTRNL INDICATES MODE OF ADDING NEW ATOMS
*            .TRUE.   ==>   INTERNAL COORDINATES
*           .FALSE.   ==>   CARTESIAN COORDINATES
*
   1  CALL PLOT( 0, 0, 8)
      CALL UPROMP( 'What is name of file [.DRW] ')
      FTYPE = ' '
      READ(5,'(A)', END=4000) STRTMP
      ISEMI = INDEX( STRTMP, ';')
      IF ( ISEMI .GT. 0) STRTMP( ISEMI:ISEMI) = '@'
 3001 ISLASH = INDEX( STRTMP, '/')
      IF ( ISLASH .GT. 0) THEN
         STRTMP( ISLASH: ISLASH) = '\\'
         GOTO 3001
      ENDIF
      CALL LCLEAN( STRTMP, STRTMP, .TRUE.)
      ISEMI = INDEX( STRTMP, '@')
      IF ( ISEMI .GT. 0) STRTMP( ISEMI:ISEMI) = ';'
2000  FORMAT (A80)
* CHECK FOR HELP
      IF ( STRTMP(:1) .EQ. '?' ) THEN
         COMAND = 'DRAW EDIT MERGE'
         CALL HELP( COMAND )
         COMAND = ' '
         GOTO 1
      ENDIF
* CHECK FOR PRELIMINARY COMMANDS
 2222 IZZ = INDEX( STRTMP, '\\')
      IF (IZZ .GT. 0) THEN
         IF (STRTMP(IZZ+1:IZZ+3) .EQ. '-H') THEN
            IREM(1)=1
            STRTMP=STRTMP(:IZZ-1)//STRTMP(IZZ+3:)
            GOTO 2222
         ELSEIF (STRTMP(IZZ+1:IZZ+4) .EQ. '+XX') THEN
            IREM(99)=0
            STRTMP=STRTMP(:IZZ-1)//STRTMP(IZZ+4:)
            GOTO 2222
         ELSEIF ( STRTMP( IZZ+1:IZZ+6) .EQ. 'DEBUG') THEN
            DEBUG = .TRUE.
            STRTMP = STRTMP( :IZZ-1)//STRTMP( IZZ+6:)
            GOTO 2222
         ELSEIF ( STRTMP( IZZ+1: IZZ+7) .EQ. 'DEBUGI') THEN
            DEBUGI = .TRUE.
            STRTMP = STRTMP( :IZZ-1)//STRTMP( IZZ+7:)
            GOTO 2222
         ENDIF
      ENDIF
      IF ( STRTMP(:1) .EQ. '*' ) THEN
C**         GOTO 6
         WRITE (*, *) 'WILD CARDS NOT ALLOWED HERE, SPECIFY IN FULL.'
         GOTO 1
      ENDIF
      OLDFIL = STRTMP
      DO 1000 I=1,80
C  CHECK FOR DIRECTORY/SUB DIRECTORY JUNK
         IF (STRTMP(I:I).EQ.']') INDIR=0
         IF (STRTMP(I:I).EQ.'[') INDIR=1
         IF (INDIR.EQ.1) GOTO 1000
         IF (STRTMP(I:I).EQ.'.') GOTO 1010
         IF (STRTMP(I:I).EQ.' ') GOTO 1005
 1000 CONTINUE
      WRITE ( *, *) ' ERROR IN HANDLING FILE NAMES.'
C APPLY DEFAULT EXTENSIONS
1005  IF ( I .LT. 2 ) RETURN
      STRTMP(I:)='.DRW'
      IFILE = I + 4
      OLDFIL=STRTMP
  6   CONTINUE
 1010 CONTINUE
* USER HAD A PERIOD IN FILE NAME, NO DEFAULT EXTENSION
      DO 7 I=1,3
         DO 7 J=1,3
 7    ROTPRD(I,J)=0.0D0
      ROTPRD(1,1)=1.0D0
      ROTPRD(2,2)=1.0D0
      ROTPRD(3,3)=1.0D0
      NATOM2 = 0
      STRTMP = OLDFIL
      IR = 19
      CALL GPRDR( IR, OLDFIL, FTYPE, XNDOG2, IE2, NATOM2, 
     .      NA2, NB2, NC2, .FALSE.)
      IF ( FTYPE .EQ. 'TEC' ) THEN
         WRITE (*,*)  'External plot command files are not permitted.'
         GOTO 1
      ENDIF
      CLOSE (UNIT= IR)
      IF (NATOM2.LT.0) THEN
         IF (NATOM2 .EQ. -100) THEN
            OLDFIL = STRTMP
            WRITE (*,*) 'END OF FILE'
            GOTO 1
         ELSEIF (NATOM2 .EQ. -1000) THEN
            WRITE (*,*) 'That file does NOT EXIST.'
            OLDFIL = STRTMP
            GOTO 1
         ELSE
            WRITE (*,*) 'EDIT: MERGE: ERROR, NATOM2=',NATOM2
         ENDIF
       ENDIF
       IF( FTYPE .NE. 'GIP') THEN
         CALL GMETRY(NUATOM,NATOM2,IE2,XNDOG2,NA2,NB2,NC2,CO2,ERROR)
       ENDIF
90     CONTINUE
       IF ( NATOMS .LT. 1 ) GOTO 500
* IF FIRST MOLECULE HAS ANY ATOMS, WE NEED A DISTANCE
       IF ( INTRNL ) THEN
100      CALL UPROMP( 'What is the distance for NEW ATOM 1 ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 1,1) = READA( COMAND, 1, ERROR)
         IF ( ERROR) THEN
            WRITE (*,*) 'I couldn''t understand that.'
            GOTO 100
         ENDIF
         IATEMP = NATOMS
 102     WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NA ['',I4,'']? '' )')
     .          IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ') THEN
            NA2(1) = IATEMP
         ELSE
            NA2(1) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 102
            ENDIF
         ENDIF
         IF ( NATOMS .LT. 2 ) GOTO 500

* ELSE, WE ALSO NEED A REFERENCE ANGLE
  104    CALL UPROMP( 'Now, what angle will describe the position'//
     .                ' of this first atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 2, 1) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 104
         ENDIF
 106     CONTINUE
         IATEMP = NA( NA2( 1 ) )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NB ['',I4,'']? '' )')
     .          IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NB2( 1) = IATEMP
         ELSE
            NB2( 1) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 106
            ENDIF
         ENDIF
         IF ( NATOMS .LT. 3 ) GOTO 500

* ELSE, WE ALSO NEED A DIHEDRAL ANGLE
  108    CALL UPROMP( 'Now, what dihedral angle will describe the'//
     .                ' position of this first atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 3, 1) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 108
         ENDIF
 109     CONTINUE
         IATEMP = NB( NA2( 1 ) )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NC ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NC2( 1) = IATEMP
         ELSE
            NC2( 1) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 109
            ENDIF
         ENDIF
* END OF FIRST NEW ATOM
         IF ( NATOM2 .LT. 2 ) GOTO 500
* FOR THE SECOND ATOM, WE NEED ANGLE AND DIHEDRAL
  114    CALL UPROMP( 'Now, what angle will describe the position'//
     .                ' of this SECOND atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 2, 2) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 114
         ENDIF
 116     CONTINUE
         IATEMP = NA2( 1 )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NB ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NB2( 2) = IATEMP
         ELSE
            NB2( 2) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 116
            ENDIF
         ENDIF
         IF ( NATOMS .LT. 2 ) GOTO 500
* ELSE, WE ALSO NEED A DIHEDRAL ANGLE
  118    CALL UPROMP( 'Now, what dihedral angle will describe the'//
     .                ' position of this SECOND atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 3, 2) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 118
         ENDIF
 119     CONTINUE
         IATEMP = NB2( 1 )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NC ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NC2( 2) = IATEMP
         ELSE
            NC2( 2) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 119
            ENDIF
         ENDIF
* END OF SECOND NEW ATOM
         IF ( NATOM2 .LT. 1 ) GOTO 500
* FOR THE THRID ATOM WE ONLY NEED A DIHEDRAL ANGLE
  128    CALL UPROMP( 'Now, what dihedral angle will describe the'//
     .                ' position of this THIRD atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 3, 3) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 128
         ENDIF
 129     CONTINUE
         IATEMP = NB2( 2 )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NC ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NC2( 3) = IATEMP
         ELSE
            NC2( 3) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 129
            ENDIF
         ENDIF
* END OF THIRD NEW ATOM
      ELSE
* NOW WE DO CARTESIAN
 200     CALL UPROMP( 'What is the distance for NEW ATOM 1 ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 1,1) = READA( COMAND, 1, ERROR)
         IF ( ERROR) THEN
            WRITE (*,*) 'I couldn''t understand that.'
            GOTO 200
         ENDIF
         IATEMP = NATOMS
 202     WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NA ['',I4,'']? '' )')
     .          IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ') THEN
            NA2(1) = IATEMP
         ELSE
            NA2(1) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 202
            ENDIF
         ENDIF
         IF ( NATOMS .LT. 2 ) GOTO 500

* ELSE, WE ALSO NEED A REFERENCE ANGLE
  204    CALL UPROMP( 'Now, what angle will describe the position'//
     .                ' of this first atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 2, 1) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 204
         ENDIF
 206     CONTINUE
         IATEMP = NA( NA2( 1 ) )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NB ['',I4,'']? '' )')
     .          IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NB2( 1) = IATEMP
         ELSE
            NB2( 1) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 206
            ENDIF
         ENDIF
         IF ( NATOMS .LT. 3 ) GOTO 500

* ELSE, WE ALSO NEED A DIHEDRAL ANGLE
  208    CALL UPROMP( 'Now, what dihedral angle will describe the'//
     .                ' position of this first atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 3, 1) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 208
         ENDIF
 209     CONTINUE
         IATEMP = NB( NA2( 1 ) )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NC ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NC2( 1) = IATEMP
         ELSE
            NC2( 1) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 209
            ENDIF
         ENDIF
* END OF FIRST NEW ATOM
         IF ( NATOM2 .LT. 2 ) GOTO 500
* FOR THE SECOND ATOM, WE NEED ANGLE AND DIHEDRAL
  214    CALL UPROMP( 'Now, what angle will describe the position'//
     .                ' of this SECOND atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 2, 2) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 214
         ENDIF
 216     CONTINUE
         IATEMP = NA2( 1 )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NB ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NB2( 2) = IATEMP
         ELSE
            NB2( 2) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 216
            ENDIF
         ENDIF
         IF ( NATOMS .LT. 2 ) GOTO 500
* ELSE, WE ALSO NEED A DIHEDRAL ANGLE
  218    CALL UPROMP( 'Now, what dihedral angle will describe the'//
     .                ' position of this SECOND atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 3, 2) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 218
         ENDIF
 219     CONTINUE
         IATEMP = NB2( 1 )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NC ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NC2( 2) = IATEMP
         ELSE
            NC2( 2) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 219
            ENDIF
         ENDIF
* END OF SECOND NEW ATOM
         IF ( NATOM2 .LT. 1 ) GOTO 500
* FOR THE THRID ATOM WE ONLY NEED A DIHEDRAL ANGLE
  228    CALL UPROMP( 'Now, what dihedral angle will describe the'//
     .                ' position of this THIRD atom ? ')
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         XNDOG2( 3, 3) = READA( COMAND, 1, ERROR)
         IF ( ERROR ) THEN
            WRITE (*,*) 'I don''t understand that.'
            GOTO 228
         ENDIF
 229     CONTINUE
         IATEMP = NB2( 2 )
         WRITE ( COMAND, '(''What atom from the ORIGINAL '',
     .        ''molecule is the reference NC ['',I4,'']? '' )')
     .        IATEMP
         ITEMP = INDEX( COMAND, '?')
         CALL UPROMP( COMAND( 1: ITEMP) )
         READ( *, '(A)', END=90 ) COMAND
         CALL LCLEAN( COMAND, COMAND, .TRUE.)
         IF ( COMAND( 1:1) .EQ. ' ' ) THEN
            NC2( 3) = IATEMP
         ELSE
            NC2( 3) = READA( COMAND, 1, ERROR)
            IF ( ERROR ) THEN
               WRITE (*,*) 'I don''t understand that.'
               GOTO 229
            ENDIF
         ENDIF
* END OF THIRD NEW ATOM
      ENDIF
* NOW WE MERGE THE TWO DESCRIPTIONS
 500  CONTINUE
      DO 510 J=1, NATOM2
         XNDOGM( 1, NATOMS+J) = XNDOG2( 1, J)
         XNDOGM( 2, NATOMS+J) = XNDOG2( 2, J)
         XNDOGM( 3, NATOMS+J) = XNDOG2( 3, J)
         IF ( J .EQ. 1 ) THEN
            NA( NATOMS+J) = NA2( J)
         ELSE
            NA( NATOMS+J) = NA2( J)+ NATOMS
         ENDIF
         IF ( J .LE. 2 ) THEN
            NB( NATOMS+J) = NB2( J)
         ELSE
            NB( NATOMS+J) = NB2( J)+ NATOMS
         ENDIF
         IF ( J .LE. 3 ) THEN
            NC( NATOMS+J) = NC2( J)
         ELSE
            NC( NATOMS+J) = NC2( J)+ NATOMS
         ENDIF
         IE( NATOMS+J) = IE2( J)
         INTFRE( 1, NATOMS+J) = 1
         INTFRE( 2, NATOMS+J) = 1
         INTFRE( 3, NATOMS+J) = 1
510   CONTINUE
      NATOMS = NATOMS + NATOM2
      MODATA = .TRUE.
      CALL GMETRY(NUATOM,NATOMS,IE,XNDOGM,NA,NB,NC,CO,ERROR)
      CALL SETLAB
      CALL SETBON( .FALSE. )
      CALL PLOT(0,0,9)
      CALL PICTUR
      REDRAW = .FALSE.
111   CALL PLOT(0,0,8)

**************************
 9000 CONTINUE
      GOTO 1
 4000 RETURN
      END
