anchor.diff:           if(n.eq.0) exit
            write(*,*) "number of atoms", n
            oc1=.false.
  -         if(atom1_id.gt.0) then
  -           oc1=.false.
  -           oc1(atom1_id) = .true.
  -         else if(atom1_tag.ne." ") then
  -           oc1 = atag.eq.atom1_tag
  -c           call mask_byname(n,c,atag,oc1,atom1_tag)
  -         end if
  +         call mask_all(n,c,atag,oc1,atom1_id,atom1_tag)
            oc2=.false.
  -         if(atom2_id.gt.0) then
  -           oc2(atom2_id) = .true.
  -         else if(atom2_tag.ne." ") then
  -           oc2 = (atag.eq.atom2_tag).and.(.not.oc1)
  -c           call mask_byname(n,c,atag,oc2,atom2_tag)
  -         else
  -           oc2=oc1
  -         end if
  +         call mask_all(n,c,atag,oc2,atom2_id,atom2_tag)
  +c        if possible make atom1 and atom2 distinct
  +         oc2=oc2.and.(.not.oc1)
  +         if(count(oc2).eq.0) oc2=oc1
  +c
  +         do i=1,n
  +           write(78,*) oc1(i),oc2(i)
  +         end do
  +         if(any(oc2.and.oc1)) oc2=oc2.and.(.not.oc1)
            gr0 = 0
            call rdf_compute2(n,c,oc1,oc2,
        +                    nb,rmax,lat,
  
positive.code:      +                    fn_in)
           gr = gr + gr0
           nf = nf+1
           if(nfrm.gt.0.and.nf.gt.nfrm) then
              write(*,*) "exiting because exceeded number of frames",nf,nfrm
              exit
           end if
  
negative.code:        integer i
         do i=1,n
           oc(i)=oc(i).and.(atag(i).eq.mtag)
  c         oc(i)=oc(i).and.index(atag(i),mtag(1:len_trim(mtag))).ne.0
         end do
         end
  
  