Skip to content

Commit

Permalink
added lattice type
Browse files Browse the repository at this point in the history
  • Loading branch information
CompuCell3D committed Jul 8, 2018
1 parent 2f0764b commit f67cb83
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ You do not have to be an XML guru but you should know how to write simple XML do

introduction
potts
lattice_type


Indices and tables
Expand Down
66 changes: 66 additions & 0 deletions docs/lattice_type.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Lattice Type
~~~~~~~~~~~~

Early versions of CompuCell3D allowed users to use only square lattice.
Most recent versions allow the simulation to be run on
hexagonal lattice as well.

.. note::

Full description of hexagonal lattice including detailed
derivations can be found in “Introduction to Hexagonal Lattices”
available from `http://www.compucell3d.org/BinDoc/cc3d_binaries/Manuals/HexagonalLattice.pdf <http://www.compucell3d.org/BinDoc/cc3d_binaries/Manuals/HexagonalLattice.pdf>`__

To enable hexagonal lattice you need to put
.. code-block:: xml
<LatticeType>Hexagonal</LatticeType>
in the Potts section of the CC3DML configuration file.

There are few things to be aware of when using hexagonal lattice.
In 2D your pixels are hexagons but in 3D the voxels are rhombic dodecahedrons.
It is particularly important to realize that surface or perimeter of the pixel
(depending whether in 2D or 3D) is different than in the case of square
pixel. The way CompuCell3D hex lattice implementation was done was that
the volume of the pixel was constrained to be ``1`` regardless of the
lattice type.
There is also one to one correspondence between pixels of the square
lattice and pixels of the hex lattice. Consequently, we can come up with
transformation equations which give positions of hex pixels as a
function of square lattice pixel position:

.. math::
:nowrap:
\begin{cases}
& \left [ x_{hex}, y_{hex}, z_{hex} \right ] = \left [ \left ( x_{cart}+\frac{1}{2} \right ) L, \frac{\sqrt[]{3}}{2}y_{cart}L,\frac{\sqrt[]{6}}{3}z_{cart}L \right ] \text{ for } y \mod 2 = 0 \text{ and } z \mod 3 = 0 \\
& \text{ if } x= \\
& \text{ if } x= \\
& \text{ if } x= \\
& \text{ if } x= \\
& \text{ if } x=
\end{cases}
Based on the above facts one can work out how unit length and unit
surface transform to the hex lattice. The conversion factors are given
below:

For the 2D case, assuming that each pixel has unit volume, we get:

where denotes length of the hexagon and denotes a distance between
centers of the hexagons. Notice that unit surface in 2D is simply a
length of the hexagon side and surface area of the hexagon with side 'a'
is:

In 3D we can derive the corresponding unit quantities starting with the
formulae for Volume and surface of rhombic dodecahedron (12 hedra)

where 'a' denotes length of dodecahedron edge.

Constraining the volume to be one we get

and thus unit surface is given by:

and unit length by:

0 comments on commit f67cb83

Please sign in to comment.