Plotting a 2D crystal lattice from two primitive lattice vectors

조회 수: 52 (최근 30일)
I am trying generate a plot of a crystal lattice based on two prmitive lattice vectors:
v1= -0.5i + -sqrt(3)/2j
v2= 1i
where i and j are orhtogonal unit vecotors to represent the x and y directions.
I am not sure where to begin.
  댓글 수: 2
darova
darova 2019년 9월 8일
That is what you want?
crystal-lattices-and-unit-cells.png
Jennifer Garrison
Jennifer Garrison 2019년 9월 8일
It only needs to be 2D but yes. I basically need to define my own coordinate system that is not the standard cartesian one with those vectors and display the lattice points like you did.

댓글을 달려면 로그인하십시오.

채택된 답변

John D'Errico
John D'Errico 2019년 9월 8일
First, you need to understand that MATLAB does not understand what you intend by this notation:
v1= -0.5i + -sqrt(3)/2j
Both i and j are sqrt(-1) in MATLAB. They are not distinct. Instead, just write them as vectors:
v1= [-0.5, -sqrt(3)/2];
v2= [1 , 0];
[x,y] = meshgrid(0:10,0:5);
xy = [x(:),y(:)];
T = [v1;v2];
xyt = xy*T;
xt = reshape(xyt(:,1),size(x));
yt = reshape(xyt(:,2),size(y));
plot(xt,yt,'ro-')
hold on
plot(xt',yt','r-')
axis equal
axis square
untitled.jpg
  댓글 수: 3
Bjorn Gustavsson
Bjorn Gustavsson 2020년 4월 29일
Simply extend John's or my suggestion to 3-D. You can call meshgrid (or ndgrid) with 3 inputs and 3 outputs:
[i1,j2,k3] = meshgrid(0:3,0:4,0:2);
Then define your 3 lattice-vectors, and use plot3 to plot the grid.
savitha muthanna
savitha muthanna 2021년 8월 16일
@John D'Errico Would you know the primitive lattice vectors to generate a hex lattice with triangular(equilateral) cells?

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Bjorn Gustavsson
Bjorn Gustavsson 2019년 9월 8일
If you do it stepwise it becomes "not too tricky":
e1 = [-0.5; -sqrt(3)/2]; % Your unit
e2 = [1; 0]; % vectors
[I1,I2] = meshgrid(-10:10,-8:8); % A 2-D set of points
r_crystal = [e1,e2]*[I1(:)';I2(:)']; % calculate r_c = n*e1 + m*e2 for all points
plot(r_crystal(1,:),r_crystal(2,:),'.')
You can dood.e with how big crystal you want or what shape, but this should give you something.
HTH

Yarlapati Akshay
Yarlapati Akshay 2020년 4월 30일
r_1st=2
N_1st=

카테고리

Help CenterFile Exchange에서 Crystals에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by