Borrar filtros
Borrar filtros

How to generate a fcc crystal matrice?

24 visualizaciones (últimos 30 días)
Chenyue Xu
Chenyue Xu el 10 de Jul. de 2017
Editada: Walter Roberson el 5 de Feb. de 2024
I would like to generate a fcc crystal lattice with its atomic positions in a matrice of 3 columns. I tried to expand the crystal by translating the unit cell, but I struggle with the translation vectors and loops. Can someone suggest me a fast method? Thanks!
  4 comentarios
John D'Errico
John D'Errico el 10 de Jul. de 2017
Then my answer provides the desired coordinates.
Chenyue Xu
Chenyue Xu el 10 de Jul. de 2017
Yes, it's perfect if you can help me on the coordinates! Thanks

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 10 de Jul. de 2017
Editada: John D'Errico el 10 de Jul. de 2017
Easy enough if all you need are the FCC nodes in an unstructured sequence.
fccbase = [dec2bin(0:7) - '0';.5 .5 0;.5 .5 1;.5 0 .5;.5 1 .5;0 .5 .5;1 .5 .5];
[latx,laty,latz] = ndgrid(0:2,0:2,0:2);
latxyz = [latx(:),laty(:),latz(:)];
latxyz = repmat([latx(:),laty(:),latz(:)],14,1);
latxyz = latxyz + reshape(permute(repmat(fccbase,[1,1,prod(size(latx))]),[3 1 2]),[],3);
latxyz = unique(latxyz,'rows');
plot3(latxyz(:,1),latxyz(:,2),latxyz(:,3),'o')
The basic idea should be clear. I've taken advantage of one nice fact, that unique will be exactly able to locate numbers that are integers, or integers plus 0.5. All of those numbers are exactly representable in double precision. So there is no need even to use a tolerance.

Más respuestas (2)

Jose Martinez
Jose Martinez el 26 de Mayo de 2019
function FCCLattice = FCCMake(a,V)
% "a" is the Lattice Parameter:
a = a;
%Set the Volume of the cube in variable V:
V = V; %This means your cube will be of dimensions VxVxV.
%%%----Code-----%%%
%Create an array that stores all your coordinates:
%First you will need to establish the number of atoms
%that the array will have, we will do this by establishing
%the known number of atoms, in this case FCC 4xVxVxV.
N = V*V*V*4;
%This array will gives is a matrix of Nx3, that will store data.
FCCLattice = zeros(N,3);
%Create the vectors for the atoms position in the FCC Lattice:
FCCatoms = [0 0 0;(a/2) (a/2) 0;(a/2) 0 (a/2);0 (a/2) (a/2)];
%Set a variable to change rows in the array storing the coordinates:
n = 0;
%Create 3 For loops to mix the positions between xyz
for x = 0:V-1
for y = 0:V-1
for z = 0:V-1
for i = 1:4
%Create a vector that translate your location in the
%coordinate system into the position in the crystal:
coordinatestranslation = a*[x y z];
%Add 1 to move one row down in the array:
n = n+1;
FCCLattice(n,:) = coordinatestranslation +FCCatoms(i,:);
end
end
end
end
end
I have created this code for my undergraduate research if it works!
  1 comentario
Muthukumar
Muthukumar el 5 de Feb. de 2024
I tried this code I couldn't get the expected results. I could use some help

Iniciar sesión para comentar.


Jean-Marie Becker
Jean-Marie Becker el 23 de Dic. de 2020
Editada: Walter Roberson el 5 de Feb. de 2024
%Here is a simple solution:
k=4; a=1/2;
[X,Y,Z]=meshgrid(0:k);
x=X(:);x=[x;x+a;x+a;x];
y=Y(:);y=[y;y;y+a;y+a];
z=Z(:);z=[z;z+a;z;z+a];
plot3(x,y,z,'or');view(-40,20);

Categorías

Más información sobre Crystals en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by