Help using Turing for Lattice Path Integral Calculations

Hello everyone,

I am hoping to gain some insight into a particular problem I want to solve which I’ve done using PyMC3 but I lack the insight at the moment to make it working using Turing/AdvancedHMC. While not the problem I want to solve, it is similar. The PyMC3 code below is the Ising model on a 2-dimensional lattice.:

with pm.Model() as Model:
         R = pm.Bernoulli("R", 0.5, shape=[Nx, Ny])
         Spins = 2*R-1
         H = Hamiltonian(Spins)
         P = pm.Potential("Probability", exp(-H/T) )
         
         Step = pm.BinaryMetropolis([R], scaling = Some_Number)
         Trace = pm.sample(Number_of_Iterations, step = Step, chains = 1)

If I were to code this by hand, I would accept-reject a spin configuration based on the relative probability of

P = exp(-(H_New - H_Old)/T)

if H_New > H_Old and accept it if H_New < H_Old

but I want to use the new samplers instead and the wonderful utilities offered by turing.

Question: How would I code the above Potential function in Turing/AdvancedHMC without having to specify an observed in a likelihood?

Thank you for your time.