Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

All,

I looked at the example on the Mathematica Website with the Carbon Diamond Lattice. Example I am referring to

I am wondering is there a way to highlight an individual plane such as the 111 or 110 plane? I like the example I am just not sure of my orientation.

Cheers, BEn


Code:

Manipulate[
 tet = PolyhedronData["Tetrahedron", "Faces"];
 tetv = PolyhedronData["Tetrahedron", "VertexCoordinates"];
 sp = {RGBColor[1, 1, 0.3], Sphere[{0, 0, 0}, sizes]};
 bar1 = {RGBColor[0.2, 1, 1], 
   Cylinder[{{0, 0, 0}, {0, 0, Sqrt[2/3] - 1/(2 Sqrt[6])}}, sizec]};
 bar2 = {RGBColor[0.3, 1, 1], 
   Cylinder[{{0, 0, 0}, {-(1/(2 Sqrt[3])), -(1/2), -(1/(2 Sqrt[6]))}},
     sizec]};
 bar3 = {RGBColor[0.4, 1, 1], 
   Cylinder[{{0, 0, 0}, {-(1/(2 Sqrt[3])), 1/2, -(1/(2 Sqrt[6]))}}, 
    sizec]};
 bar4 = {RGBColor[0.5, 1, 1], 
   Cylinder[{{0, 0, 0}, {1/Sqrt[3], 0, -(1/(2 Sqrt[6]))}}, sizec]};
 sp4 = Map[Translate[sp, #] &, tetv];
 base = {bar4, bar3, bar2, bar1, sp4, sp, If[tets, tet, {}]};
 dia = Rotate[
   Rotate[Map[Translate[base, #] &, tetv], -Cos[Sqrt[3]/3/2], {0, 1, 
     0}], Pi/4, {0, 0, 1}];

 cub = If[cubs, 
   Scale[PolyhedronData["Cube", "Edges"], 
    Sqrt[2] {1, 1, 1}, {0, 0, 0}], {}];
 diax = Table[Translate[{dia, cub}, {i Sqrt[2], 0, 0}], {i, n}];
 diay = Table[Translate[{dia, cub, diax}, {0, i Sqrt[2], 0}], {i, n}];
 diaz = Table[
   Translate[{dia, cub, diax, diay}, {0, 0, i Sqrt[2]}], {i, n}];

 Graphics3D[{dia, cub, diax, diay, diaz}, Boxed -> False, 
  SphericalRegion -> True, ImageSize -> 380],
 {{n, 0, "frequency"}, 0, 2, 1, RadioButton},
 {{sizec, 0.025, "cylinder size"}, 0, 0.5},
 {{sizes, 0.1, "sphere size"}, 0, 0.5},
 {{tets, False, "show tetrahedra"}, {True, False}},
 {{cubs, False, "show cubes"}, {True, False}}, 
 TrackedSymbols -> Manipulate]
share|improve this question
2  
Please, can you be more specific ? If possible provide the code you are working on to illustrate by example what you are asking. –  Sektor Nov 6 '13 at 19:08
    
Sorry there is not enough space in the comment to put the code so I will put it as an answer to my own question. However the code is on the link to the page I provided. I am not sure what you mean by more specific. I would like to know when I am looking down the 111 lattice plane. –  user1558881 Nov 6 '13 at 20:51
1  
@user1558881 You can edit the question to add your code. Please also ensure proper markup. –  Pickett Nov 6 '13 at 21:24
add comment

1 Answer

up vote 11 down vote accepted

A convenient resource for the Miller Indices can be found here. This ref provides sufficient information for us to draw the (111) and (110) planes. First, reproduce the graphic from the demonstration. I just made the necessary changes to make it run outside of a Manipulate and did not try to optimize it.

tet = PolyhedronData["Tetrahedron", "Faces"];
tetv = PolyhedronData["Tetrahedron", "VertexCoordinates"];
sp = {RGBColor[1, 1, 0.3], Sphere[{0, 0, 0}, 0.1]};
bar1 = {RGBColor[0.2, 1, 1], 
   Cylinder[{{0, 0, 0}, {0, 0, Sqrt[2/3] - 1/(2 Sqrt[6])}}, 0.025]};
bar2 = {RGBColor[0.3, 1, 1], 
   Cylinder[{{0, 0, 0}, {-(1/(2 Sqrt[3])), -(1/2), -(1/(2 Sqrt[6]))}},
     0.025]};
bar3 = {RGBColor[0.4, 1, 1], 
   Cylinder[{{0, 0, 0}, {-(1/(2 Sqrt[3])), 1/2, -(1/(2 Sqrt[6]))}}, 
    0.025]};
bar4 = {RGBColor[0.5, 1, 1], 
   Cylinder[{{0, 0, 0}, {1/Sqrt[3], 0, -(1/(2 Sqrt[6]))}}, 0.025]};
sp4 = Map[Translate[sp, #] &, tetv];
base = {bar4, bar3, bar2, bar1, sp4, sp};
dia = Rotate[
   Rotate[Map[Translate[base, #] &, tetv], -Cos[Sqrt[3]/3/2], {0, 1, 
     0}], Pi/4, {0, 0, 1}];


diax = Table[Translate[{dia}, {i Sqrt[2], 0, 0}], {i, 1}];
diay = Table[Translate[{dia, diax}, {0, i Sqrt[2], 0}], {i, 1}];
diaz = Table[Translate[{dia, diax, diay}, {0, 0, i Sqrt[2]}], {i, 1}];

Graphics3D[{dia, diax, diay, diaz}, Boxed -> False, 
 SphericalRegion -> True, ImageSize -> 380]

The (110) plane has the coordinates defined as shown below:

enter image description here

Which is easily replicated in Mathematica:

axis = Arrow /@ {{{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 
 0, 0}, {1, 0, 0}}}
p110 = {Opacity[0.5], Black, 
  Polygon[{{2, 0, 0}, {0, 2, 0}, {0, 2, 2}, {2, 0, 2}}]}
p111 = {Opacity[0.5], Black, Polygon[{{2, 0, 0}, {0, 2, 0}, {0, 0, 2}}]}

I add the axis symbol just for reference. Combining these graphics with the original gives

Graphics3D[{dia, diax, diay, diaz, axis, p110}, Boxed -> False, 
 SphericalRegion -> True, ImageSize -> 380]

Mathematica graphics

And for the (111)

Mathematica graphics

You can tweak the values in p111 and p110 to suit your needs for the size of the plane.

share|improve this answer
    
Perfect thanks! –  user1558881 Nov 11 '13 at 19:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.