pyextal.jaxMultipole.crystal ============================ .. py:module:: pyextal.jaxMultipole.crystal .. autoapi-nested-parse:: The crystal a multipole model lives in. A `Crystal` is a plain snapshot -- cell, metric, operations, sites, voltage -- taken from the Bloch engine once, so that everything downstream is pure NumPy / JAX and never touches the engine's global state again. Reading the structure from the same ``.dat`` the Bloch refinement used guarantees the two agree on the cell, the setting, the origin and the atom list, which a second structure input could silently break. Cartesian frame: ``a`` along x, ``b`` in the xy plane, ``c`` completing a right-handed set. ``A`` holds ``a, b, c`` as columns, so ``r = A x`` for fractional ``x``; reciprocal vectors are ``k = B* h`` with ``B* = inv(A).T``, and ``|k| = 2 s`` with ``s = sin(theta)/lambda`` (no factor 2 pi). Classes ------- .. autoapisummary:: pyextal.jaxMultipole.crystal.Site pyextal.jaxMultipole.crystal.Crystal Functions --------- .. autoapisummary:: pyextal.jaxMultipole.crystal.cell_matrix pyextal.jaxMultipole.crystal.element_of Module Contents --------------- .. py:function:: cell_matrix(a, b, c, alpha, beta, gamma) ``A`` with the lattice vectors as columns (a along x, b in xy). .. py:function:: element_of(label) Element symbol from an engine or user label: ``'SR'`` -> ``'Sr'``, ``'O1'`` -> ``'O'``. .. py:class:: Site One asymmetric-unit atom. :ivar label: Unique name, e.g. ``'Sr1'``, ``'O1'``. :vartype label: str :ivar element: Element symbol, ``'Sr'``. :vartype element: str :ivar engine_label: The label the engine used (``'SR'``, ``'TI4+'``), which decides its Cromer-Mann row. :vartype engine_label: str :ivar xyz: Fractional coordinates. :vartype xyz: np.ndarray :ivar occ: Occupancy. :vartype occ: float :ivar beta: Engine 6-vector ``(b11, b22, b33, b12, b13, b23)``. :vartype beta: np.ndarray :ivar stab: ``(m, 3, 3)`` fractional rotations that fix the site. :vartype stab: np.ndarray .. py:attribute:: label :type: str .. py:attribute:: element :type: str .. py:attribute:: engine_label :type: str .. py:attribute:: xyz :type: numpy.ndarray .. py:attribute:: occ :type: float .. py:attribute:: beta :type: numpy.ndarray .. py:attribute:: stab :type: numpy.ndarray .. py:property:: order .. py:class:: Crystal Cell, symmetry and sites. :ivar cell: ``a, b, c, alpha, beta, gamma``. :vartype cell: np.ndarray :ivar A: (3, 3) lattice vectors as columns, Angstrom. :vartype A: np.ndarray :ivar ops_W: ``(n, 3, 3)`` fractional rotations of the full group modulo lattice translations (inversion and centring folded in). :vartype ops_W: np.ndarray :ivar ops_w: ``(n, 3)`` their translations. :vartype ops_w: np.ndarray :ivar centro: The group is centrosymmetric. :vartype centro: bool :ivar ops_inv: ``(n,)`` bool, the operation is one of the inversion-related half the engine adds to its coset representatives (``(-W, w)``); reflections reached only through these are Friedel mates, linked by conjugation (`jaxMultipole.symmetry.link_phase`). :vartype ops_inv: np.ndarray :ivar sites: Asymmetric unit. :vartype sites: list[Site] :ivar kv: Accelerating voltage the Ug refer to, kV. :vartype kv: float :ivar source: Where it came from. :vartype source: str .. py:attribute:: cell :type: numpy.ndarray .. py:attribute:: A :type: numpy.ndarray .. py:attribute:: ops_W :type: numpy.ndarray .. py:attribute:: ops_w :type: numpy.ndarray .. py:attribute:: centro :type: bool .. py:attribute:: sites :type: list .. py:attribute:: kv :type: float .. py:attribute:: source :type: str :value: '' .. py:attribute:: ops_inv :type: numpy.ndarray :value: None .. py:method:: __post_init__() .. py:property:: Bstar .. py:property:: G .. py:property:: Gstar .. py:property:: omega .. py:property:: gamma .. py:property:: n_ops .. py:method:: s(hkl) ``sin(theta)/lambda`` of reflections ``(..., 3)``. .. py:method:: site(label) .. py:method:: cart_rotation(W) Cartesian matrix of a fractional rotation, ``A W A^-1``, snapped orthogonal. Rounding in the cell leaves ``A W A^-1`` orthogonal only to the cell's precision; the nearest orthogonal matrix (polar factor) removes that. .. py:method:: with_kv(kv) Copy at another voltage (Ug scale with gamma). .. py:method:: manual(cell, ops, sites, kv, centro=None, source='manual', tol=0.0001, ops_inv=None) :classmethod: Builds a crystal without the engine. :param cell: ``a, b, c, alpha, beta, gamma``. :type cell: sequence :param ops: ``(W, w)``, the full group modulo lattice translations. :type ops: tuple :param sites: ``dict(label, xyz, beta, occ=1, element=None)``. :type sites: list[dict] :param kv: Voltage. :type kv: float :param centro: Inferred from the operations when None. :type centro: bool, optional :param ops_inv: Marks the inversion-related half of the operations (see the class attributes); none when omitted. :type ops_inv: array, optional .. py:method:: from_dat(path, labels=None, tol=0.0001) :classmethod: Snapshots a ``.dat`` file through the Bloch engine's parser. :param path: The crystal file the refinement used. :type path: path-like :param labels: Site names; ``Sr1, Ti1, O1, ...`` by default. :type labels: list[str], optional :param tol: Site-symmetry tolerance, fractional. :type tol: float .. note:: ``bloch_parse`` resets the engine's global state and accepts paths of at most 120 characters; a longer absolute path is retried relative to the working directory. No simulation is run, so ``terminate()`` is never needed.