%2020-02-25 Ant Raft Run Script

clear
clc
% delete(gcp('nocreate'))
% parpool(16)

%% User Inputs
Repeats = 1;            %this is the number of repeated trials the code will sweep through
R_range = 1.5;          %this is the radius of detection in units of zeta - set to 1.5 unless sweeping
L_range = (0.5:0.1:2);  %L = Gamma/f_a in units of zeta - this controls surface agent activity level through A = l/L
tau_range = 87.5*60;    %this is the inverse pairwise strain rate in units of hz
mass_range = 2.25;      %this is the raft size - 
                            %the total number of agents will be 1000x this number at pseudo steady-state
                            %the domain size will scale automatically - set
                            %to 2.25 to replicate results
eta = 0.2;              %this is the Vicsek noise parameter - set to 0.2 unless sweeping

ExpDuration = 1.5*3600; %This controls the experiment duration in units of simulated s
MakeMovie = 0;          %This toggles the creation of videos of movies during run - 
                            %KEEP SET TO 0 FOR EFFICIENCY - Movies may be generated in postprocessing 0
PrintData = 1;          %This toggles the output of data into a designated folder
PlotPeriod = 120;       %This controls the frequency of data output and is in units of seconds

%% Do not change following
ct=0;
for h = 1:Repeats
    for i=1:size(R_range,2)
        for k=1:size(L_range,2)
            for l=1:size(tau_range,2)
                for m=1:size(mass_range,2)
                    ct=ct+1;
                    Package(ct,1) = R_range(i);
                    Package(ct,2) = L_range(k);
                    Package(ct,3) = tau_range(l);
                    Package(ct,4) = mass_range(m);
                    Package(ct,5) = h;
                end
            end
        end
    end
end

% parfor i=1:size(Package,1)
for i=1:size(Package,1)
    Trial = i+21;
    R0 = Package(i,1);
    L = Package(i,2);
    Tau = Package(i,3);
    TotalMass = Package(i,4);
    
    ant_raft_simV2_OffLatticeV13(Trial,MakeMovie,...
        ExpDuration,PrintData,PlotPeriod,R0,L,Tau,TotalMass,eta)
end

