This is a notorious method, known as the Metropolis algorithm [1]}.
The total energy of the system is monitored after each Monte Carlo step, and it is used to determine if the equilibrium configuration has been reached.
This we estimate as the moment in which the total energy does not exhibit significant changes rather than statistical fluctuations.
For each Monte Carlo simulation we perform \(10^7\)  Monte Carlo steps, and typically we observe that the equilibrium configuration is reached after approximately \(10^5\)  Monte Carlo steps (not shown).
