Cristallography - Application and visualisation

By Alexis Gervaix

A little bit of theory

Bravais Lattice

Bravais lattice structures are a way to visualize the several positions that can take the atoms in a certain crystal. As we can see in this diagram, there are 14 of these structures where the three-main axis (or primitive cell), here called a, b and c, will be different in norm and angle.

For this tool, we will concentrate on Simple Cubic, Face-Centered Cubic and Body-Centered Cubic

Interstitial sites

Two main cathegories:
•	Octahedral sites
 •	Tetrahedral sites

For Cubic Simple:
There is only 1 octahedral site

For BCC:
There is 6∙4∙(1/2) = 12 tetrahedral sites and 6 ∙ (1/2) = 3 octahedral sites

For FCC:
There is 8 tetrahedral sites and 1 + 12 ∙ (1/4) = 4octahedral sites

Above, on top the interstitial sites of a FCC lattice and below the octahedral and tetrahedral sites of the BCC lattice.

The purpose of this program is to help you visualize 3 of the Bravais crystallographic structures: Cubic simple, Body-centered cubic, Face-centered cubic.

First, Evaluate the 2 parts of the program by selecting them and entering shift + enter.

On the left, the panel will give you several controls that will allow you to choose:

The structure in which the atoms organize themselves : the Bravais Lattice (http://www.physics-in-a-nutshell.com/article/6)

The element. Here you have the opportunity to mix two types of atoms together, assuming a 50%/50% composition. Of course you can select the same element if the structure you are looking for is monoatomic.

Interstitial atoms, with the Tetrahedral and Octahedral position. You can choose to display them or not and also chose the type of atom for the interstitial.

On the right, the display that will show you:

A periodic table will allow you to choose the elements by clicking on it, **** Please note, the display panel is updated when you clic on the periodic table, for stability reason****

A 3D graphic of the first Bravais lattice, with the atoms, their name and color and positions.

A graph helping you to visualize the length needed for the calculation of the volume density corresponding to the structure you choosed.

Interactive part

Structure function

cSStructure[pointListCS_,edgePointListCS_,centerPointListCS_,tetraPointListCS_,octaPointListbCCS_] :={
pointListCS = Tuples[Range[0,1],3];
edgePointListCS =Select[Tuples[Range[0,1],3],Mod[Total[#],2]==0&];
centerPointListCS = ReplaceAll[pointListCS, Table[edgePointListCS[[i]] -> {},{i,1,Length[edgePointListCS]}]];
centerPointListCS=centerPointListCS //.{}:>Unevaluated[##&[]];
tetraPointListCS = {0,0,0};
octaPointListbCCS= {0.5,0.5,0.5};

(*Function that defines the point location for the Cubic Simple lattice. 
PointList : All unit cell point;
  EdgePointLst: Summit points of the unit cell;
  CenterPointList: Middle points, often positionned on the edges;
  Tetrapointlist: Tetrahedral interstitial positions; 
  OctaPointList: Octahedral interstitial positions*)
};

fCCStructure[pointListfCC_,edgePointListfCC_,centerPointListfCC_,tetraPointListfCC_,octaPointListfCC_] :={
 pointListfCC= Select[Tuples[Range[0,2],3],Mod[Total[#],2]==0&];
centerPointListfCC = Table[Select[a=pointListfCC[[i]],a[[1]]== 1 ||a[[2]]== 1 ||a[[3]]== 1 &],{i,1,Length[pointListfCC]}];
centerPointListfCC=centerPointListfCC //.{}:>Unevaluated[##&[]];
edgePointListfCC= ReplaceAll[pointListfCC, Table[centerPointListfCC[[i]] -> {},{i,1,Length[centerPointListfCC]}]];
edgePointListfCC=edgePointListfCC//.{}:>Unevaluated[##&[]];
octaPointListfCC={{1,1,1},{1,0,0},{1,0,2},{1,2,0},{0,1,0},{0,1,2},{2,1,0},{0,0,1},{2,0,1},{0,2,1},{0,1,0},{0,0,1},{2,2,1},{2,1,2},{1,2,2}};
tetraPointListfCC = Mod[Tuples[{-0.5,0.5},3],2];

(*Function that defines the point location for the Face-centered cubic lattice. *)
};

bCCStructure[pointListbCC_,edgePointListbCC_,centerPointListbCC_,tetraPointListbCC_,octaPointListbCC_]:={pointListbCC= {{0,0,0},{0,0,2},{0,2,0},{0,2,2},{2,0,0},{2,0,2},{2,2,0},{2,2,2},{1,1,1}};
centerPointListbCC= {{0,0,0},{0,0,2},{0,2,0},{0,2,2},{2,0,0},{2,0,2},{2,2,0},{2,2,2}};
edgePointListbCC = {1,1,1};
tetraPointListbCC={{1,0.5,0},{1.5,1,0},{1,1.5,0},{0.5,1,0},{1,0,0.5},{1.5,0,1},{1,0,1.5},{0.5,0,1},{1,0.5,2},{1.5,1,2},{1,1.5,2},{0.5,1,2},{1,2,0.5},{1.5,2,1},{1,2,1.5},{0.5,2,1},{0,1,0.5},{0,0.5,1},{0,0.5,1.5},{0,1.5,1},{2,1,0.5},{2,0.5,1},{2,0.5,1.5},{2,1.5,1}};
octaPointListbCC = {{1,1,0},{1,1,2},{0,1,1},{2,1,1},{1,0,1},{1,2,1}};


(*Function that defines the point location for the Body-centered cubic lattice. *)
};

Manipulation tool

Manipulate[

DynamicModule[ (*Module that initiate internal variables - They won't affect the similar variables outside this cell. *)
{pointListDisplay,
edgePointListDisplay,
centerPointListDisplay,
tetraPointListDisplay,octaPointListDisplay, (*All the location point defined in the lattice function, the "Display" variables will be taking the values of the choosen lattice in the function above. *)
atom1,atom2,inter1,inter2 (*Get the name of the choosen element, interact with "ColorData["Atoms"] function*)
},
{

{atom1,atom2,inter1,inter2}={"Atom 1","Atom 2","Interstitial Tetrahedral","Interstitial Octahedral"}/.data; 



Switch[structure,
"fCC",{fCCStructure[pointListDisplay,edgePointListDisplay,centerPointListDisplay,tetraPointListDisplay,octaPointListDisplay]},(* Gives the primitive cell When the Face Centered Cubic structure is selected*)
"cS",cSStructure[pointListDisplay,edgePointListDisplay,centerPointListDisplay,tetraPointListDisplay,octaPointListDisplay],
(* Gives the primitive cell When the Simple Cubic structure is selected*)
"bCC",bCCStructure[pointListDisplay,edgePointListDisplay,centerPointListDisplay,tetraPointListDisplay,octaPointListDisplay]
(* Gives the primitive cell When the Body Centered Cubic structure is selected*)];
,

Grid[{{
Row[ (*Definition of the Periodic table for the element choice*){ColorData["Atoms","Panel"]/.e_EventHandler:>(e/.{HoldPattern["MouseClicked":>_]:>(*replace mouse-click action*)("MouseClicked":>(atomselement=atomName[e];data[atomSelection]=atomselement)),r_Rectangle:>(*add dynamic style to elements*){Dynamic[If[atomselement===atomName[e],{EdgeForm[Directive[Opacity[1],Thick,Red]],Opacity[0.6],r},{EdgeForm[None],r}]]}})}],


(*3D graphic of the unit cell*)
Graphics3D[{
(*Additional axis and marks*)
If[structure ≠ "cS",{
axes={Dashing[{.03,.02}],Thickness[.001],
RGBColor[0,.5,1],Line[{{0,0,0},{2,2,2}}],Line[{{0,2,0},{2,0,2}}],Line[{{2,0,0},{0,2,2}}],Line[{{0,0,2},{2,2,0}}],
RGBColor[1,.5,0],Line[{{0,1,1},{2,1,1}}],Line[{{1,1,0},{1,1,2}}],Line[{{1,0,1},{1,2,1}}]}},
 {axes={Dashing[{.03,.02}],Thickness[.001],
RGBColor[0,.5,1],Line[{{0,0,0},{1,1,1}}],Line[{{0,1,0},{1,0,1}}],Line[{{1,0,0},{0,1,1}}],Line[{{0,0,1},{1,1,0}}],
RGBColor[1,.5,0],Line[{{0,0.5,0.5},{1,0.5,0.5}}],Line[{{0.5,0.5,0},{0.5,0.5,1}}],Line[{{0.5,0,0.5},{0.5,1,0.5}}]}}
],

(*Spheres*)
{ColorData["Atoms",data[[1]]],Sphere[edgePointListDisplay,atomsize]},
{ColorData["Atoms",data[[2]]],Sphere[centerPointListDisplay,atomsize]},
(* Yes/No display of intersitial? + No tetrahedral in Cubic simple*)
If[structure ≠ "cS",If[tetratest == "Yes",{ColorData["Atoms",data[[3]]],Sphere[tetraPointListDisplay,atomsize]}]], 
If[octatest == "Yes",{ColorData["Atoms",data[[4]]],Sphere[octaPointListDisplay,atomsize]}],

(*Atom name display on the center*)
If[displayatomname =="Yes",{Text[Style[data[[1]],Bold],edgePointListDisplay],
If[data[[1]]≠ data[[2]],Text[Style[data[[2]],Bold],centerPointListDisplay]],
If[structure ≠ "cS",If[tetratest == "Yes",Text[Style[data[[3]],Bold],tetraPointListDisplay]]],
If[octatest == "Yes",Text[Style[data[[4]],Bold],octaPointListDisplay]]}]

},Axes->True,ImageSize->{400,400} (*Possibility to change the graphic size*)
](*End Graphics Lattice*)
},{(*End Lattice grid first line*)

If[structure == "bCC",{Graphics3D[{ (* Bottom left graphic that will give the length to calculate the unit cell density, adapted for each lattice *)
{Opacity[0.1],Cuboid[{0,0,0},{2,2,2}]},
{Opacity[0.5],Sphere[{0,0,0},(2Sqrt[3]/4)],
Sphere[{1,1,1},(2Sqrt[3]/4)],
Sphere[{2,2,2},(2Sqrt[3]/4)]},
{Blue,Thick,Line[{{0,0,0},{2,2,2}}],
Green,Line[{{0,0,0},{0,2,2}}],
Red,Line[{{0,0,0},{0,0,2}}]},
{
{Red,Text["a",{-0.2,-0.2,1}]},
{Green,Text["a"*Sqrt[2],{-0.4,1,1}]},
{Blue,Text["a"*Sqrt[3],{1,1,1.3}]}


}
}, Boxed ->False,ImageSize->Medium

]},
If[structure== "fCC",{Graphics[{
Circle[{0,0},(2Sqrt[2]/4)],
Circle[{1,1},(2Sqrt[2]/4)],
Circle[{2,2},(2Sqrt[2]/4)],
{Blue,Line[{{0,0},{2,2}}]},
{EdgeForm[{Red}],FaceForm[],Rectangle[{0,0},{2,2}]},
{Red,Text["c",{-0.25,1}]},
{Blue,Text[TraditionalForm["c"*Sqrt[2]],{1.25,0.75}]}
},Frame->True,ImageSize->Medium,FrameLabel->{{"y",""},{"x","FCC Density Calculation"}}]}

,
If[structure == "cS",{Graphics[{
Circle[{0,0},(1)],
Circle[{0,2},(1)],
{EdgeForm[{Black}],FaceForm[],Rectangle[{0,0},{2,2}]},
{Red,Text["c",{-0.15,1.4}]},
Red,Line[{{0,0},{0,2}}]

},Frame->True,ImageSize->Medium,FrameLabel->{{"y",""},{"x","CS Density Calculation"}}]}]
]]



}},Frame->True,Alignment->{{Right,Left},{Center,Center}}](*End Grid*)
}](*End DynamicModule*)
,(*End Manipulate-Expression*)

(* ***************************LOCAL VARIABLE************************************ *)

Style["First Lattice Structure",CMYKColor[1,0.8,0.15,0],12,Bold],
{{structure,"cS","Structure Type"},{"bCC","cS","fCC"}},
{{atomsize,0.2,"Atom Size"},0.05,0.9,0.05},Delimiter,
Style["Interstitial atoms",CMYKColor[1,0.8,0.15,0],12,Bold],
{{displayatomname,"Yes","Atome Name Display"},{"Yes","No"}},
{{tetratest,"No","Tetrahedral interstitial?"},{"Yes","No"}},
{{octatest,"No","Octahedral interstitial?"},{"Yes","No"}},Delimiter,
Style["Choice of the atom element",CMYKColor[1,0.8,0.15,0],12,Bold],
{{atomSelection,"Atom 1","Atom Selection"},{"Atom 1","Atom 2","Interstitial Tetrahedral","Interstitial Octahedral"},SetterBar[Dynamic[atomSelection,(atomSelection=#;atomselement=Lookup[data,atomSelection])&],First@#2,##3]&},
{{atomselement,"Na"},None},(*should be initialized to data[atom]*){{data,(*data base for selected categories (atomSelection)*)AssociationThread[{"Atom 1","Atom 2","Interstitial Tetrahedral","Interstitial Octahedral"}->{"Na","Cl","Mg","O"}]},None},

(*options*)TrackedSymbols:>{data},Initialization:>(*could add initialization of axis,axiselement,data*)(atomName[e_EventHandler]:=First@Cases[e,Style[name_String,___]:>name,Infinity,1]), (* This eventhandler assure that the graphics change only when the user clic on the periodic table. This could be improved. Neccessary for the infinite reallocation of the atom values*)
ControlPlacement->Left

]