hexagonal lattice - basic crystallography

Version 1.0.6 (1.42 KB) by Karol Vegso
I post here a simple calculation of a hexagonal lattice in reciprocal space.
Updated 16 Feb 2024

View License

This is educational m-script written for hexagonal symmetry. The aim of this contribution is to educate students in GISAXS and XRD working with 2D hexagonal crystals, which are very common. I post it because Matlab is based on matrix representations and manipulations. Therefore, the algebra in crystallography is important for young students coming into the XRD community.
In grazing-incidence small angle X-ray scattering (GISAXS), the hexagonal arrangment of nanoparticles is frequently measured. It is sometimes known as close-packed arrangement of nanoparticles. Imagine two basis vectors a1 and a2 with the same length a (in my program a=4.16 nm). The angle between basis vectors a1 and a2 is 120 degrees representing hexagonal symmetry. Then you can calculate metric tensor in real space of hexagonal lattice g. The components of metric tensor g in real space are g11, g12, g21, g22, where g_ij = a_i * a_j, where i,j=1:2. The metric tensor in real space contains full information about length of basis vectors and angles between them. Therefore, the metric tensor fully desribes metric of unit cell. In this case in two-dimensions. The metric tensor g has its representation in reciprocal space, which is calculated as g_star in my program. The g and g_star are 2 by 2 tensors and are symmetrical. When you perform GISAXS experiment on perfect hexagonal lattice, you will see three peaks along q_xy or q_y. It should be three small-angle diffraction peaks with reciprocal space coordinates q1, q2, q3. The reciprocal space coordinate q1 correponds to diffraction (10), the reciprocal space coordinate q2 corresponds to diffraction (11) and reciprocal space coordinate q3 corresponds to the diffraction (20). In my program those three diffractions are represented by reciprocal space vectors h1=[1;0], h2=[1;1] and h3=[2;0]. The h1, h2 and h3 are columns vectors. The lengths of h1, h2, h3 is calculated through scalar multiplication using metric tensor g_star in reciprocal space:
% length of h1
% length of h2
% length of h3
The lengths of h1, h2 and h3 are defined as reduced positions of (10), (11), (20) diffractions in reciprocal space. In GISAXS experiment, the reciprocal space coordinates of (10), (11), (20) diffractions are q1=2*pi*length_h1, q2=2*pi*length_h2, q3=2*pi*length_h3.
The ratio between h1, h2 and h3 positions and h1 position is calculated as
ratio=[(length_h1 / length_h1); (length_h2 / length_h1); (length_h3 / length_h1)];
It is the same as ratio q1/q1, q2/q1 and q3/q1.
The ratio beween position of first (10) diffraction peak and position of first (10) diffarction peak is 1.
The ratio beween position of second (11) diffraction peak and position of first (10) diffraction peak is sqrt(3).
The ratio beween position of third (20) diffraction peak and position of first (10) diffraction peak is 2.
The ratio 1:sqrt(3):2 represents hexagonal symmetry in GISAXS or XRD.
For better undestanding, please check article of Andrew T. Heitsch et al. from USA <GISAXS Characterization of Order in Hexagonal Monolayers of FePt Nanocrystals, J. Phys. Chem. C 2010, 114, 34, 14427–14432, Publication Date:August 9, 2010, https://doi.org/10.1021/jp1047979 2010 American Chemical Society>
I wish you a lot of fun in reciprocal space.

Cite As

Karol Vegso (2024). hexagonal lattice - basic crystallography (https://www.mathworks.com/matlabcentral/fileexchange/158776-hexagonal-lattice-basic-crystallography), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Clear explanation in text.


Clear explanation in text.


The clarity of the text was improved.


The clarity of the text improved.


The clarity of the text was improved.


The clarity of the text was improved.