Solvers#

A Solver is a Python class that connects hklpy2 with a backend library providing diffractometer capabilities, including:

  • definition(s) of physical diffractometer geometries

    • axes (angles and reciprocal space)

    • operating modes for the axes

  • calculations that convert:

    • forward: reciprocal space coordinates into diffractometer angles

    • inverse: diffractometer angles into reciprocal space coordinates

  • support blocks include:

    • calculate the UB matrix

    • refine the crystal lattice

    • sample definition (name, lattice parameters, orientation reflections)

A Solver class is written as a plugin for hklpy2 and is connected by an entry point using the "hklpy2.solver" group.

Solvers provided with hklpy2:

Name

Description

hkl_soleil

Hkl/Soleil backend (Linux 64-bit only). Supports many geometry types.

no_op

No-op solver for testing. Provides no useful geometries.

th_tth

Pure-Python minimal solver: \(\theta, 2\theta\) geometry with \(Q\) pseudo axis. Runs on any OS.

A Solver is not needed to:
  • define subclass of DiffractometerBase() and create instance

  • create instance of Sample()

  • create instance of Lattice()

  • create instance of _WavelengthBase() subclass

  • create instance of SolverBase() subclass

  • set wavelength

  • list available solvers: (solvers())

  • review saved orientation details

A Solver is needed to:

See also

Solvers Guide for how to list, select, and instantiate solvers.

How to write a new Solver for how to write a new solver plugin.