# StianRamsnes/ MaXrd

Symmetry data and utilities related to crystallography and X-ray scattering

Contributed by: Stian Penev Ramsnes

## Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall["StianRamsnes/MaXrd"]

## Details

In addition to data from the International Tables for Crystallography, volume A, the package comprises scattering factors from XOP and cross sections from xraylib, and atomic scattering factors (and corrections) from miscellaneous sources (see GetAtomicScatteringFactors).
The documentation includes plentiful of examples, details and options. It may be a helpful supplement in research and teaching where crystallography and X-ray diffraction are essential.
The article Using Mathematica as a platform for crystallographic computing was published in 2019, along with an update in 2020: MaXrd updated with emphasis on model construction and reciprocal-space simulations. The author's PhD thesis from 2022, Direct- and reciprocal space structure modelling: Contributions to the advanced understanding of inclusion compounds, describes much of the capabilities in great detail from a research perspective.

## Examples

### Basic Examples (7)

Plot unit cells of crystal structures:

 In[1]:=
 Out[1]=

Simulation of Bragg reflections for the crystal zinc. Settings here are for a wavelength λ = 0.5 Å, viewing the h k 3 plane, and resolution d{XMLElement[span, {class -> stylebox}, {min}]} = 0.45 Å:

 In[2]:=
 Out[2]=

First expand the asymmetric unit of salt into a unit cell (the host), then embed a gold atom (the guest) into the resulting cell at two different positions:

 In[3]:=
 Out[3]=

The structure factor of the (1 1 1) reflection of silicon, with the Mo Kα1 wavelength:

 In[4]:=
 Out[4]=

Distance between planes with Miller indices (1 1 0):

 In[5]:=
 Out[5]=

Get the metric matrix, G, for the crystal quartz:

 In[6]:=
 Out[6]=

Options enable, for instance, the possibility to get the inverse metric, H=G{XMLElement[span, {class -> stylebox}, {XMLElement[span, {class -> spacedInfixOperator}, {-}], 1}]}, and with units:

 In[7]:=
 Out[7]=

Get the permutations of Miller indices after applying all the symmetry operations of to an arbitrary reflection (h k l):

 In[8]:=
 Out[8]=

For a given reflection, for instance (2 0 2), get its symmetry equivalents in the same space group:

 In[9]:=
 Out[9]=

Verify that the reflection is not extinct:

 In[10]:=
 Out[10]=

For any of the equivalent reflections, get the «standard variant»:

 In[11]:=
 Out[11]=

### Scope (5)

Import crystal data from CIF files:

 In[12]:=
 Out[12]=

Plot the asymmetric unit of the imported ferrocene crystal:

 In[13]:=
 Out[13]=

Obtain possible reflection (nodes in reciprocal space) to work with:

 In[14]:=
 Out[14]=

Perform calculations — obtaining structure factors, for instance:

 In[15]:=
 Out[15]=

Calculations relevant to X-ray physics and diffraction:

 In[16]:=
 Out[16]=

 In[17]:=
 Out[17]=

First expand the asymmetric unit of ice into a 5 × 4 × 1 super-cell, then embed gold atoms into one of the cavity positions if y-position of the host's crystallographic coordinate system is larger than 2; if not, put in a sodium atom there:

 In[18]:=
 Out[18]=

Get the symmetry operations belonging to a given space group, like P42/n:

 In[19]:=
 Out[19]=

Find the symmetry equivalent positions for a given symmetry setting (point group, space group or crystal):

 In[20]:=
 Out[20]=

If a crystal is given, its atom positions are checked against the reflection conditions. For the general position of Rc, these are:

 In[21]:=
 Out[21]=

Stian Ramsnes

## Compatibility

Wolfram Language Version 13.0.1

## Version History

• 4.0.0 – 29 April 2023