jaxrens.backends.nequix

Nequix energy backend.

Wraps a pre-trained Nequix model (an equinox.Module loaded via nequix.model.load_model) behind the EnergyBackend interface. JIT-compatible neighbor finding via the shared supercell helper (backends._graph_neighbors) — same primitive the MACE backend uses.

nequix is an optional dependency. All imports are guarded.

Energy-only path

Nequix.__call__ wraps the energy core in eqx.filter_grad (for forces) and additionally in a strain-perturbation grad (for stress). Nested sampling needs only the scalar energy, so the backend calls model.node_energies directly, bypassing both backward passes. value_and_grad(backend) from the galilean kernel still differentiates correctly through the energy-only path because nequix’s node_energies is a pure forward function.

Graph convention bridging

_supercell_edges follows the MACE/jraph convention where senders[k] is the central atom and receivers[k] is the neighbor atom (in its periodic image, located at positions[receivers[k]] + shifts[k]). Nequix’s node_energies expects the opposite: messages flow FROM the neighbor TO the central atom (messages[senders] is read at the source, scatter_sum(dst= receivers) aggregates at the destination). This wrapper swaps the two when calling into nequix; the displacement vector is computed as positions[receivers] - positions[senders] + shifts (from the centre to its image-shifted neighbor) which is exactly nequix’s positions[senders'] - positions[receivers'] + offsets after the swap.

Non-periodic systems

For non-periodic systems (cell == 0), use supercell_trafo=(1, 1, 1) and pass a real cell vector. The wrapper applies the same safe_cell trick as the NeuralIL backend (substitute a large dummy cell when the trace is zero) so the supercell expansion has a well-defined geometry.

Functions

create_nequix

Create a Nequix energy backend from a bundled name or a .nqx path.

is_available

Classes

NequixBackend

Nequix energy backend for jaxrens.