There are two things to notice here:
- In the first message you printed where PCG converges after 1 iteration, this is an indication that the preconditioner matrix being used is a complete factorization. The problem is solved after 1 iteration because performing a complete LU factorization on the coefficient matrix is the same as solving the problem.
- It's not surprising to see PCG not converge after 100 iterations, but it is surprising to see a relative residual of NaN. This suggests that one of the values in the solution vector blew up to Inf at some point (or, less likely, that you provided an initial guess or coefficient matrix that had a NaN or Inf in it). The best advice for this case is to use a better preconditioner matrix since that helps with the condition of the coefficient matrix.
That said, I would expect these two messages to be returned by PCG for two separate function calls. If, as advertised, both of these messages were printed by PCG for a single function call, then I recommend calling Technical Support. That could potentially be a bug that needs to be fixed.