Message Boards Message Boards

LEED simulation for understanding LEED diffraction patterns

LEED diffraction pattern is basically the lattice in reciprocal space. When a layer of periodic structure is adsorbed on the crystal surface, the diffraction pattern will be complicated. especially there are many rotational domains in the adsorbed layer. here in this script, I can simulate the LEED pattern for up to three domains (layers) added on the substrate surface. Here is the overview of the interface:
enter image description here

First, a function is defined to generate the lattice in both real and reciprocal space. To use this function, the parameter one needs to provide is the unit cell in real space, with which the reciprocal lattice as well as the related epitaxial matrix is generated.

recrys[x0_, y0_, theta0_, order_] := 
 With[{x = x0, y = y0, theta = theta0, dorder = order},
  rcoora = {x, 0};
  rcoorb = (y/x)*(RotationMatrix[theta Degree].rcoora);
  rcoor = 
   Flatten[Table[aa*rcoora + bb*rcoorb, {aa, -2, 2}, {bb, -2, 2}], 1];
   t = 1; rcoorfina = {}; 
  While[t <= Length[rcoor], 
   If[Norm[rcoor[[t]]] <= 2 x, 
    rcoorfina = AppendTo[rcoorfina, rcoor[[t]]]]; t++];
  rcoorab = {rcoora, rcoorb};
  right = {{2 Pi, 0}, {0, 2 Pi}}; (*right is the results aibi=2pi*
  deltai*)
  recoorab = Inverse[rcoorab].right;
  recoora = {recoorab[[1, 1]], 
    recoorab[[2, 1]]}; (*reciprocal coordinate unit cell*)

  recoorb = {recoorab[[1, 2]], recoorab[[2, 2]]};
  recoor = 
   Flatten[Table[
     aa*recoora + bb*recoorb, {aa, -Round[dorder] - 2, 
      Round[dorder] + 2}, {bb, -Round[dorder] - 2, 
      Round[dorder] + 2}], 1]; i = 1; 
  dradius = 
   dorder*Max[Norm[recoora], 
     Norm[recoorb]];(*Assume a is bigger than b*)
  recoorfina = {};
  While[i <= Length[recoor], 
   If[Norm[recoor[[i]]] <= dradius, 
    recoorfina = AppendTo[recoorfina, recoor[[i]]]]; i++];
  coorfina = {rcoorfina, recoorfina, rcoorab, recoorab}
  ](* output the coordinate of the lattice in real and reciprocal spaces, output the coordinate of the unit cell*)

Next, the code is mostly about creating the interface and plotting the patterns and showing the epitaxial matrix (epi.matrix). one can control maximum three rotational domains in any rotational angle. at the user interface, all the parameters are very tunable. One needs firstly to input the number of domains that is involved in this simulation, then one can input the unit cell parameters for both the substrate surface and the domains. here, the "sys0" is the plot for only substrate surface diffraction, "sys1" is the plot for one domain adsorbed on the surface. Similar meanings work for "sys2" and "sys3".

sys0 = Panel[
   DynamicModule[{len = 3, surfacea = 2.52, surfaceb = 2.52, 
     angab = 60}, 
    Column[{Row[{Panel["sub(r) a,b,angle"], 
        InputField[Dynamic[surfacea], FieldSize -> 5], 
        InputField[Dynamic[surfaceb], FieldSize -> 5], 
        InputField[Dynamic[angab], FieldSize -> 5]}],
      Row[{Panel["diffraction order"], 
        InputField[Dynamic[len], FieldSize -> 5]}], 
      Panel["domain rotation angle control:"],
      Dynamic[
       Manipulate[
        GraphicsRow[{Graphics[{{Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len][[3]][[1]]}]}, {Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len][[3]][[2]]}]},
            {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len][[1]]], 
              substrate Degree]}}, PlotLabel -> "real space"], 
          Spacer[20], Graphics[{
            {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len][[2]]], 
              substrate Degree]}}, PlotLabel -> "reciprocal space"]}, 
         ImageSize -> {1000, 300}], {{substrate, 0}, -180, 180, 
         Appearance -> "Labeled"}]]}]]];
sys1 = Panel[
   DynamicModule[{len0 = 3, len1 = 3, surfacea = 2.52, 
     surfaceb = 2.52, angab = 60, doma = 1.6, domb = 1.6, 
     doangab = 60}, 
    Column[{Row[{Panel["sub(r) a,b,angle"], 
        InputField[Dynamic[surfacea], FieldSize -> 5], 
        InputField[Dynamic[surfaceb], FieldSize -> 5], 
        InputField[Dynamic[angab], FieldSize -> 5]}], 
      Row[{Panel["domain1(r) a,b,angle"], 
        InputField[Dynamic[doma], FieldSize -> 5], 
        InputField[Dynamic[domb], FieldSize -> 5], 
        InputField[Dynamic[doangab], FieldSize -> 5]}],
      Row[{Panel["sub diff-order"], 
        InputField[Dynamic[len0], FieldSize -> 5], 
        Panel["domain1 diff-order"], 
        InputField[Dynamic[len1], FieldSize -> 5]}], 
      Panel["domain rotation angle control:"],
      Dynamic[
       Manipulate[
        GraphicsRow[{Graphics[{{Green, 
             Arrow[{{0, 0}, 

               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len0][[3]][[1]]}]}, {Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len0][[3]][[2]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain1 Degree].recrys[doma, domb, doangab, len1][[
                  3]][[1]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain1 Degree].recrys[doma, domb, doangab, len1][[
                  3]][[2]]}]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma, domb, doangab, len1][[1]]], 
              domain1 Degree]}, {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len0][[1]]], 
              substrate Degree]}}, PlotLabel -> "real space"], 
          Spacer[20], Graphics[{
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma, domb, doangab, len1][[2]]], 
              domain1 Degree]}, {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len0][[2]]], 
              substrate Degree]}}, PlotLabel -> "reciprocal space"], 

          Panel[(RotationMatrix[
                domain1 Degree].recrys[doma, domb, doangab, len1][[
                3]]).Inverse[
              recrys[surfacea, surfaceb, angab, len0][[3]]] // 
            MatrixForm, "epi.Matrix1"]}, 
         ImageSize -> {1000, 300}], {{substrate, 0}, -180, 180, 
         Appearance -> "Labeled"}, {{domain1, 0}, -180, 180, 
         Appearance -> "Labeled"}](*epitaxial matrix*)
       ]}]]];
sys2 = Panel[
   DynamicModule[{len0 = 3, len1 = 3, len2 = 3, surfacea = 2.52, 
     surfaceb = 2.52, angab = 60, doma1 = 1.6, domb1 = 1.6, 
     doangab1 = 60, doma2 = 1.6, domb2 = 1.6, doangab2 = 60}, 
    Column[{Row[{Panel["sub(r) a,b,angle"], 
        InputField[Dynamic[surfacea], FieldSize -> 5], 
        InputField[Dynamic[surfaceb], FieldSize -> 5], 
        InputField[Dynamic[angab], FieldSize -> 5]}], 
      Row[{Panel["domain1(r) a,b,angle"], 
        InputField[Dynamic[doma1], FieldSize -> 5], 
        InputField[Dynamic[domb1], FieldSize -> 5], 
        InputField[Dynamic[doangab1], FieldSize -> 5], 
        Panel["domain2(r) a,b,angle"], 
        InputField[Dynamic[doma2], FieldSize -> 5], 
        InputField[Dynamic[domb2], FieldSize -> 5], 
        InputField[Dynamic[doangab2], FieldSize -> 5]}],
      Row[{Panel["sub diff-order"], 
        InputField[Dynamic[len0], FieldSize -> 5], 
        Panel["domain1 diff-order"], 
        InputField[Dynamic[len1], FieldSize -> 5], 
        Panel["domain2 diff-order"], 
        InputField[Dynamic[len2], FieldSize -> 5]}], 
      Panel["domain rotation angle control:"],
      Dynamic[
       Manipulate[
        GraphicsRow[{Graphics[{{Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len0][[3]][[1]]}]}, {Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len0][[3]][[2]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain1 Degree].recrys[doma1, domb1, doangab1, 
                   len1][[3]][[1]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain1 Degree].recrys[doma1, domb1, doangab1, 
                   len1][[3]][[2]]}]}, {Red, 
             Arrow[{{0, 0}, 

               RotationMatrix[
                 domain2 Degree].recrys[doma2, domb2, doangab2, 
                   len2][[3]][[1]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain2 Degree].recrys[doma2, domb2, doangab2, 
                   len2][[3]][[2]]}]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma1, domb1, doangab1, len1][[1]]], 
              domain1 Degree]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma2, domb2, doangab2, len2][[1]]], 
              domain2 Degree]}, {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len0][[1]]], 
              substrate Degree]}}, PlotLabel -> "real space"], 
          Spacer[20], Graphics[{
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma1, domb1, doangab1, len1][[2]]], 
              domain1 Degree]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma2, domb2, doangab2, len2][[2]]], 
              domain2 Degree]}, {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len0][[2]]], 
              substrate Degree]}}, PlotLabel -> "reciprocal space"], 

          GraphicsColumn[{Panel[(RotationMatrix[
                  domain1 Degree].recrys[doma1, domb1, doangab1, 
                   len1][[3]]).Inverse[
                recrys[surfacea, surfaceb, angab, len0][[3]]] // 
              MatrixForm, "epi.matrix1"], 
            Panel[(RotationMatrix[
                  domain2 Degree].recrys[doma2, domb2, doangab2, 
                   len2][[3]]).Inverse[
                recrys[surfacea, surfaceb, angab, len0][[3]]] // 
              MatrixForm, "epi.matrix2"]}]}, 
         ImageSize -> {1000, 300}], {{substrate, 0}, -180, 180, 
         Appearance -> "Labeled"}, {{domain1, 0}, -180, 180, 
         Appearance -> "Labeled"}, {{domain2, 0}, -180, 180, 
         Appearance -> "Labeled"}](*epitaxial matrix*)
       ]}]]];
sys3 = Panel[
   DynamicModule[{len0 = 3, len1 = 3, len2 = 3, len3 = 3, 
     surfacea = 2.52, surfaceb = 2.52, angab = 60, doma1 = 1.6, 
     domb1 = 1.6, doangab1 = 60, doma2 = 1.6, domb2 = 1.6, 
     doangab2 = 60, doma3 = 1.6, domb3 = 1.6, doangab3 = 60}, 
    Column[{Row[{Panel["sub(r) a,b,angle"], 
        InputField[Dynamic[surfacea], FieldSize -> 5], 
        InputField[Dynamic[surfaceb], FieldSize -> 5], 
        InputField[Dynamic[angab], FieldSize -> 5], 
        Panel["domain1(r) a,b,angle"], 
        InputField[Dynamic[doma1], FieldSize -> 5], 
        InputField[Dynamic[domb1], FieldSize -> 5], 
        InputField[Dynamic[doangab1], FieldSize -> 5]}], 
      Row[{Panel["domain2(r) a,b,angle"], 
        InputField[Dynamic[doma2], FieldSize -> 5], 
        InputField[Dynamic[domb2], FieldSize -> 5], 
        InputField[Dynamic[doangab2], FieldSize -> 5], 
        Panel["domain3(r) a,b,angle"], 
        InputField[Dynamic[doma3], FieldSize -> 5], 
        InputField[Dynamic[domb3], FieldSize -> 5], 
        InputField[Dynamic[doangab3], FieldSize -> 5]}],
      Row[{Panel["sub diff-order"], 
        InputField[Dynamic[len0], FieldSize -> 5], 
        Panel["domain1 diff-order"], 
        InputField[Dynamic[len1], FieldSize -> 5], 
        Panel["domain2 diff-order"], 
        InputField[Dynamic[len2], FieldSize -> 5], 
        Panel["domain3 diff-order"], 
        InputField[Dynamic[len3], FieldSize -> 5]}], 
      Panel["domain rotation angle control:"],
      Dynamic[
       Manipulate[
        GraphicsRow[{Graphics[{{Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len0][[3]][[1]]}]}, {Green, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 substrate Degree].recrys[surfacea, surfaceb, angab, 
                   len0][[3]][[2]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain1 Degree].recrys[doma1, domb1, doangab1, 
                   len1][[3]][[1]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain1 Degree].recrys[doma1, domb1, doangab1, 
                   len1][[3]][[2]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain2 Degree].recrys[doma2, domb2, doangab2, 
                   len2][[3]][[1]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain2 Degree].recrys[doma2, domb2, doangab2, 
                   len2][[3]][[2]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain3 Degree].recrys[doma3, domb3, doangab3, 
                   len3][[3]][[1]]}]}, {Red, 
             Arrow[{{0, 0}, 
               RotationMatrix[
                 domain3 Degree].recrys[doma3, domb3, doangab3, 
                   len3][[3]][[2]]}]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma1, domb1, doangab1, len1][[1]]], 
              domain1 Degree]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma2, domb2, doangab2, len2][[1]]], 
              domain2 Degree]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma3, domb3, doangab3, len3][[1]]], 
              domain3 Degree]}, {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len0][[1]]], 
              substrate Degree]}}, PlotLabel -> "real space"], 
          Spacer[20], Graphics[{
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma1, domb1, doangab1, len1][[2]]], 
              domain1 Degree]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma2, domb2, doangab2, len2][[2]]], 
              domain2 Degree]},
            {PointSize[Large], Red, 
             Rotate[Point[recrys[doma3, domb3, doangab3, len3][[2]]], 
              domain3 Degree]}, {PointSize[Large], Green, 
             Rotate[Point[
               recrys[surfacea, surfaceb, angab, len0][[2]]], 
              substrate Degree]}}, PlotLabel -> "reciprocal space"], 
          GraphicsColumn[{Panel[(RotationMatrix[
                  domain1 Degree].recrys[doma1, domb1, doangab1, 
                   len1][[3]]).Inverse[
                recrys[surfacea, surfaceb, angab, len0][[3]]] // 
              MatrixForm, "epi.matrix1"], 
            Panel[(RotationMatrix[
                  domain2 Degree].recrys[doma2, domb2, doangab2, 
                   len2][[3]]).Inverse[
                recrys[surfacea, surfaceb, angab, len0][[3]]] // 
              MatrixForm, "epi.matrix2"], 
            Panel[(RotationMatrix[
                  domain3 Degree].recrys[doma3, domb3, doangab3, 
                   len3][[3]]).Inverse[
                recrys[surfacea, surfaceb, angab, len0][[3]]] // 
              MatrixForm, "epi.matrix3"]}]}, 
         ImageSize -> {1000, 300}], {{substrate, 0}, -180, 180, 
         Appearance -> "Labeled"}, {{domain1, 0}, -180, 180, 
         Appearance -> "Labeled"}, {{domain2, 0}, -180, 180, 
         Appearance -> "Labeled"}, {{domain3, 0}, -180, 180, 
         Appearance -> "Labeled"}](*epitaxial matrix*)
       ]}]]];
Panel[DynamicModule[{dnum = 0}, 
  Column[{Row[{Panel["domain-number (0-3):"], 
      InputField[Dynamic[dnum]]}],
    Dynamic[If[dnum == 0, sys0,
      If[dnum == 1, sys1,
       If[dnum == 2, sys2, If[dnum == 3, sys3]
        ]]]]}]]]
Attachments:
POSTED BY: Qiankun Wang

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract