TransWikia.com

Planes for tetragonal lattice

Mathematica Asked by Dema SD on May 28, 2021

I’ve edited a code written for cubic lattice to make it for a tertagonal lattice, but the planes are wrong. They should reach the boundary of the shape, so I need a correction for this code:

 Manipulate[ 
 Show[
  LatticeData[ Which[Type == "SimpleTetragonal", "SimpleTetragonal"], 
   "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, "SimpleTetragonal", "lattice"}, {"SimpleTetragonal"}},
 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}]

Original code from : https://demonstrations.wolfram.com/CrystallographicPlanesForCubicLattices/

One Answer

You need to change the variable ranges in ContourPlot3D to match the ranges from LatticeData, which are wider for this lattice than for the one you were using before:

PlotRange@
 LatticeData["SimpleTetragonal", "Image"]

(* Out: {{-1.06, 1.06}, {-1.06, 1.06}, {-1.06, 1.56}} *)

So change your ContourPlot3D call to:

ContourPlot3D[
 h*x + k*y + l*z - r == 0, 
 {x, -1.06, 1.06}, 
 {y, -1.06, 1.06}, 
 {z, -1.06, 1.56}, 
 ColorFunction -> Function[{x, y, z, f}, {Blue, Opacity[Op]}], 
 Mesh -> False, BoundaryStyle -> Black
]

Answered by MarcoB on May 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP