function [init] = mix_wells(nvars,rWells,cWells,ReducedWells,Out)


for ind = 1:nvars
    for row = 1:rWells
        for col = 1:cWells
            rowp = row + 1;
            rowm = row - 1;
            colp = col + 1;
            colm = col - 1;
            if rowp > rWells  %these if and else conditions
                rowp = 1;     %are used to allow the matrix
            end               %to wrap around and access wells
            if rowm == 0;     %from the opposite side
                rowm = rWells;
            end
            if colp > cWells
                colp = 1;
            end
            if colm == 0;
                colm = cWells;
            end
            MixedWells(row,col,ind) = ReducedWells(row,col,ind) + Out(rowp,col,ind) + Out(rowm,col,ind) + Out(row,colp,ind) + Out(row,colm,ind);
        end
    end
end

init = round(MixedWells); %the final values are rounded so that initial conditions with decimals aren't entered into the hybridsim
