Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

MaXrd

Guides

  • MaXrd – Mathematica X-ray diffraction package

Tech Notes

  • Applying crystal data
  • Basic computations
  • Computations on reflections
  • Formulas in crystallography
  • Importing crystal data
  • Quick guide to conditions
  • References
  • Symmetry calculations
  • The association structure of crystallographic data
  • Using the rotation options

Symbols

  • AttenuationCoefficient
  • BraggAngle
  • ConstructDomains
  • CrystalDensity
  • CrystalFormulaUnits
  • CrystalPlot
  • DarwinWidth
  • DistortStructure
  • DomainPlot
  • EmbedStructure
  • ExpandCrystal
  • ExportCrystalData
  • ExtinctionLength
  • FindPixelClusters
  • GetAtomCoordinates
  • GetAtomicScatteringFactors
  • GetCrystalMetric
  • GetElements
  • GetLatticeParameters
  • GetLaueClass
  • GetScatteringCrossSections
  • GetSymmetryData
  • GetSymmetryOperations
  • ImportCrystalData
  • InputCheck
  • InterplanarSpacing
  • MergeDomains
  • MergeSymmetryEquivalentReflections
  • MillerNotationToList
  • MillerNotationToString
  • ReciprocalImageCheck
  • ReciprocalSpaceSimulation
  • ReflectionList
  • RelatedFunctionsGraph
  • ResetCrystalData
  • ResizeStructure
  • SimulateDiffractionPattern
  • StructureFactor
  • StructureFactorTable
  • SymmetryEquivalentPositions
  • SymmetryEquivalentReflections
  • SymmetryEquivalentReflectionsQ
  • SynthesiseStructure
  • SystematicAbsentQ
  • ToStandardSetting
  • TransformAtomicDisplacementParameters
  • UnitCellTransformation
  • $CrystalData
  • $GroupSymbolRedirect
  • $LaueClasses
  • $MaXrdPath
  • $MaXrdVersion
  • $PeriodicTable
  • $PointGroups
  • $SpaceGroups
  • $TransformationMatrices
Using the rotation options
Anchors
The common auxiliary function
Some of the tools that deal with creation and manipulation of crystal entities – asymmetric units, unit cells, blocks, domains and structures – allow rotation of these instances. These functions share a common options framework which will be elaborated on here.
"RotationAnchorReference"
describe the type of rotation anchors that will be used
"RotationAnchorShift"
an optional translation of the anchor point(s)
"RotationAxes"
define the three rotation axes to be used in 3D rotations
"RotationMap"
maps domains to their respective rotation amounts
An overview of the rotation options encountered in the relevant functions.
The functions that currently make use of the rotation options are:
DomainPlot
provides a visual plot of a domain representation
EmbedStructure
embeds given units into a host system
SynthesiseStructure
assembles a given domain to the represented structure
The relevant functions along with short descriptions.
Load the package if not done already:
In[1]:=
<<MaXrd`
Anchors
By anchor we mean the particular point a rotation will be performed about. The first option,
"RotationAnchorReference"
enables us to choose between four general positions of the anchor(s):
"Host"
origin of the host structure
"Domain"
origin of each domain's cell that is closest to the host's origin
"DomainCentroid"
centroid of each domain
"Unit"
origin of each unit
All the possible settings of the
"RotationAnchorReference"
option and what they mean.
We will start an example using
DomainPlot
:
This will be the domain we'll be working with in this demo:
In[2]:=
domain={{7,7,1},{3,3,3,3,3,1,1,3,3,3,3,3,1,1,3,3,3,1,1,1,1,3,3,3,1,1,1,1,3,2,2,1,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2}};​​
DomainPlot
@domain
Out[3]=
Before we start rotating let us define a map for all the anchors that can come up with this particular domain:
In[4]:=
anchors=​​"Host"{{0.,0.}},​​"Domain"{{0.,0.},{2.,3.},{4.,1.}},​​"DomainCentroid"{{1.912,2.029},{2.643,5.286},{5.667,3.500}},​​"Unit"{{0.,5.},{0.,6.},{1.,5.},{1.,6.},{2.,3.},{2.,4.},{2.,5.},{2.,6.},{3.,3.},{3.,4.},{3.,5.},{3.,6.},{4.,3.},{4.,6.}};
The anchor points defined above are produced internally by the functions, but not directly obtainable. They are therefore copied here. We will momentarily be using them to show graphically where they are.
Below is an interactive controller to illustrate the various anchor reference settings. The yellow dots indicate where the anchors are (to avoid cluttering, only the red cells have the anchors shown in the
"Unit"
setting).
In[5]:=
Manipulate​​Graphics​​First@
DomainPlot
[domain,​​"RotationMap"1θ1*Degree,2θ2*Degree,3θ3*Degree,​​"RotationAnchorReference"r],​​{Yellow,Disk[#,0.25]&/@anchors@r}​​,​​{{θ1,0,"Red"},0,90},{{θ2,0,"Green"},0,90},{{θ3,0,"Blue"},0,90},​​{{r,"DomainCentroid","Type"},{"Host","Domain","DomainCentroid","Unit"}},​​ControlPlacementRight
Out[5]=
​
Red
Green
Blue
Type
Host
Domain
DomainCentroid
Unit
If you need further control of where the anchors should be, use the option
"RotationAnchorShift"
to translate the anchor(s).

A practical example

Now that we're more familiar with the anchors, let us look at a more practical example. We will create two layers where the top sheet should be rotated. Then, we will synthesise the structure with graphene. First, let us make a general factory method that creates the layered domain:
Our demo structure will consist of 7×7×2 unit cells:
In[6]:=
makeSandwichedDomains[A_,B_,C_]:={{A,B,C},Flatten@ConstantArray[Range@C,A*B]}​​domain=makeSandwichedDomains[7,7,2];​​
DomainPlot
@domain
Out[8]=
We wish to rotate the top layer, for instance by 15° and hinged at the lower-left corner:
In[9]:=
DomainPlot
[domain,​​"RotationMap"2{0,0,15°},​​"RotationAnchorReference""Host"]
Out[9]=
The next step is to assemble this structure. Here we want to use graphene in both layers, but we need to create it first for our
$CrystalData
and expand it to one unit cell (which each block represents):
ImportCrystalData
is normally used with cif files, but here it's just as simple to provide the details “manually”:
In[10]:=
ImportCrystalData
[​​{"Graphene","C","P-3m1"},​​{2.5,2.5,5.0,90,90,120},​​{"Element""C","FractionalCoordinates"{1/3,2/3,1/2}}];​​
ExpandCrystal
["Graphene","NewLabel""GrapheneCell"]
The common auxiliary function
Constructing a two-dimensional domain:
Obtaining the transformation function where we want to rotate all cells of domain 3 around the “domain corner” by 23.5°:
To get the appropriate transformation function, we only need to specify the domain identifier:
In this second example we use a three-dimensional structure instead and choose to rotate about each block as well. Thus, we specify both the domain and the point in order to get the transformation function back:

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com