jaxrens.backends.ensemble

Ensemble corrections (PV, μN) as an additive Hamiltonian term.

Adds thermodynamic potential terms to the raw model energy:

NVT:  H = U                    (no term)
NPT:  H = U + P*V
μPT:  H = U + P*V - μ·N

Usage:

model = HarmonicBackend(k=1.0)
backend = Hamiltonian(model, [EnsembleTerm(pressure=0.01)])
result = backend(positions, species, cell, max_neighbors)
# result.energy = U + P*V

For per-run vmap with different pressures or chemical potentials, pass ensemble_params (keys "pressure" and "chemical_potentials"):

backend(pos, species, cell, mn, ensemble_params={"pressure": 0.02})
backend(pos, species, cell, mn,
        ensemble_params={"chemical_potentials": mu})  # (n_species,)

Functions

EnsembleBackend

Convenience: base plus an EnsembleTerm.

ensemble_energy

P·V − μ·N for one configuration.

make_ensemble_params

Create ensemble_params dict for MCState.

rebase_ensemble_energy

Re-express a stored energy under another run's ensemble params.

Classes

EnsembleTerm

P·V − μ·N ensemble correction.