Design & Implementation of Data Structure of Crystalline Atomic Data​
​by Claudio Chaib
Goal: One problem is to represent mineral crystals in a computable way using Wolfram Language and to develop an analogous representation for crystals as there is for molecules. The goal is to develop and implement a data structure that contains the necessary data for the construction of computational 3D models of crystals and to compute geometrical properties. To do this, we first obtain examples of crystal data to determine the scope that needs to be supported, then design a data structure, implement examples of structural data that were obtained in step one, and lastly demonstrate the usability of the implementation by 3D representation of the crystalline structure and computation of geometric properties of minerals and crystals of organic molecules.
Main Results: The project successfully demonstrated the feasibility of interpreting crystallographic data from minerals and organic crystals, by recreating crystalline networks and their representations both in the form of data and 3D graphics. For that, specialized functions were developed using Wolfram Language for this task, they are: CrystalLattice, CrystalLatticeValue, CrystalLatticeModify and CrystalLatticePlot3D. A new type of computable object, the CrystalLattice object, was developed along with it, which contains information from the .CIF files originating from the real experiments carried out with electron diffraction on minerals and organic crystals.
Future Work: This is only the first version of this innovative project, which can be improved and added to in future implementations, such as options, features and even performance of functions already developed. There is a large field of study where this project can be used, including, in the future, the possibility of editing crystalline molecules that will enable developers of new materials to view and test different properties of their work.

Mineral Entity vs .CIF

The Wolfram Language knowledgebase is extensive and has a large number of mineral entities, 3878 to be exact. There are all kinds of information that can be extracted from this resource, but there is no information about the crystalline structures so that they can be represented with coordinates, 3D graphics, symmetries, and other crucial information.
An example of information available with the Entity-Mineral data feature:
In[]:=
(mineralA=Entity["Mineral","Chalconatronite"])->(mineralA["Association"]//Short)mineralA["Image"]
Out[]=
The most accurate data on the crystal structure is obtained experimentally: the composition data, atom coordinates, cell lattice, and possible spatial symmetry groups, both of inorganic minerals and organic crystals, are obtained by X-ray, neutron, and electron diffraction based crystallography. Below are some images that show the process of diffraction and extraction of information from crystalline molecules:
One of the ways to compile the obtained data is through .CIF files, which are stored in crystallographic databases of universities and organizations. Often these .CIF files are available to the public and found on specialized pages on the internet. There are many advantages to using information from this type of file to recreate the crystal network of a specific mineral.
◼
  • Below are two examples of pages where you can download minerals and organic structures in .CIF format:
  • The Cambridge Crystallographic Data Centre (CCDC):
    In[]:=
    HTTPRequest["https://www.ccdc.cam.ac.uk/structures/"]
    Out[]=
    American Mineralogist Structure Database (AMS):
    In[]:=
    HTTPRequest["http://rruff.geo.arizona.edu/AMS/amcsd.php"]
    Out[]=
    ◼
  • Example of a structure of a mineral .CIF file:
  • A .CIF file is easily imported into Wolfram Language. Below is the mineral bukovite:
    In[]:=
    Import["C:\\Users\\quimi\\OneDrive\\Documentos\\MineralsCIF\\bukovite.cif"]
    Out[]=
    {_atom_site_fract_x{0.,0.,0.,0.},_atom_site_fract_y{0.,0.5,0.5,0.},_atom_site_fract_z{0.,0.25,0.25,0.355},_atom_site_label{Tl,Cu,Fe,Se},_atom_site_occupancy{1.,0.775,0.225,1.},_cell_angle_alpha90,_cell_angle_beta90,_cell_angle_gamma90,_cell_length_a3.976,_cell_length_b3.976,_cell_length_c13.7,_cell_volume216.577,_chemical_compound_sourceBukov, Czechoslovakia,_chemical_formula_sumTl (Cu1.55 Fe.45) Se2,_chemical_name_mineralBukovite,_database_code_amcsd0018803,_exptl_crystal_density_diffrn7.451,_journal_name_fullNeues Jahrbuch fur Mineralogie, Abhandlungen,_journal_page_first122,_journal_page_last146,_journal_volume138,_journal_year1980,_publ_author_name{Makovicky E,Johan Z,Karup-Moller S},_publ_section_titleNew data on bukovite, thalcusite, chalcothallite and rohaite,_space_group_symop_operation_xyz{x,y,z,1/2+x,1/2+y,1/2+z,-y,-x,z,1/2-y,1/2-x,1/2+z,y,x,-z,1/2+y,1/2+x,1/2-z,y,-x,-z,1/2+y,1/2-x,1/2-z,-y,x,z,1/2-y,1/2+x,1/2+z,x,-y,z,1/2+x,1/2-y,1/2+z,-x,y,-z,1/2-x,1/2+y,1/2-z,x,y,-z,1/2+x,1/2+y,1/2-z,-x,-y,z,1/2-x,1/2-y,1/2+z,y,x,z,1/2+y,1/2+x,1/2+z,-y,-x,-z,1/2-y,1/2-x,1/2-z,-y,x,-z,1/2-y,1/2+x,1/2-z,y,-x,z,1/2+y,1/2-x,1/2+z,-x,y,z,1/2-x,1/2+y,1/2+z,x,-y,-z,1/2+x,1/2-y,1/2-z,-x,-y,-z,1/2-x,1/2-y,1/2-z},_symmetry_space_group_name_H-MI 4/m m m}
    Above, we can see that there is a lot of information that can be used to reproduce a crystal lattice. The function CrystalLattice developed using Wolfram Language uses these data, correctly interpreting the .CIF file. Some important definitions that are found:
    ◼
  • Cell dimensions: lengths of a basic cell unit for the crystal. Its measurement is given in Angstroms.
  • ◼
  • Cell angles: are the angles of the sides of a crystal cell, measured with angular degree.
  • ◼
  • Atom site fractional coordinates: represent spatial positions of crystal atoms, but their measurement is relative to cell lengths (ranging from 0 to 1).
  • ◼
  • Atom site labels: contains the composition of atoms found in a given crystal.
  • ◼
  • Space group symmetry operations: contains all the unit cell symmetries of the position of the crystal atoms, which are rotations, reflections, inversions, glides, and screw rotations; the infinite number of translations are not included and are easily generated.
  • ◼
  • Symmetry space group name: the standard name of one of the 230 3-dimensional space groups.
  • CrystalLattice Function and Object

    To interpret the data obtained through the .CIF files and compile them into an object (CrystalLattice object) that is used to recreate the crystalline network, the CrystalLattice function was developed.

    CrystalLattice usage:

    It is important that the function also works in the form of a computable object. The summary box information for a CrystalLattice object includes: the type of object, the entity it refers to (it may be a mineral entity, a chemical molecule or other), the database code for the crystal data (such as CSD, ICSD..) and the minimum atomic content of the crystalline unit. Let’s see some examples of using the function and its generated objects.
    Use of the CrystalLattice function and its associated object, through the .CIF file of the mineral poudretteite:
    In[]:=
    CrystalLattice["C:\\Users\\quimi\\OneDrive\\Documentos\\MineralsCIF\\poudretteite.cif"]
    Out[]=
    The object is copyable and can have its information extracted and computed.
    Using the “Properties” argument, we have the list of information contained in the CrystalLattice object:
    In[]:=
    CrystalLattice
    CrystalLattice object
    ​
    poudretteite
    MINERAL
    ​
    0005217
    B
    1
    K
    1
    Na
    1
    O
    3
    Si
    1
    ["Properties"]
    Out[]=
    {AtomCoordinates,AtomsContent,AtomSiteFractionalCoordinates,AtomSiteOccupancy,AtomSiteSymbols,Bonds,CellUnitsZ,ChemicalFormula,DatabaseCode,MineralData,SpaceGroupName,SymmetryEquivalentPositionFunctions,UnitCellAngles,UnitCellCoordinates,UnitCellCopies,UnitCellFractionalCoordinates,UnitCellLengths}
    CrystalLattice object, in most cases, contains its entity from the Wolfram Language knowledgebase, either in the form of Entity[“Mineral”] or in the form of Molecule, which can also be easily obtained using arguments on the object.
    Example of the “MineralData” and “SymmetryEquivalentPositionFunctions” arguments used in a CrystalLattice object:
    In[]:=
    i=CrystalLattice
    CrystalLattice object
    ​
    corundum
    MINERAL
    ​
    0010607
    Al
    1
    Cr
    1
    O
    1
    ["MineralData"]{"SymmetryEquivalentPositionFunctions",i["SymmetryEquivalentPositionFunctions"]}
    Out[]=
    corundum
    SymmetryEquivalentPositionFunctions,Functionx.,y.,z.,x.,y.,z.,Functionx.,y.,z.,
    1
    2
    -x.,
    1
    2
    -z.,
    1
    2
    -y.,Functionx.,y.,z.,-z.,-x.,-y.,Functionx.,y.,z.,
    1
    2
    +y.,
    1
    2
    +x.,
    1
    2
    +z.,Functionx.,y.,z.,y.,z.,x.,Functionx.,y.,z.,
    1
    2
    -z.,
    1
    2
    -y.,
    1
    2
    -x.,Functionx.,y.,z.,-x.,-y.,-z.,Functionx.,y.,z.,
    1
    2
    +x.,
    1
    2
    +z.,
    1
    2
    +y.,Functionx.,y.,z.,z.,x.,y.,Functionx.,y.,z.,
    1
    2
    -y.,
    1
    2
    -x.,
    1
    2
    -z.,Functionx.,y.,z.,-y.,-z.,-x.,Functionx.,y.,z.,
    1
    2
    +z.,
    1
    2
    +y.,
    1
    2
    +x.

    CrystalLatticePlot3D Function

    To create a 3D graphic representation from a CrystalLattice object, the CrystalLatticePlot3D function was developed. This function extracts the information from that object and creates a representation of the crystalline unit. The data used are the original data contained in the .CIF file of the crystallographic experiments, that is, it is based on the actual data. This function works independently of the functions Molecule and MoleculePlot3D.

    Simple use of the function:

    This function can be used directly on a CrystalLattice object. Below is a simple usage example.
    Representation of a crystalline cell unit of the mineral earlandite:
    In[]:=
    CrystalLatticePlot3DCrystalLattice
    CrystalLattice object
    ​
    earlandite
    MINERAL
    ​
    0019542
    C
    12
    Ca
    3
    H
    18
    O
    18
    

    CrystalLatticeValue Function

    This function, in addition to extracting information from the CrystalLattice object, performs its own analysis and calculation of properties, such as, for example, cell density, content of atoms in the object, or cell volume. It was developed independently from MoleculeValue.

    Examples of using the function:

    Of course, the function can also work with CrystalLattice objects from an organic molecule, if that molecule is generated by the CrystalLattice function by interpreting a .CIF file.
    We took an organic example to use the CrystalLatticeValue function:
    The list of arguments usable by the function can be shown with “Properties”:
    We use CrystalLatticeValue to calculate some of the properties of this crystal unit:

    CrystalLatticeModify Function

    An important function that has been developed exclusively for CrystalLattice objects is the CrystalLatticeModify function. With this function, we can, for example, generate new CrystalLattice objects to represent more than one cell unit of the crystal, a very important requirement for viewing a crystal network with the adjacent cells. The resulting output is created using information from unit cell symmetries, contained in the .CIF file, and translations. The output of this function is also a CrystalLattice object, fully computable, but with the internal information copied and modified by the function to suit the user’s needs.

    Examples of using CrystalLatticeModify and its arguments:

    As this function works with CrystalLattice objects, we chose three of these objects (varying between inorganic and organic) to use with the function as examples.
    First we created the CrystalLattice object from wolframite, graphite and bicyclo(2.2.2)octane-1,4-dicarboxylic acid .CIF files:

    “UnitCellCopy” argument:

    The first, and perhaps the most useful, modification is “UnitCellCopy”, used to create a crystal lattice instead of just a single crystal cell. The number of copies in the directions {x, y, z} can also be given (the standard unit cell is {0,0,0}).
    Representation of wolframite with 3×3×3 = 27 unit cells forming a crystalline network:
    Using the CrystaLatticeModify function together with the {“UnitCellCopy”,{0,0,0}} argument, the CrystalLattice object is still generated with only one cell, but the spatial symmetries are taken into account:
    Visualization of graphite and its crystalline planes with the configuration {1,6,6} or 98 unit cells:

    “UnitCellGather” argument:

    The location of the unit cell within a crystal lattice is arbitrary, and sometimes the atoms of the crystal unit cell are not located within the (0, 1) bounds. To deal with this, there is the “UnitCellGather” modification. Inorganic crystals maintain more of their bonds in this type of representation, unlike organic ones, as their representations may have some connections between atoms disrupted by the action of this modification.
    Example of gathering the atoms of the crystalline unit in an inorganic crystal:
    Example of gathering the atoms of the crystalline unit in an organic crystal:
    Example of gathering the atoms of the wolframite which has already taken into account spatial symmetries with UnitCellCopy:
    Example of copying the cells of the wolframite with symmetries and that have already been gathered, through many unit cells:

    Future perspectives

    This is an ongoing project. This is the first version of the functions and the objective was to test the concept and some functionalities. Some of the future goals are:
    ◼
  • At the moment, an estimate is that the function can interpret perhaps 80% of the obtained .CIF files. This should be improved in the future.
  • ◼
  • CrystalLatticeValue should have more features in the near future, with more options for arguments.
  • ◼
  • CrystalLatticeModify, the “UnitCellCopy” mode must also support the “UnitCellGather” mode simultaneously.
  • ◼
  • Some options for CrystalLatticeModify need to be implemented, such as modifying the crystal using information from atom site occupancy and allowing one to edit cell units for developers of new crystals.
  • ◼
  • Improve the visualization of the bonds and also close, non-covalent contacts between atoms, such as hydrogen bonds.
  • ◼
  • Create a way to visualize the crystal planes inside unit cells, as an option.
  • Functions Code

    CrystalLattice code:

    CrystalLattice function code:

    CrystalLatticePlot3D code:

    Code of CrystalLatticePlot3D:

    CrystalLatticeValue code:

    Code of CrystalLatticeValue:

    CrystalLatticeModify code:

    Code of CrystalLatticeModify:

    References

    ◼
  • Jack D. Dunitz, X-ray Analysis and the Structure of Organic Molecules, Cornell University Press, Ithaca, 1979
  • ◼
  • X-Ray Analysis and the Structure of Organic Molecules, Second Edition, Prof. Dr. Jack D. Dunitz, URL: https://onlinelibrary.wiley.com/doi/book/10.1002/9783906390390
  • ◼
  • ​​The Cambridge Crystallographic Data Centre (CCDC), URL: https://www.ccdc.cam.ac.uk/
  • ◼
  • The American Mineralogist Crystal Structure Database, URL: http://rruff.geo.arizona.edu/AMS/amcsd.php