cs = crystalSymmetry('cubic',[3.523,3.523,3.523],'mineral','Nickel')
% twin plane
n=Miller({1,1,1},{1,1,1},{1,1,1},{-1,1,1},{-1,1,1},{-1,1,1},{1,-1,1},{1,-1,1},{1,-1,1},{1,1,-1},{1,1,-1},{1,1,-1},cs);
% twin direction
b=Miller({1,1,-2},{1,-2,1},{-2,1,1},{-1,1,-2},{-1,-2,1},{2,1,1},{-2,-1,1},{1,2,1},{1,-1,-2},{-2,1,-1},{1,-2,-1},{1,1,2},cs);
%use function of slip
sS = slipSystem(n,b)
r = plotS2Grid(fundamentalSector(cs),'resolution',0.2*degree)
% compute the Schmid factors for all slip systems and all tension directions
tau = SchmidFactor(sS,r);
% tau is a matrix with columns representing the Schmid factors for the
% different twin systems. Lets take the maximum rhowise
[tauMax,id] = max(abs(tau),[],2);
contourf(r,tauMax)
mtexColorbar