pyextal.jaxJoint.engine ======================= .. py:module:: pyextal.jaxJoint.engine .. autoapi-nested-parse:: Keeping the Fortran engine on the dataset being worked on. ``bloch_parse`` loads one ``.dat`` into the engine's module state, and several things the refinement needs read that state rather than anything passed to them: `get_bloch_constants`, the symmetry operations (`spgr`, used by `GroupSymmetry` and `appliedSymmetry`), `lookupSF`/``defaultsf``, and ``beamcheck`` -- which `calculate_tilt_dependent_values` calls per tilt, at setup and at every geometry rebuild. With several datasets the engine must hold the right one whenever any of these runs, so every such step goes through `EngineSwitch.activate`. Re-parsing is safe: the engine's allocators release the previous arrays first. ``terminate()`` is not: it ends the engine for the life of the process, so it must never run between datasets. jaxJoint never calls ``bloch_run``, so there is nothing to terminate at the end either. Attributes ---------- .. autoapisummary:: pyextal.jaxJoint.engine.MAX_DAT_PATH Classes ------- .. autoapisummary:: pyextal.jaxJoint.engine.EngineSwitch Module Contents --------------- .. py:data:: MAX_DAT_PATH :value: 120 .. py:class:: EngineSwitch Parses each dataset's ``.dat`` into the engine on demand. Datasets are added in order; `activate` re-parses only when the engine holds a different ``.dat``, so two datasets built against the same file never re-parse between them. .. py:attribute:: _dats :value: [] .. py:attribute:: _params .. py:attribute:: _beams .. py:attribute:: _loaded :value: None .. py:attribute:: _tmp :value: None .. py:attribute:: parses :value: 0 .. py:method:: add(dat) Registers a dataset's ``.dat`` and returns its index. .. py:method:: _short(dat) .. py:method:: record(d, constants) Remembers the beam list dataset ``d``'s setup was built with. .. py:method:: activate(d) Makes the engine hold dataset ``d``'s ``.dat``. :param d: Dataset index. :type d: int :returns: From that dataset's ``bloch_parse``. :rtype: SimParams :raises RuntimeError: If the re-parsed beam list differs from the one the dataset was set up with. .. py:method:: _check(d)