# scriptfile: bloch_mode.lsf #disable bandstructure analysis group and enable a dipole source setnamed("dipole_cloud","enabled",0); setnamed("bandstructure","enabled",0); setnamed("source1","enabled",1); run; #clear all the current data clear; #collect the data from the DFT monitors u1 = pinch(getelectric("lower")); u2 = pinch(getelectric("upper")); f1 = getdata("lower","f"); f2 = getdata("upper","f"); x = getdata("lower","x"); y = getdata("lower","y"); z = getdata("lower","z"); #find the middle point in z to plot a cross section dim = size(u1); midz = round(dim(3)/2); midy = round(dim(2)/2); #plot the results image(x*1e6,y*1e6,pinch(u1,3,midz),"x (microns)","y (microns)","Section of Bloch mode at " + num2str(f1*1e-12) + " THz"); image(x*1e6,y*1e6,pinch(u2,3,19),"x (microns)","y (microns)","Section of Bloch mode at " + num2str(f2*1e-12) + " THz"); image(x*1e6,z*1e6,pinch(u1,2,midy),"x (microns)","z (microns)","Section of Bloch mode at " + num2str(f1*1e-12) + " THz"); image(x*1e6,z*1e6,pinch(u2,2,midy),"x (microns)","z (microns)","Section of Bloch mode at " + num2str(f2*1e-12) + " THz");