hikari.dataframes.base

Classes

BaseFrame

This class stores and manipulates basic information present

Module Contents

class hikari.dataframes.base.BaseFrame[source]

This class stores and manipulates basic information present in majority of crystallographic information files such as unit cell parameters stored in scalars and vectors.

BaseFrame utilises the following notation for stored attributes:

  • The name begins from a unit cell property we are interested in:

  • “a”, “b”, “c” describe unit cell lengths/vectors a, b, c,

  • “al”, “be”, “ga” describe unit cell angles alpha, beta, gamma,

  • “v” describes unit cell volume,

  • “x”, “y”, “z” describe directions - normalised unit cell vectors.

  • “A”, “G” describe stacked vector and metric matrix, respectively.

  • The unit cell parameter symbol is then followed by an underscore “_”.

  • The name ends with a single letter denoting type of space and variable:

  • “d” (from Direct) denotes direct space scalars/matrices,

  • “r” (from Reciprocal) denotes reciprocal space scalars/matrices,

  • “v” (from Vector) denotes direct space vectors,

  • ‘w” (similar to “v”) denotes reciprocal space vectors.

The values can be accessed by referencing a given attribute in the object, for example BaseFrame. a_d stores information about the lattice constant a in direct space as a floating point, but BaseFrame. a_v is a direct space vector. Available attributes have been once again presented in a table below:

Available constants

in direct space

in reciprocal space

Unit (^-1 in reciprocal)

Scalars

a, b, c

a_d, b_d, c_d

a_r, b_r, c_r

Angstrom

al, be, ga

al_d, be_d, ga_d

al_r, be_r, ga_r

Radian

v

v_d

v_r

Angstrom^3

Vectors

a, b, c

a_v, b_v, c_v

a_w, b_w, c_w

Angstrom

x, y, z

x_v, y_v, z_v

x_w, y_w, z_w

Angstrom

Matrices

A

A_d

A_r

Angstrom^2

G

G_d

G_r

Angstrom^2

IMPORTED_FROM_CIF
orientation

3x3 matrix describing orientation of crystal during experiment.

edit_cell(**parameters)[source]

Edit direct space unit cell using a dictionary with the following keys:

  • “a” - for unit cell parameter a given in Angstrom,

  • “b” - for unit cell parameter b given in Angstrom,

  • “c” - for unit cell parameter c given in Angstrom,

  • “al” - for unit cell parameter alpha given in degrees or radians,

  • “be” - for unit cell parameter beta given in degrees or radians,

  • “ga” - for unit cell parameter gamma given in degrees or radians.

This method is equivalent to manually setting all six unit cell parameters in direct space, a_d, b_d, c_d, al_d, be_d, ga_d, and then running a private method _refresh_cell() to update other values.

Please mind that the while the “a”, “b” and “c” are always given in Angstrom, the angles might be given either in degrees or in radians. For details see function hikari.utility.math_tools.angle2rad().

It is not required for all previously stated keys to be present at each method call. If a key has not been given, previously provided and stored value is being used. If no value has been given, the default length values of 1.0 for a, b, c and default angle values of pi/2 for al, be, ga are used instead.

Parameters:

parameters (float) – Values of unit cell parameters to be changed

fill_from_cif_block(block, fragile=False)[source]

Import all data specified in IMPORTED_FROM_CIF such as unit cell parameters and orientation matrix from provided instance of hikari.dataframes.cif.CifBlock called block. Unless fragile is True, use defaults instead of rising KeyError.

Parameters:
  • block (hikari.dataframes.CifBlock) – CifBlock containing imported information.

  • fragile (bool) – If True, raise Error when any imported info is missing

_refresh_cell()[source]

Recalculate all vectors and scalars other than a_d, b_d, c_d, al_d, be_d, ga_d based on the currently stored values of the aforementioned six.

property a_d

Length of unit cell vector a in direct space. :rtype: float

Type:

return

property b_d

Length of unit cell vector b in direct space. :rtype: float

Type:

return

property c_d

Length of unit cell vector c in direct space. :rtype: float

Type:

return

property al_d

Angle between vectors b and c in degrees. :rtype: float

Type:

return

property be_d

Angle between vectors c and a in degrees. :rtype: float

Type:

return

property ga_d

Angle between vectors a and b in degrees. :rtype: float

Type:

return

property v_d

Unit cell volume in direct space. :rtype: float

Type:

return

property a_v

Unit cell vector a in direct space. :rtype: numpy.array

Type:

return

property b_v

Unit cell vector b in direct space. :rtype: numpy.array

Type:

return

property c_v

Unit cell vector c in direct space. :rtype: numpy.array

Type:

return

property A_d

Basis matrix A with vertically stacked direct space vectors. :rtype: np.array

Type:

return

property G_d

Direct space metric matrix [ai . aj]ij. :rtype: np.array

Type:

return

property a_r

Length of unit cell vector a* in reciprocal space. :rtype: float

Type:

return

property b_r

Length of unit cell vector b* in reciprocal space. :rtype: float

Type:

return

property c_r

Length of unit cell vector c* in reciprocal space. :rtype: float

Type:

return

property al_r

Angle between vectors b* and c* in degrees. :rtype: float

Type:

return

property be_r

Angle between vectors c* and a* in degrees. :rtype: float

Type:

return

property ga_r

Angle between vectors a* and b* in degrees. :rtype: float

Type:

return

property v_r

Unit cell volume in reciprocal space. :rtype: float

Type:

return

property a_w

Unit cell vector a* in reciprocal space. :rtype: numpy.array

Type:

return

property b_w

Unit cell vector b* in reciprocal space. :rtype: numpy.array

Type:

return

property c_w

Unit cell vector c* in reciprocal space. :rtype: numpy.array

Type:

return

property A_r

Basis matrix A* with vertically stacked reciprocal space vectors. :rtype: np.array

Type:

return

property G_r

Reciprocal space metric matrix [ai* . aj*]ij. :rtype: np.array

Type:

return

SELLING_S6_TRANSFORMATIONS
SELLING_E3_TRANSFORMATIONS