# Monte Carlo simulation [closed]

I am wondering if I am thinking correctly about the following problem :

1. Define the box of the dimensions $$(a,a,H)$$ in the $$X$$,$$Y$$, and $$Z$$ directions, respectively.
2. Insert $$n$$ particles into the box using PBC in $$X$$ and $$Y$$ directions
3. Move the particles using a quite analogous condition as in the previous pgms (of course, PBC in $$X$$ and $$Y$$ directions should be taken into account)

To test the pgm use $$a=10$$, $$H=6$$, $$n$$ of the order of $$100-500$$

1. I have generated random numbers for the $$x$$ and $$y$$ axis from the interval $$[0,a]$$ and for $$z$$ $$[0,h]$$.

2. Then, I have applied the PBC to the $$x$$ and $$y$$ axis and shifted them with the following rule: xt=x(j)+shift*2*rand() - shift and also applied PBC to the shifted position.

Xt is the new position of the point. For the y axis the operation is similar. shift is the parameter in the interval $$[0.1,1]$$ but in this case, it is $$0.5$$

Am I thinking correctly about this problem, or there is some other way that I should take into account?

• There's many different ways of going about MC, depending on the problem. What is the specific problem you're trying to solve? Sounds like molecular dynamics, but it's not completely clear from the question. I assume xt is your new position, but what is shift ? – Lukas Bystricky Jul 20 '15 at 9:24
• Oh, i have forgotten to add the shift declaration. It is the parameter in the interval [0.1,1] but for this problem has been said to be 0.5 – Beginner in fort Jul 20 '15 at 9:32
• Ok, so you insert n particles randomly into the box and then move each particle randomly, within $\pm$ shift. It seems like a 2D simulation so I don't know why you're extending your box in the $z$ direction. Depending on what you're interested in you may wish to start your particles on a lattice instead of distributing them randomly. – Lukas Bystricky Jul 20 '15 at 9:49
• Yeah it seems like you're on the right track. You'll probably want to run your simulation several (1000s) of times and then take the average; that's the whole idea behind MC. I would also look into whether you should be starting the particles on a lattice instead of randomly. – Lukas Bystricky Jul 20 '15 at 10:05
• I don't know enough about the problem. I would say unless it specifically asks for randomly generated points I would stick to a lattice and then let the displacements be the random part. Seems to me like adding two random components might be unnecessary; but again I don't know the specific problem. – Lukas Bystricky Jul 20 '15 at 10:12