1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#include <iostream>
#include <math.h>
#include <fstream>
#include <stdio.h>
using namespace std;
int main()
{
double k,q,p,y;
double E; //Electron energy (V)
double V=0.3; //Bias (V)
double U=1.5; //Barrier Height (V)
double d=3.0e-10; //Barrier width (m)
const double m=0.510998928e6; //Electron mass (eV/c^2)
const double hbar=6.58211928e-16; //Reduced Planck constant (eV.s)
const double c=299792458.0; //Speed of light (m/s)
const double eV=1.60217657e-19; //Electron charge
double R_lr, R_rl; //Reflection coefficient
double T_lr, T_rl; //Transmission coefficient
double j_tl; //Total Current left region
double j_tr; //Total Current right region
FILE *STMdata;
STMdata=fopen("STMdata_table.xls","w");
fprintf(STMdata,"Energy \t Reflection (L-R) \t Transmission (L-R) \t Reflection (R-L) \t Transmission (R-L) \t Total Current Left \t Total Current Right \n");
for(float E=0.5;E<10.0;E+=0.01)
{
if (E>U+V)
{
k=((sqrt(2*(m/(c*c))*(E-V)))/hbar);
q=((sqrt(2*(m/(c*c))*(E-U-V)))/hbar);
p=((sqrt(2*(m/(c*c))*E))/hbar);
R_lr=(q*q*(k-p)*(k-p)*cos(q*d)*cos(q*d)+(q*q-p*k)*(q*q-p*k)*sin(q*d)*sin(q*d))/
(q*q*(k+p)*(k+p)*cos(q*d)*cos(q*d)+(q*q+p*k)*(q*q+p*k)*sin(q*d)*sin(q*d));
T_lr=(4*k*k*q*q)/
(q*q*(k+p)*(k+p)*cos(q*d)*cos(q*d)+(q*q+p*k)*(q*q+p*k)*sin(q*d)*sin(q*d));
R_rl=R_lr;
T_rl=((p*p)/(k*k))*T_lr;
//Total Current
j_tl=((eV*hbar*k)/(m/c*c))*(1 - R_lr - T_rl);
j_tr=((eV*hbar*p)/(m/c*c))*(T_lr + R_rl - 1);
}
else if (V<E<U+V)
{
k=((sqrt(2*(m/(c*c))*(E-V)))/hbar);
y=((sqrt(2*(m/(c*c))*(V+U-E)))/hbar);
p=((sqrt(2*(m/(c*c))*E))/hbar);
R_lr=(y*y*(k-p)*(k-p)*cosh(y*d)*cosh(y*d)+(-(y*y)-p*k)*(-(y*y)-p*k)*sinh(y*d)*sinh(y*d))/
(y*y*(k+p)*(k+p)*cosh(y*d)*cosh(y*d)+(-(y*y)+p*k)*(-(y*y)+p*k)*sinh(y*d)*sinh(y*d));
T_lr=(4*k*k*y*y)/
(y*y*(k+p)*(k+p)*cosh(y*d)*cosh(y*d)+(-(y*y)+p*k)*(-(y*y)+p*k)*sinh(y*d)*sinh(y*d));
R_rl=R_lr;
T_rl=((p*p)/(k*k))*T_lr;
//Total Current
j_tl=((eV*hbar*k)/(m/c*c))*(1 - R_lr - T_rl);
j_tr=((eV*hbar*p)/(m/c*c))*(T_lr + R_rl - 1);
}
fprintf(STMdata,"%f \t %f \t %f \t %f \t %f \t %f \t %f \n",E,R_lr,T_lr,R_rl, T_rl,j_tl,j_tr);
}
fclose(STMdata);
return 0;
}
|