CFML_Metrics

This module provides types and procedures to represent and operate with crystal cells.

Dictionaries

cell_type

Keys and types:

  • ang (ndarray, dim=(3), float32): cell parameters \(\alpha\), \(\beta\) and \(\gamma\).

  • cell (ndarray, dim=(3), float32): cell parameters \(a\), \(b\) and \(c\).

  • sang (ndarray, dim=(3), float32): standard deviations of component ang.

  • scell (ndarray, dim=(3), float32): standard deviations of component cell.

  • svol (float): volume standard deviation.

  • vol (float): unit cell volume.

cell_g_type

Extension of type cell_type.

Keys and types:

  • bl_m (ndarray, dim=(3,3), float32): Busing-Levy B-matrix.

  • carttype (str): cartesian coordinate system, ‘CA’ (default) | ‘BC’ | ‘BA’ | ‘CB’.

    ‘CA’ : \(z\) // \(c\) and \(x\) // \(a^*\).

    ‘AC’ : \(x\) // \(a\) and \(z\) // \(c^*\).

    ‘BC’ : \(y\) // \(b\) and \(z\) // \(c^*\).

    ‘BA’ : \(y\) // \(b\) and \(x\) // \(a^*\).

  • cr_orth_cel (ndarray, dim=(3,3), float32): matrix transformation from fractional to cartesian coordinates.

  • gd (ndarray, dim=(3,3), float32): direct matrix tensor.

  • gr (ndarray, dim=(3,3), float32): reciprocal matrix tensor.

  • inv_bl_m (ndarray, dim=(3,3), float32): inverse Busing-Levy B-matrix.

  • orth_cr_cel (ndarray, dim=(3,3), float32): matrix transformation from cartesian to fractional coordinates.

  • rang (ndarray, dim=(3), float32): reciprocal cell parameters \(\alpha^*\), \(\beta^*\) and \(\gamma^*\).

  • rcell (ndarray, dim=(3), float32): reciprocal cell parameters \(a^*\), \(b^*\) and \(c^*\).

  • rvol (float): reciprocal unit cell volume.

Functions

set_cell(vcell, vang, **kwargs)

Creates an object of type cell_g_type.

Parameters:
  • vang (ndarray, dim=(3), type=float32) – lattice parameters \(\alpha^*\), \(\beta^*\) and \(\gamma^*\).

  • vcell (ndarray, dim=(3), type=float32) – lattice parameters \(a^*\), \(b^*\) and \(c^*\).

  • kwargs – optional arguments.

  • kwargs['carttype'] (str) – cartesian coordinate system.

  • kwargs['vsang'] (ndarray, dim=(3), type=np.float32) – vang standard deviations.

  • kwargs['vscell'] (ndarray, dim=(3), type=np.float32) – vcell standard deviations.

Returns:

crystal cell

Return type:

dict (cell_g_type)

>>> from pycrysfml import cfml_metrics
>>> import numpy as np
>>> vcell = np.array([4.0,4.0,7.0],dtype=np.float32)
>>> vang = np.array([90.0,90.0,120.0],dtype=np.float32)
>>> cell = cfml_metrics.set_cell(vcell,vang,carttype='AC')
>>> for k in cell:
...   print(f'{k :>10}: {cell[k]}')
...
       cell: [4. 4. 7.]
      scell: [0. 0. 0.]
        ang: [ 90.  90. 120.]
       sang: [0. 0. 0.]
        vol: 96.99484252929688
       svol: 0.0
      rcell: [0.28867513 0.28867513 0.14285715]
       rang: [90. 90. 60.]
       rvol: 0.010309826582670212
         gd: [[16. -8.  0.]
              [-8. 16.  0.]
              [ 0.  0. 49.]]
         gr: [[0.08333333 0.04166666 0.        ]
              [0.04166666 0.08333333 0.        ]
              [0.         0.         0.02040816]]
cr_orth_cel: [[ 4.        -2.         0.       ]
              [ 0.         3.4641016  0.       ]
              [ 0.         0.         7.       ]]
orth_cr_cel: [[ 0.25        0.14433756 -0.        ]
              [-0.          0.28867513 -0.        ]
              [ 0.         -0.          0.14285715]]
       bl_m: [[ 0.28867513  0.14433756  0.        ]
              [ 0.          0.24999999 -0.        ]
              [ 0.          0.          0.14285715]]
   inv_bl_m: [[ 3.4641016 -2.0000002 -0.       ]
              [-0.         4.0000005  0.       ]
              [ 0.        -0.         6.9999995]]
   carttype: AC