anchor.diff:        interface
             subroutine contract(pos, min, dim, beta)
                 real*8, intent(inout)  :: pos(:,:)
  -              integer, intent(in)    :: min, dim
                 real*8, intent(in)     :: beta
  +              integer, intent(in)    :: dim, min
             end subroutine contract
         end interface
   
  
positive.code:           call reflect(pos, min, dim, alpha)
            call findval(pos, value, dim)
            call minmax(value, min, max)
  
            if (minsave.EQ.max) then
                write(*,*) "expanding..."
                maxsave = max
                xsave = pos(1, max)
                ysave = pos(2, max)
                call expand(pos, max, dim, gamma)
                call findval(pos, value, dim)
                call minmax(value, min, max)
  
                if (maxsave.NE.max) then
                    pos(1, max) = xsave
                    pos(2, max) = ysave
                end if
  
            else if (minsave.EQ.min) then
                write(*,*) "contracting..."
                xsave = pos(1, min)
                ysave = pos(2, min)
  
                pos(1, min) = xsave
                pos(2, min) = ysave
                call contract(pos, min, dim, beta)
  
                if (minsave.EQ.min) then
                    call contractall(pos, max, dim)
                end if
  
            end if
            i = i + 1
        end do
  
  end subroutine
  
  
negative.code:       integer, intent(in)                   :: min, dim
        real*8, intent(in)                    :: alpha
  
        pos(1,min) = (1 + alpha) * pos(1,dim) - alpha * pos(1, min)
        pos(2,min) = (1 + alpha) * pos(2,dim) - alpha * pos(2, min)
  
  end subroutine
  
  