What's the rationale behind 100 as the thinning factor? Just a conservative number based on the autocorrelation length?
Thinning is a good idea if the samples are strongly correlated, and the computation to process them all would be better spent on running the chain for longer. Or if you don't know what computation you want in advance, and you can't afford to store everything.
(Also, as someone points out in the comments, the implementation of the Metropolis algorithm in this post is wrong.)