here are a couple different functions for different purposes having to do with TRG and Ising.