16
$\begingroup$

Given an array of atoms A-B-A-B-A-B in an hexagonal pattern, how can I use Mathematica to create with an hexagonal lattice (infinite) with this array so each atom A is sorrounded only by B atoms and vice-versa.

$\endgroup$
  • $\begingroup$ Hola Jose, welcome to Mathematica.SE. Do you mean graphical lattice, a plot necessarily finite, or an analytical description of a lattice? Probably you could give more details of what do you intend to do with that, so its easier to help you. $\endgroup$ – rhermans Oct 11 '14 at 10:04
  • $\begingroup$ a finite lattice given by an hexagonal pattern with 2 atoms for example like this google.es/… but with 2 atoms instead one (graphene) $\endgroup$ – Jose Javier Garcia Oct 11 '14 at 10:14
  • $\begingroup$ Related: 19165 , 14632. $\endgroup$ – rhermans Oct 11 '14 at 12:45
  • 1
    $\begingroup$ Also related: Wolfram Demo $\endgroup$ – Jens Oct 11 '14 at 16:41
  • $\begingroup$ Some knowledge of Solid State Physics facilitates it. $\endgroup$ – Αλέξανδρος Ζεγγ Dec 19 '17 at 3:16
34
$\begingroup$

In 2D

unitCell[x_, y_] := {
  Red
  , Disk[{x, y}, 0.1]
  , Blue
  , Disk[{x, y + 2/3 Sin[120 Degree]}, 0.1]
  , Gray,
  , Line[{{x, y}, {x, y + 2/3 Sin[120 Degree]}}]
  , Line[{{x, y}, {x + Cos[30 Degree]/2, y - Sin[30 Degree]/2}}]
  , Line[{{x, y}, {x - Cos[30 Degree]/2, y - Sin[30 Degree]/2}}]
  }

This creates the unit cell

Graphics[unitCell[0, 0], ImageSize -> 100]  

Unit Cell

We place it into a lattice

Graphics[
 Block[
  {
   unitVectA = {Cos[120 Degree], Sin[120 Degree]}
  ,unitVectB = {1, 0}
   }, Table[
   unitCell @@ (unitVectA j + unitVectB k)
   , {j, 1, 12}
   , {k, Ceiling[j/2], 20 + Ceiling[j/2]}
   ]
  ], ImageSize -> 500
 ]

2D Hex Lattice


In 3D

unitCell3D[x_, y_, z_] := {
  Red
  , Sphere[{x, y, z}, 0.1]
  , Blue
  , Sphere[{x, y + 2/3 Sin[120 Degree], z}, 0.1]
  , Gray
  , Cylinder[{{x, y, z}, {x, y +2/3 Sin[120 Degree], z}}, 0.05]
  , Cylinder[{{x, y, z}, {x + Cos[30 Degree]/2, y - Sin[30 Degree]/2, 
     z}}, 0.05]
  , Cylinder[{{x, y, z}, {x - Cos[30 Degree]/2, y - Sin[30 Degree]/2, 
     z}}, 0.05]
  }

Graphics3D[
 Block[
  {unitVectA = {Cos[120 Degree], Sin[120 Degree], 0}, 
   unitVectB = {1, 0, 0}
  }, 
  Table[unitCell3D @@ (unitVectA j + unitVectB k), {j, 20}, {k, 20}]]
 , PlotRange -> {{0, 10}, {0, 10}, {-1, 1}}
 ]

3D Hex Lattice

$\endgroup$
  • $\begingroup$ ok thanks... :D $\endgroup$ – Jose Javier Garcia Oct 11 '14 at 12:43
  • $\begingroup$ Great answer, liked considering both 2d and 3d! $\endgroup$ – VividD Oct 19 '14 at 10:48
5
$\begingroup$

In 2D,

Manipulate[(
  basis = {{s, 0}, {s/2, s Sqrt[3]/2}};
  points = Tuples[Range[0, max], 2].basis;
  Graphics[Point[points], Frame -> True, AspectRatio -> Automatic])
 , {s, 0.1, 1}
 , {max, 2, 10}
 ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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