In page 900, “PHI is lognormal with a mean of unity and a standard deviation sigma” . Suppose that ln(omega) ~N(M,S). Then, we have the following relationship: exp(M+.5*S^2)=1, and (exp^(S^2)-1)*exp(2M+S^2)=sigma. In my opinion, S and sigma is different, but in the dynare code written by Ambrogio, they are the same.
In the equation " g = normcdf((log(omegab)-M)/S - S) - PHI*mu + (1-PHI)*omegab; ", I do know why the first term in right side needs to substract S.