Compatibality with C/C++ wrapped functions

You have to wrap the potential function U into a theano function, and then call it within with pm.Model():

There are quite a look of similar discussion here if you do a search of (C/C++/Fortran), eg:

You can also have a look at this discussion on Github:

As for sampling from the target potential function, you can write it as a pm.Potential('rho', -(T+U)).