Skip to main content
Tweeted twitter.com/StackMma/status/1351182593400692737
Post Reopened by bbgodfrey, MarcoB, m_goldberg, Artes, Karsten7
Added the full code
Source Link
Reza
  • 61
  • 4

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[
 Which[
   Type == "FCC", "FaceCenteredCubic", 
   Type == "BCC", "BodyCenteredCubic", 
   Type == "SC", "SimpleCubic"], "Image"]`

However, this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeData image?

Edit: ok so apparently I had to post the full code. Note that it's written by Danyel Cavazos and can be found with this link: https://demonstrations.wolfram.com/CrystallographicPlanesForCubicLattices/ Basically what I wanted to originally do was to add another control function to the interactive graphic for showing how many lattice planes to show.

Manipulate[ 
 Show[
  LatticeData[ 
   Which[Type == "FCC", "FaceCenteredCubic", Type == "BCC", 
    "BodyCenteredCubic", Type == "SC", "SimpleCubic"], "Image"],
  
  Table[ ContourPlot3D[  h*x + k*y + l*z - r == 0,
    {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
    ColorFunction -> Function[{x, y, z, f}, {Blue, Opacity[Op]}],
    Mesh -> False, BoundaryStyle -> Black], {r, -(h + k + l), 
    h + k + l - 2, 2}],
  
  Graphics3D[{Thick,
     Red, Arrow[{{-1.01, -1.01, -1.01}, {1.6, -1.01, -1.01}}],
    Blue, Arrow[{{-1.01, -1.01, -1.01}, {-1.01, 1.6, -1.01}}],
    Darker@Green, Arrow[{{-1.01, -1.01, -1.01}, {-1.01, -1.01, 1.6}}]
    }],
  SphericalRegion -> True, ImageSize -> 1.1 {500, 400}
  ],
  {{Type, "SC", "lattice"}, {"SC", "BCC", "FCC"}},
 Row[{"Miller indices", Spacer[20],
   Control[{{h, 1, Style["h", Italic]}, Range[0, 10, 1]}], Spacer[20],
   Control[{{k, 1, Style["k", Italic]}, Range[0, 10, 1]}], Spacer[20],
   Control[{{l, 1, Style["l", Italic]}, Range[0, 10, 1]}]}],
 {{Op, 0.5, "plane opacity"}, 0, 1}]

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[
 Which[
   Type == "FCC", "FaceCenteredCubic", 
   Type == "BCC", "BodyCenteredCubic", 
   Type == "SC", "SimpleCubic"], "Image"]`

However, this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeData image?

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[
 Which[
   Type == "FCC", "FaceCenteredCubic", 
   Type == "BCC", "BodyCenteredCubic", 
   Type == "SC", "SimpleCubic"], "Image"]`

However, this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeData image?

Edit: ok so apparently I had to post the full code. Note that it's written by Danyel Cavazos and can be found with this link: https://demonstrations.wolfram.com/CrystallographicPlanesForCubicLattices/ Basically what I wanted to originally do was to add another control function to the interactive graphic for showing how many lattice planes to show.

Manipulate[ 
 Show[
  LatticeData[ 
   Which[Type == "FCC", "FaceCenteredCubic", Type == "BCC", 
    "BodyCenteredCubic", Type == "SC", "SimpleCubic"], "Image"],
  
  Table[ ContourPlot3D[  h*x + k*y + l*z - r == 0,
    {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
    ColorFunction -> Function[{x, y, z, f}, {Blue, Opacity[Op]}],
    Mesh -> False, BoundaryStyle -> Black], {r, -(h + k + l), 
    h + k + l - 2, 2}],
  
  Graphics3D[{Thick,
     Red, Arrow[{{-1.01, -1.01, -1.01}, {1.6, -1.01, -1.01}}],
    Blue, Arrow[{{-1.01, -1.01, -1.01}, {-1.01, 1.6, -1.01}}],
    Darker@Green, Arrow[{{-1.01, -1.01, -1.01}, {-1.01, -1.01, 1.6}}]
    }],
  SphericalRegion -> True, ImageSize -> 1.1 {500, 400}
  ],
  {{Type, "SC", "lattice"}, {"SC", "BCC", "FCC"}},
 Row[{"Miller indices", Spacer[20],
   Control[{{h, 1, Style["h", Italic]}, Range[0, 10, 1]}], Spacer[20],
   Control[{{k, 1, Style["k", Italic]}, Range[0, 10, 1]}], Spacer[20],
   Control[{{l, 1, Style["l", Italic]}, Range[0, 10, 1]}]}],
 {{Op, 0.5, "plane opacity"}, 0, 1}]
Post Closed as "Needs details or clarity" by m_goldberg, Rohit Namjoshi, garej, J. M.'s missing motivation
Improved formatting
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[ Which[Type == "FCC", "FaceCenteredCubic", Type == "BCC", "BodyCenteredCubic", Type == "SC", "SimpleCubic"], "Image"]

LatticeData[
 Which[
   Type == "FCC", "FaceCenteredCubic", 
   Type == "BCC", "BodyCenteredCubic", 
   Type == "SC", "SimpleCubic"], "Image"]`

However, this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeDataLatticeData image?

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[ Which[Type == "FCC", "FaceCenteredCubic", Type == "BCC", "BodyCenteredCubic", Type == "SC", "SimpleCubic"], "Image"]

However this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeData image?

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[
 Which[
   Type == "FCC", "FaceCenteredCubic", 
   Type == "BCC", "BodyCenteredCubic", 
   Type == "SC", "SimpleCubic"], "Image"]`

However, this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeData image?

Source Link
Reza
  • 61
  • 4

Can a LatticeData image show more than a unit cell?

I have an interactive code for showing the crystallographic in Mathematica.

LatticeData[ Which[Type == "FCC", "FaceCenteredCubic", Type == "BCC", "BodyCenteredCubic", Type == "SC", "SimpleCubic"], "Image"]

However this shows only one unit, which means the planes that don't fit in the cell won't be shown. Is there a easy way to show more than one unit cell in the LatticeData image?