Unexpected crash, Metropolis-Hastings

Dear Professor Pfeifer,

I was running estimation (with 500,000 draws) in Dynare when, toward the end of the first MH block, I got this error:

Error using save
Unable to write file option2/metropolis/ScotModelTest2_mh205_blck1.mat: No such
file or directory.
Error in random_walk_metropolis_hastings_core (line 176)
save([BaseName 'mh’ int2str(NewFile(curr_block)) 'blck’
int2str(curr_block) ‘.mat’],‘x2’,‘logpo2’,‘LastSeeds’);
Error in random_walk_metropolis_hastings (line 127)
fout = random_walk_metropolis_hastings_core(localVars, fblck, nblck, 0);
Error in dynare_estimation_1 (line 424)
feval(options
.posterior_sampling_method,objective_function,options
.proposal_distribution,xparam1,invhess,bounds,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_);
Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);
Error in ScotModelTest2 (line 1249)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

Not sure why this is happening? I am quite concerned this occurring again, especially when having large number of draws, as this could lead to loose days of computations…

Also, is there a way I can make dynare starting again from where it stopped (recovering the chain built so far)?

Files attached. Many thanks
Mattia

Problem solved: this was due to lack of space in the hard disk.

PS
I wanted to removed the post, once I realised it was no longer necessary. However, could not find a way to erase/hide my own post.

I removed the files from your post, but decided to leave this post for future reference. The error message might be helpful to others. Regarding your question: you can try the mh_recover-option

For future reference, I used mh_recover.
At the beginning it seemed to recover entirely the mcmc files from 1st block which was nearly completed.
And indeed all mh_blck.mat were in the “metrolopolis” folder, and the algorithm run almost entirely for the 2nd block (i.e. there are only 2 blocks).

However at the end of the procedure, I got the following message error:

Error using McMCDiagnostics (line 69)
Estimation::mcmc::diagnostics: I cannot proceed because some MCMC files are
missing. Check your MCMC files…
Error in dynare_estimation_1 (line 435)
oo_= McMCDiagnostics(options_, estim_params_, M_,oo_);
Error in dynare_estimation (line 105)
dynare_estimation_1(var_list,dname);
Error in ScotModelTest2 (line 1251)
oo_recursive_=dynare_estimation(var_list_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

When checking the “metrolopolis” folder it seems as, out of 240 mcmc files for block1, those from mh204_block1.mat to mh240_block1.mat are not present (which I guess are those from when the algorithm crashed).
It looks as mh_recover-option failed to properly account for existing/missing mcmc files when recovery estimation? Can that be a flaw of the mh_recover-option?

mh_recover tries to start from the last present file. If there are files in between missing, you may have to delete the last ones and try again.