%function to determine texture evolution in orthorhombic mineral with four
%slip systems. Model incorporates both the director method and Schmid-based
%rotation prediction.

%Created by L.N.Hansen

function ori_grains = director_quat(D,tspan,ori_o,f)

options=odeset('AbsTol',20e-3,'RelTol',10e-2);
ori_temp2 = zeros(length(tspan),4,size(ori_o,1));
for i = 1:size(ori_o,1)
    
    func = @(t,ori_o) director_quat_ode(t,ori_o,D,f);
    [t,ori_temp] = ode23(func,tspan,ori_o(i,:),options);
    ori_temp2(:,:,i) = real(ori_temp);

end

ori_grains = permute(ori_temp2,[3 2 1]);


