/**copyright by Emanuele Dalla Torre - Technion 2002*/ /* Misuration Unit Uo=1 --> Uo= 1ev a=1 --> a = 1 A b=1 --> b = 1 A k=1 --> k = 1/(a+b) z=1 --> E = 1Uo Dominium -PI <= k <= PI 0 <= z <= maxZ */ class KronigPenney { final long MAXTIME=(long)15e3; final double MIN=1e-3, MAX=1e3; final String errorMsg1="I couldn't find any band", errorMsg2= " OR one or more values are not correct:", errorMsg3="d-b>"+MIN+" , "+MIN+"<=U*b<="+MAX+" , 1<=number<=10"; final double HbarC=1975.8, mC2=0.511e6; double a, b, Uo; //please don't write from other classes! int number,effective,valency;//if zero --> nothing shown, if greater then zero --> something shown KPBand[] band; //public static void main (String[] s) // {KPWindow f=new KPWindow();} void set(double a, double b, double Uo,int number, int effective, int valency) { this.a=a; this.b=b; this.Uo=Uo; this.number=((a>=MIN)&&(b>=0)&&(b*Uo>=MIN)&&(b*Uo<=MAX))?number:0; this.effective=(effective<=number)?effective:0; this.valency=(valency<=number-1)?valency:0; band=new KPBand[100]; scan(); } private void scan() //calculate minZ, maxZ { double step=1e-10; double newZ=step, newcosdk=cosdk(newZ), newK=k(newZ); double oldZ ,oldcosdk, oldK; int n=1;//found bands long counter=0; boolean permitted=false; long start=System.currentTimeMillis(); while ((n<=number)&&( (counter>0)||(System.currentTimeMillis()(float)-1)){return (Math.acos(value)/(a+b));} else return (Double.NaN); } static double cosh(double a) {return ((Math.exp(a)+Math.exp(-a))/2);} static double sinh(double a) {return ((Math.exp(a)-Math.exp(-a))/2);} static double cos(double a) {return Math.cos(a);} static double sin(double a) {return Math.sin(a);} static double sqrt(double a) {return Math.sqrt(a);} }