electron diffraction pattern !

8 Ansichten (letzte 30 Tage)
Syed Ali Hassan
Syed Ali Hassan am 27 Aug. 2020
Bearbeitet: Syed Ali Hassan am 27 Aug. 2020
This is my code , I started with making and ideal crystal in 2D, then I tried to plot the lattice points and reciprocal lattice coordinates in lattice space, Now I know that I need to formula of 2dsin(theta)=n(lemdda) , I am not sure, I need to calculate the electron diffraction pattren from this simple cube. can anyone help me out !
% 2D Crystal Translation Vectors
Primitivelattice=0;
Cellsize=0;
switch Primitivelattice
case 0
a=[1 0 0];
b=[0 1 0];
c=[0 0 100];
case 1
a=[1 0 0];
b=[0 2 0];
c=[0 0 100];
end
% define the size of the cell
switch Cellsize
case 0
n1=5;
n2=7;
case 1
n1=4;
n2=6;
end
%Unit vectors
x_hat=[1 0 0];
y_hat=[0 1 0];
z_hat=[0 0 1];
%% direct speace lattice points
%calculating coordinates of each lattice point in real space
%calculating the distacne (lattice constant) from the origin
[X,Y,Z]= meshgrid(1:n1,1:n2,1);
Rx=X*dot(a,x_hat)+Y*dot(b,x_hat)+Z*dot(c,x_hat);
Ry=X*dot(a,y_hat)+Y*dot(b,y_hat)+Z*dot(c,y_hat);
Rz=X*dot(a,z_hat)+Y*dot(b,z_hat)+Z*dot(c,z_hat);
% Output of Coordinates for each lattice point
fprintf(1,'\n\nTable 1: Real Space Lattice Coordinates [in units of a])\n');
fprintf(1,' [Note: The Rz values are ignored for the 2D Case.\n');
for i=1:n2
for j=1:n1
fprintf(1,'%d %d %8.5f %8.5f %8.5f\n',i,j,Rx(i,j),Ry(i,j),Rz(i,j));
end
end
%plotting of coodinates
figure (1)
plot(Rx,Ry,'o')
hold on
xlabel(['Rx [a]'],'fontsize',14,'fontweight','bold','fontname','Thoma');
ylabel(['Ry [a]'],'fontsize',14,'fontweight','bold','fontname','Thoma');
title(['Lattice Space'],'fontsize',14,'fontweight','bold','fontname','Thoma');
%Calculating Reciprocal lattice Points
%Calculating the coordiante of reciprocal lattice space
volume=dot(a,cross(b,c));
a_recp=2.0*pi*cross(b,c)/volume;
b_recp=2.0*pi*cross(c,a)/volume;
c_recp=2.0*pi*cross(a,b)/volume;
[X,Y,Z]=meshgrid(1:n1,1:n2,1);
Kx=X*dot(a_recp,x_hat)+Y*dot(b_recp,x_hat)+Z*dot(c_recp,x_hat);
Ky=X*dot(a_recp,y_hat)+Y*dot(b_recp,y_hat)+Z*dot(c_recp,y_hat);
Kz=X*dot(a_recp,z_hat)+Y*dot(b_recp,z_hat)+Z*dot(c_recp,z_hat);
figure (2)
hold on
plot(Kx,Ky,'*')
xlabel(['Kx [1/a]'],'fontsize',14,'fontweight','bold','fontname','Tahoma');
ylabel(['Ky [1/a]'],'fontsize',14,'fontweight','bold','fontname','Tahoma');
title(['Reciprocal Lattice Space'],'fontsize',14,'fontweight','bold','fontname','Tahoma');
box on;

Antworten (0)

Kategorien

Mehr zu Condensed Matter & Materials Physics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by