# Autocorrelation function MC simulation

• Pavol Namer
In summary, Stephen Tashi is trying to estimate how many independent conformation he can obtain during a molecular simulation, but he is not sure how to do it and he is looking for help.

#### Pavol Namer

Dear Members,

I've got a problem with following problem. I have build my first algorithm for Metropolis Monte Carlo. Now I am in a testing phase and one of my bosses ask me for autocorrelation function of my system. I find something in literature, but I am not sure exactly what the autocorrelation function is in my case. I simulate polymer chain inside tube, and I know that due to Metropolis algoritm the new and old conformation are similar but I am can't understand how to implement and how to estimate autocorrelation function for my system.

Please, does anybody know how to around this?

Thank you in advance

PN

Dear users,

Please can someone explain me how can one estimate the system autocorrelation time for Metropolis Monte Carlo Molecular simulation? Or can some post the link to some literature?

I appreciate any information or explanation

Thank you

PN

The mathematical term "autocorrelation" usually refers to a function. The function is computed from a "time series". If you have scalar data that is a function of time, you can compute an autocorrelation function of it. I don't know what "autocorrelation time" would mean as a single value of time. Perhaps this term has a specialized meaning in the study of molecules. Can you give a link to an article that defines it?

If your system is a process depending on a parameter, the autocorrelation function describes the relationship between the values of the process at two parameter values. Since I have no idea what you are doing, I can't go much further.

Dear Stephen Tashi,

Thank you for your response
Here is the following link http://physics.bu.edu/py502/lectures5/mc.pdf

My field of interest for Metropolis Monte Carlo simulation is to estimate how many independent conformation was obtain during the simulation.

Thank you in advise

PN

Do you understand eq. 47 in that paper?

I don't understand eq. 47 completely. At first I can't understand how in denomitor can be the difference of two identical averages, I expect there something like variance but not this difference. The second thing what is not clear to me is the sentence :
"For an ergodicsimulation we expect statistical independence as τ → ∞"

I understand what ergodic simulation mean, but for me this seems like I can't obtain any independent conformation for whole simulation, if my algorithm is ergodi?

Thank you for any explanation of this points.

PN

Pavol Namer said:
I don't understand eq. 47 completely. At first I can't understand how in denomitor can be the difference of two identical averages, I expect there something like variance but not this difference. The second thing what is not clear to me is the sentence :
"For an ergodicsimulation we expect statistical independence as τ → ∞"

I understand what ergodic simulation mean, but for me this seems like I can't obtain any independent conformation for whole simulation, if my algorithm is ergodi?

Thank you for any explanation of this points.

PN

Ergodicity is a minimal requirement to achieve the correct statistics for your system in the long run.
How well-versed are you with statistical mechanics/thermodynamics or Markov processes?

To get a thorough understanding of your simulation (and to be able to interpret the results!) you need some basics first.

One final remark, you will never get exact results with MC simulations. By running for an arbitrary long time you can reach arbitrary precision however. (Some extra conditions are likely needed here, not 100% certain)

Thank you again for your response,

I can say, that I my knowledge in statistical physiscs and thermodynamics are good enought to apply it for MC simulation. But in MC simulation I am totally new, a as I said I just build my first MC program, so here I've got a lot of to do to improve my progam, and here I have just first information about how to implemetn Metropolis scheme into the algorithm.

In my office, I've got colleagues whose used to work with MC simulation. I have discuss some basic things with them, and they first ask me how many independent conformation I can obtain during my simulation. Then one of them told me that I have to look on a autocorrelation function. Unfortunatelly they don't have enought time to explain me everything, so I try to study something about it in literature, but here I am lost, and can not find some fundamental information (here I would like to start) for this problem.

To clarify what I simulate, so I try to simulate a polymer chain inside the nanotube via Metropolis Monte Carlo scheme, of course I am interesting for now I am interesting for basic averages observables, and some properties, like average of chain extension and so on...

So maybe this help you to understand why I have not enought detail question. Maybe you can recommended me some basic literature to this topic.

Again thank you for any response,

PN

I enjoyed using Newman and Barkema's text during my brief use of monte carlo methods.
For general information regarding simulations in physics I can also recommend the book by Frenkel and Smit (Understanding Molecular Simulation, link to first edition pdf.)

I'm certain the former text introduces the notion of an autocorrelation function in a clear way for the Ising spin-model (THE prototype example used when learning about this)

Regarding the ergodicity, this basically says that every possible state can be reached from any initial state. This means that the state-space is connected.
For a finite Markov process, it can easily be proven that ergodicity is a sufficient condition which makes it possible to have the desired statistics after a certain relaxation time. (You could try this if you like see for example assignment 6 in these lecture notes found here)

Returning to the problem of correlation time, I advise you read section 2.6 of the lecture notes I provided as well. Note that these notes are very basic compared to the books I mentioned. For example in Newman's book they also give some tips regarding programming and numerical stability.

It might be just the push you need to understand it.

Last edited:
Thank you very much, this helps me a lot, really thank you many times.

PN

Pavol Namer said:
I don't understand eq. 47 completely. At first I can't understand how in denomitor can be the difference of two identical averages, I expect there something like variance but not this difference.

In terms of a sample, the "mean of the squares" is different than the "square of the mean". In terms of a random variable X, Var(X) = E(X^2) - (E(X))^2.

The numerator has the pattern of a covariance. COV(X,Y) = E(XY) - E(X)E(Y) if we assume E(X) = E(Q[k]) = E(Q[k+r]) = E(Y).

The second thing what is not clear to me is the sentence :
"For an ergodicsimulation we expect statistical independence as τ → ∞"
I don't understand that as a mathematical theorem. An argument for it in the case of specific application to physics appears at the top of page 14 in the notes JorisL mentioned: http://itf.fys.kuleuven.be/~enrico/Teaching/monte_carlo_2014.pdf

I understand what ergodic simulation mean, but for me this seems like I can't obtain any independent conformation for whole simulation, if my algorithm is ergodi?

As far as I know, determining that you simulation is approximately ergodic won't prove you correctly modeled the polymer. It only indicates that your implementation of the Markov Monte Carlo process was good.