Beginner, Forward model and calling external function

Thank you very much for your kind reply.

As a beginner, I will prefer to use autodiff for the calculations of gradients.

So, if I consider the option 1 of the second thread you suggested, means writing my forward model code in the STAN language. I will be able to call it in the model block, right?