Help needed. SW model with stochastic detrending

Hi,

I am writing a version of Smets and Wouters (2007) model adjusted from stochastic de-trending rather than deterministic. However, I want to run the estimations under the optimization routine 4 or 1. but when i run it im getting the usual error of:

Error using chol
Matrix must be positive definite.
.
.
.
.
Error in dynare (line 120)
evalin(‘base’,fname) ;

The error gets solved when i run it for mode_compute=6. However, ‘6’ solves it for local optimization rather than global. Therefore, can anyone please tell me how to get rid of this error while using the optimization routine 4 or 1? I have also used the first estimation results which i get for the Posterior Maximization (using routine 4) to reset my initial values and priors accordingly but it doesnt help.

I have attached the .mod file and data file (xls format). Also the .mod file reads the data from .mat but i cannot upload .mat format file.

Thanks a lot.
usmodel_data.xls (191 KB)
usmodeladj7.mod (17 KB)

also does anyone have the dynare code for the Negro & Schorfheide (2012) paper (DSGE Model-Based Forecasting)? in the above .mod file im trying the replicate their model which add stochastic detrending to SW (2007) model. But they do not provide any dynare code or even the estimation results due to the nature of their paper.