Thanks for following up, Robin.
In nimble there is an alternative to the zeros trick. (The zeros trick is a way to get an arbitrary log probability included in the model by having a fake "data" value that is zero, and declaring it to follow a Poisson. The log probability of a zero in a Poisson is -lambda. So by calculating whatever log probability you want and assigning it to lambda, it ends up included in the model's probability calculations.)
In nimble, you can do that arguably a bit more readably and elegantly with a user-defined distribution. The need arises when one wants to calculate a value, say y, and then have it follow a distribution. It can be done like this:
y <- [some calculation]
fake_datum ~ d_my_dist(y, arg2, arg3)
When that code is in a model, the log probability contribution will come from calling:
d_my_dist(fake_datum, y, arg2, arg3, log=TRUE)
so you can then write d_my_dist to simply ignore fake_datum and use y, arg2, and arg3 for whatever log probability calculation you want.
HTH
Perry