Dear Simon,
Thanks for the question.
nimbleModel by default does a model$calculate() as one of its last steps. (You can skip this by calculate=FALSE, but that's not your problem.)
model$calculate() does the following: In topologically sorted order (i.e. parent nodes before descendent nodes), calculate deterministic values for deterministic nodes ("<-") or calculate log probabilities for stochastic nodes ("~").
Therefore, it is typically not very useful to provide initial values for deterministic nodes, as you have done. They will be overwritten by values calculated in the model as soon as model$calculate() runs. (In your case, if you use calculate=FALSE in nimbleModel, you will see your initial values for fc, which addresses part of your question but not really the underlying problem.)
For your model, when model$calculate() operates within nimbleModel (or you can run it yourself), it appears that the deterministic calculations really do result in values of pcap that are all 1s. Roughly what I see from the code is that pcap scalars depend on fc vectors, which depend on f vectors, which depend on f_0 scalars and p vectors, which depend on up and low vectors, which depend on sigma scalars, which depend on p_sp scalars, which are the stochastic parents to that entire chain of calculations. One could follow all the calculations directly in R as well. I can't be sure but I'm thinking that there could be a mistake in your math. I am not checking the details, but roughly it looks like you have discretized a half-normal distribution into a set of bins, adjusted those bins for two dimensions, and summed the total probability, resulting (correctly?) in values of 1? I am wondering if there is a missing component to the modeling ideas.
In fact, the situation is slightly worse than having all pcap values be exactly 1. That would result in -Inf log probabilities because for y~dbin(p, N) with p==1, the probability is 0 if y is not equal to N (as you have). In your case, however, the numerical imprecisions on the calculations resulting in pcap are such that all the values are slightly > 1, which results in NaN log probabilities, which is what is happening.
If you want to gain more insight into model$calculate(), you can do:
for(node in model$getNodeNames()) model$calculate(node)
Your model as >73000 nodes you might prefer to use more of a toy example for exploration.
Finally, I note that Michael Scroggie has some tools for distance sampling models in nimble
here. I don't know its state of development (I hope it's ok to point it out!).
HTH
Perry