% % Script to plot the ideal twin misorientation angle versus c/a ratio for hexagonal close packed materials.
% % This script has been created and tested using MTEX 5.0.3.
% % Script created by Azdiar Gazder: May 2018
clc; clear all; clear hidden; close all;
startup_mtex;
angleList_T1 = []; angleList_T2 = []; angleList_T3 = []; angleList_T4 = []; angleList_T5 = [];
count = 1;
for cbyaRatio = 1:0.1:9.8;
clear cs_hex
cs_hex = crystalSymmetry('6/mmm', [1 1 cbyaRatio], 'X||a', 'Y||b*', 'Z||c');
T1 = orientation('map', Miller(1,0,-1,1,cs_hex.properGroup), Miller(-1,0,1,-1,cs_hex.properGroup),...
Miller(2,-1,-1,0,cs_hex.properGroup), Miller(-2,1,1,0,cs_hex.properGroup));
angle_T1 = angle(T1)/degree;
angleList_T1 = vertcat(angleList_T1, angle_T1);
axisList_T1(count) = axis(T1);
T2 = orientation('map', Miller(1,0,-1,0,cs_hex.properGroup), Miller(-1,1,0,0,cs_hex.properGroup),...
Miller(1,0,-1,5,cs_hex.properGroup), Miller(-1,0,1,-5,cs_hex.properGroup));
angle_T2 = angle(T2)/degree;
angleList_T2 = vertcat(angleList_T2, angle_T2);
axisList_T2(count) = axis(T2);
T3 = orientation('map', Miller(1,0,-1,0,cs_hex.properGroup), Miller(-1,1,0,0,cs_hex.properGroup),...
Miller(1,0,-1,2,cs_hex.properGroup), Miller(-1,0,1,-2,cs_hex.properGroup));
angle_T3 = angle(T3)/degree;
angleList_T3 = vertcat(angleList_T3, angle_T3);
axisList_T3(count) = axis(T3);
T4 = orientation('map', Miller(1,0,-1,0,cs_hex.properGroup), Miller(-1,1,0,0,cs_hex.properGroup),...
Miller(3,-1,-2,1,cs_hex.properGroup), Miller(-3,2,1,1,cs_hex.properGroup));
angle_T4 = angle(T4)/degree;
angleList_T4 = vertcat(angleList_T4, angle_T4);
axisList_T4(count) = axis(T4);
T5 = orientation('map', Miller(1,0,-1,1,cs_hex.properGroup), Miller(0,1,-1,-1,cs_hex.properGroup),...
Miller(3,-1,-2,2,cs_hex.properGroup), Miller(-2,3,-1,-2,cs_hex.properGroup));
angle_T5 = angle(T5)/degree;
angleList_T5 = vertcat(angleList_T5, angle_T5);
axisList_T5(count) = axis(T5);
count = count + 1;
end
figure
xAx = [1:0.1:9.8];
plot(xAx,angleList_T1,'-k','LineWidth',2,'Marker','o','MarkerFaceColor','k','MarkerSize',10)
hold all
plot(xAx,angleList_T2,'-r','LineWidth',2,'Marker','s','MarkerFaceColor','r','MarkerSize',10)
plot(xAx,angleList_T3,'-g','LineWidth',2,'Marker','d','MarkerFaceColor','g','MarkerSize',10)
plot(xAx,angleList_T4,'-b','LineWidth',2,'Marker','p','MarkerFaceColor','b','MarkerSize',10)
plot(xAx,angleList_T5,'-m','LineWidth',2,'Marker','h','MarkerFaceColor','m','MarkerSize',10)
xlabel('c/a ratio','FontSize',14,'FontWeight','bold');
ylabel('Ideal parent-twin misoriention angle','FontSize',14,'FontWeight','bold');
legend('T1','T2','T3','T4','T5');
set(gca,'fontsize',14);
hold off
figure
plot(axisList_T1,'FundamentalRegion','symmetrised','antipodal','MarkerSize',10);
figure
plot(axisList_T2,'FundamentalRegion','symmetrised','antipodal','MarkerSize',10);
figure
plot(axisList_T3,'FundamentalRegion','symmetrised','antipodal','MarkerSize',10);
figure
plot(axisList_T4,'FundamentalRegion','symmetrised','antipodal','MarkerSize',10);
figure
plot(axisList_T5,'FundamentalRegion','symmetrised','antipodal','MarkerSize',10);