_mh_mode after estimation

Hi all,

I was wondering how Dynare calculates the _mh_mode file after an estimation run. I tried to find it but without any luck. My motivation is that I have an estimation outside of Dynare and would like to use the posterior covariance matrix to improve upon it in the next run.

Would be glad if you could point me to the right direction.

Essentially, you just compute cov(posterior_draws). The relevant code is

Thank you so much, I will have a look at it.