n=4;

q=2;

r=3/2;

s=1;

t=1;

sigmax = {{0,1},{1,0}};

sigmay = {{0,-I},{I,0}};

sigmaz = {{1,0},{0,-1}};

I2 = IdentityMatrix[2];

AA= q*KroneckerProduct[sigmaz,sigmax];

MatrixForm[AA]

BB= {{r,-I,0,0},{I,0,0,0},{0,0,0,I},{0,0,-I,r}};

MatrixForm[BB]

CC= s*KroneckerProduct[sigmaz,sigmaz];

MatrixForm[CC]

DD = t*KroneckerProduct[sigmax,I2];

MatrixForm[DD]

loclzrHalf=KroneckerProduct[I*sigmax,AA -  w*IdentityMatrix[4]] +KroneckerProduct[I*sigmay,BB - x*IdentityMatrix[4]] +KroneckerProduct[I*sigmaz,CC -  y*IdentityMatrix[4]]+KroneckerProduct[I2,DD -  z*IdentityMatrix[4]];

charpoly=FullSimplify[Det[loclzrHalf]]

Factor[charpoly]

localizerHalfAtZero = ReplaceAll[loclzrHalf,z->0];

gma = KroneckerProduct[IdentityMatrix[2],KroneckerProduct[sigmaz,IdentityMatrix[2]]];

MatrixForm[gma];

madeHermitian = ExpandAll[I *localizerHalfAtZero.gma];

MatrixForm[madeHermitian]

kTheory =FullSimplify[Det[madeHermitian]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->0,x->0,y->0}]]]]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->0.1,x->0,y->0}]]]]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->0,x->2,y->0}]]]]]

(1/2)*Total[Sign[Eigenvalues[N[ReplaceAll[madeHermitian,{w->2,x->0,y->2}]]]]]

step = 1/5;

plots=ParallelTable[ContourPlot3D[charpoly==0,{w,-2,2},{x,-2,2},{y,-2,2},Contours->{{1,LightBlue}},PlotPoints->100,ViewPoint->{7,-18,2}],{z,0,3*step ,step}]

Export["AIII_class_sphere_deform_r_3_halves_z_1.eps",plots[[1]],ImageSize->3.2*72];

Export["AIII_class_sphere_deform_r_3_halves_z_2.eps",plots[[2]],ImageSize->3.2*72];

Export["AIII_class_sphere_deform_r_3_halves_z_3.eps",plots[[3]],ImageSize->3.2*72];

Export["AIII_class_sphere_deform_r_3_halves_z_4.eps",plots[[4]],ImageSize->3.2*72];