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:270if 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')endend
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!
Best Answer