anchor.diff:                              end if
   
                           end if
  -                        
  +
                           if( ri(1) == 1 ) then
                               ! Check that priority_domain points are NEVER in
                               ! domains(2:4), which have higher resolution
   
                               do jj = 2, 4
  -                                ! Bounding box of the priority domain associated with domains(jj) 
  +                                ! Bounding box of the priority domain associated with domains(jj)
                                   xmn = minval(all_bbox(:,1,jj,k))
                                   xmx = maxval(all_bbox(:,1,jj,k))
                                   ymn = minval(all_bbox(:,2,jj,k))
                                   ymx = maxval(all_bbox(:,2,jj,k))
   
  -                                if(any((md%domains(i)%x(ri(3):ri(4)) >= xmn) .and. & 
  +                                if(any((md%domains(i)%x(ri(3):ri(4)) >= xmn) .and. &
                                          (md%domains(i)%x(ri(3):ri(4)) <= xmx)) .and. &
                                      any((md%domains(i)%y(ri(5):ri(6)) >= ymn) .and. &
                                          (md%domains(i)%y(ri(5):ri(6)) <= ymx )) ) then
  
positive.code:         ! Store all dx in a variable all_dx_md, which in practice will be inside the multidomain
          ! Cannot just have it in the multidomain from the start, because it might be a coarray
          if(allocated(all_dx)) then
              if(allocated(all_dx_md)) deallocate(all_dx_md)  
              allocate( all_dx_md(2, size(all_dx, 2, kind=ip), size(all_dx,3, kind=ip)) )
              all_dx_md = all_dx
              deallocate(all_dx)
  
negative.code:         ! Split up domains among images, and create all md%domains(i)%myid
          call md%partition_domains()
  
          ! Make sure all domains use the new output_basedir
          do i = 1, size(md%domains, kind=ip)
              md%domains(i)%output_basedir = md%output_basedir
              ! Make output folders. This involves system calls and forks, so we should do it before allocating lots of memory
  