Skip to content

Stianpr20/MaXrd

Repository files navigation

MaXrd — Mathematica X-ray diffraction package

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

Main functionality

  • Contains essential symmetry information on the 32 point groups and 230 space groups (with alternative settings) from the International Tables for Crystallography, along with convenient API.
  • Robust importation of data from CIF files and a simple three-dimensional visualizer function.
  • Basic functions for calculating/extracting quantities such as: attenuation coefficients, metrics for direct and reciprocal space, symmetry equivalent positions/reflections, mass densities, inter-planar spacings, structure factors, formula units.
  • Tools for constructing and manipulating crystal units—from atom level to domain level— specifically aimed for modelling inclusion compounds.
  • Simple, auxiliary tools for analysing diffraction patterns (see ReciprocalSpaceSimulation and ReciprocalImageCheck).

Import crystal data

Core crystallographic information can be be read from cif files using ImportCrystalData. Data will persist in the local $UserBaseDirectory, readily accessible with $CrystalData. The simple but convenient function CrystalPlot can visualise the structure.


Symmetry generation

Symmetry-related functions can be used for basic operations on reflections and positions, and also to grow the asymmetric unit into an arbitrary large structure. Essentials of the International Tables, vol. A are stored in $SpaceGroups. There is also UnitCellTransformation for changing between equivalent cell descriptions.

Structure customisation

Written with inclusion compounds in mind, EmbedStructure is ideal for merging guest entities with a host structure at random, sequential or conditional positions. Rotations and/or translations can be executed prior to placement with the same freedom. The user can also specify a displacement field to shift everything by a relative amount with DistortStructure.

Synthesis and simulation

Structural pieces can be sewn together automatically with SynthesiseStructure, which is particularly useful when working with multiple domains. When the model is complete, SimulateDiffractionPattern can be applied to render images through DISCUS or DIFFUSE.


Getting started

Installation

Download the latest paclet file and install it, or install from the web directly. From the Wolfram Language Paclet Repository:

PacletInstall["StianRamsnes/MaXrd"]

From this GitHub repository:

PacletInstall["https://github.com/Stianpr20/MaXrd/releases/download/4.0.0/MaXrd-4.0.0.paclet"]

Usage

Load the package with:

Needs["StianRamsnes`MaXrd`"]

Documentation

Use the Documentation Center in Mathematica after installing the paclet, or browse the documentation on the Paclet Repository page.

It may be helpful to check out this post in the Wolfram Community for an introductory overview. (The notebook from the community post is also found in this repository.)

Details

Versions

The latest version of MaXrd is 4.0.0, which is compatible with Mathematica version 13.0.1 and above. Change logs are found in the Resources directory. Overview of which versions of Mathematica was used to build MaXrd:

MaXrd Mathematica
1.0.0–2.1.0 11.3.0+
2.2.0–2.5.0 12.1+
3.0.0+ 13.0.1+

Publications

The article Using Mathematica as a platform for crystallographic computing was published in the Journal of Applied Crystallography in February 2019 (Ramsnes, S., Larsen, H. B. & Thorkildsen, G. (2019). J. Appl. Cryst. 52, 214–218). In 2020, an update article MaXrd updated with emphasis on model construction and reciprocal-space simulations (Ramsnes, S. P., Larsen, H. B. & Thorkildsen, G. (2020). J. Appl. Cryst. 53, 1620–1624) was published in the same journal.

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.

Contact

Any comments or feedback are welcome. Submit an issue in the repository.