pytc.vmc.metropolis.make_mcmc_step¶
- pytc.vmc.metropolis.make_mcmc_step(ansatz, step_size, move_type='one', max_vmap_batch_size=0, mesh=None)[source]¶
Factory to create a JIT-compilable MCMC step function.
This function validates move_type at creation time (not JIT time) and returns a JIT-compilable step function that performs Metropolis-Hastings sampling.
The
ansatzargument is captured at factory time and used for all subsequent MCMC steps. This is critical foroptimize_ref_var, where the factory receivesref_det(aSlaterDet) so that walkers are sampled from |Det|² regardless of what ansatz object is passed at call time by the training loop.- Parameters:
ansatz – Wavefunction object — captured and used for MCMC proposals.
step_size – Standard deviation of Gaussian proposal for MCMC moves
move_type – “all” to move all electrons at once, “one” to move one electron at a time
max_vmap_batch_size – If > 0, use folx.batched_vmap with this batch size
- Returns:
mcmc_step(ansatz, walkers, key, params) -> (new_walkers, acceptance_rate)
- Return type:
A JIT-compiled function with signature
- Raises:
ValueError – If move_type is not “all” or “one”