Rotational symmetries of cubic crystal structures

10 ビュー (過去 30 日間)
Ozan Terzioglu
Ozan Terzioglu 2019 年 1 月 2 日
コメント済み: Ozan Terzioglu 2019 年 1 月 2 日
Hey everyone,
For my senior project, I need to first plot the various crystal structures (simple cubic, body-centered, hexagonal) and then study their symmetries. I have been able to create the structures as below. I will only give the simplest so that people who are not interested in physical chemistry can easily understand aswell.
xcord=[0 1 0 0 1 1 0 1];
ycord=[0 0 1 0 1 0 1 1];
zcord=[0 0 0 1 0 1 1 1];
figure(1)
unitcell = scatter3(xcord(:), ycord(:), zcord(:),100,'fill','b');
axis([-1 1 -1 1 -1 1])
xlabel('x')
ylabel('y')
zlabel('z')
I have also rotated this cubic structure along X, Y and Z axises by products of 90 degrees as given below (only written X axis to keep it short);
xcord=[0 1 0 0 1 1 0 1];
ycord=[0 0 1 0 1 0 1 1];
zcord=[0 0 0 1 0 1 1 1];
figure(1)
unitcell = scatter3(xcord(:), ycord(:), zcord(:),100,'fill','b');
axis([-1 1 -1 1 -1 1])
xlabel('x')
ylabel('y')
zlabel('z')
%Rotate along x axis
for i = 90:90:270
if i == 90;
X = xcord;
Y = -ycord;
Z = zcord;
figure(2)
scatter3(X,Y,Z,100,'fill','b');
axis([-1 1 -1 1 -1 1])
title('Rotation along x axis for 90 degrees')
xlabel('x')
ylabel('y')
zlabel('z')
elseif i == 180;
X = xcord;
Y = -ycord;
Z = -zcord;
figure(3)
scatter3(X,Y,Z,100,'fill','b');
axis([-1 1 -1 1 -1 1])
title('Rotation along x axis for 180 degrees')
xlabel('x')
ylabel('y')
zlabel('z')
else
X = xcord;
Y = ycord;
Z = -zcord;
figure(4)
scatter3(X,Y,Z,100,'fill','b');
axis([-1 1 -1 1 -1 1])
title('Rotation along x axis for 270 degrees')
xlabel('x')
ylabel('y')
zlabel('z')
end
end
My problem starts here. Yes I can hardcode the coordinates but I need to show that there will be no symmetry for, for example 120 degrees of rotation. Is there any way I can make it simpler and plot for various angles other than products of 90? I have tried the 'rotate' function but haven't been able to make it work.
Also, my other question is; how can I rotate this along an axis passing through (0,0,0) and (1,1,1) or other arbitrary axises other than X, Y and Z. Your help will be much appriciated.
Thanks and have a nice year!

採用された回答

Michael Madelaire
Michael Madelaire 2019 年 1 月 2 日
I have made with without the use of build-in functions: I believe it is important for you to know how to rotate around an axis and not just use a function.
Take a look at Rotation matrix, specifically in the section "Basic rotations".
I have implemented the R_x matrix from the above link.
xcord=[0 1 0 0 1 1 0 1];
ycord=[0 0 1 0 1 0 1 1];
zcord=[0 0 0 1 0 1 1 1];
figure;
unitcell = scatter3(xcord(:), ycord(:), zcord(:),100,'fill','b');
plotLinesTheStupidWay(xcord, ycord, zcord);
axis([-1 1 -1 1 -1 1]*1.5)
xlabel('x')
ylabel('y')
zlabel('z')
angleStepSize = 1;
pos = [xcord; ycord; zcord];
for i = 0:angleStepSize:360
theta = i;
rotX = [1, 0, 0; 0, cosd(theta), -sind(theta); 0, sind(theta), cosd(theta)];
for j = 1:length(xcord)
foo = rotX*pos(:,j);
xcord(j) = foo(1);
ycord(j) = foo(2);
zcord(j) = foo(3);
end
unitcell = scatter3(xcord(:), ycord(:), zcord(:),100,'fill','b');
plotLinesTheStupidWay(xcord, ycord, zcord)
axis([-1 1 -1 1 -1 1]*1.5)
pause(0.1);
end
function plotLinesTheStupidWay(xcord, ycord, zcord)
hold on;
plot3([xcord(1), xcord(2)], [ycord(1), ycord(2)], [zcord(1), zcord(2)], '-r');
plot3([xcord(1), xcord(3)], [ycord(1), ycord(3)], [zcord(1), zcord(3)], '-r');
plot3([xcord(1), xcord(4)], [ycord(1), ycord(4)], [zcord(1), zcord(4)], '-r');
plot3([xcord(2), xcord(5)], [ycord(2), ycord(5)], [zcord(2), zcord(5)], '-r');
plot3([xcord(2), xcord(6)], [ycord(2), ycord(6)], [zcord(2), zcord(6)], '-r');
plot3([xcord(3), xcord(7)], [ycord(3), ycord(7)], [zcord(3), zcord(7)], '-r');
plot3([xcord(3), xcord(5)], [ycord(3), ycord(5)], [zcord(3), zcord(5)], '-r');
plot3([xcord(5), xcord(8)], [ycord(5), ycord(8)], [zcord(5), zcord(8)], '-r');
plot3([xcord(8), xcord(6)], [ycord(8), ycord(6)], [zcord(8), zcord(6)], '-r');
plot3([xcord(8), xcord(7)], [ycord(8), ycord(7)], [zcord(8), zcord(7)], '-r');
plot3([xcord(4), xcord(6)], [ycord(4), ycord(6)], [zcord(4), zcord(6)], '-r');
plot3([xcord(4), xcord(6)], [ycord(4), ycord(6)], [zcord(4), zcord(6)], '-r');
plot3([xcord(4), xcord(7)], [ycord(4), ycord(7)], [zcord(4), zcord(7)], '-r');
hold off
end
  1 件のコメント
Ozan Terzioglu
Ozan Terzioglu 2019 年 1 月 2 日
This looks awesome! Thanks a lot.

サインインしてコメントする。

その他の回答 (1 件)

Bruno Luong
Bruno Luong 2019 年 1 月 2 日
xcord=[0 1 0 0 1 1 0 1];
ycord=[0 0 1 0 1 0 1 1];
zcord=[0 0 0 1 0 1 1 1];
xyz = [xcord; ycord; zcord];
theta = pi/3;
M = makehgtform('xrotate',theta);
R = M(1:3,1:3);
xyzr = R*xyz;
X = xyzr(1,:);
Y = xyzr(2,:);
Z = xyzr(3,:);
scatter3(X,Y,Z,100,'fill','b');
axis([-1 1 -1 1 -1 1])
title(sprintf('Rotation along x axis for %g degrees',theta*180/pi))
xlabel('x')
ylabel('y')
zlabel('z')
  1 件のコメント
Ozan Terzioglu
Ozan Terzioglu 2019 年 1 月 2 日
Thanks a lot for your answer,
This one somehow deforms the structure. I could not figure it out

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by