Skip to content

Repository files navigation

MCLongRange

This repository accompanies the article Markov-chain sampling for long-range systems without evaluating the energy, by Gabriele Tartero and Werner Krauth. It contains all the supplementary material discussed in Appendix A.

This article may be downloaded for personal use only. Any other use requires prior permission of the author and AIP Publishing. This article appeared in The Journal of Chemical Physics, Volume 161, Issue 9 (September 2024) and may be found also here.

Python programs

The Python directory contains five simulations of a system of $N$ particles interacting via a Lennard-Jones potential in a periodic box, with $\beta = 1$:

  • metropolis.py, the standard (non-factorized) Metropolis algorithm (discussed in Section II.A);
  • multi-step_metropolis.py, the multi-time-step Metropolis (Algorithm 1 (multi-step-metropolis) in the manuscript);
  • factorized_metropolis.py, the factorized Metropolis algorithm (Algorithm 2 (factorized-metropolis) in the manuscript);
  • MC_cell-veto.py, the reversible version of the cell-veto algorithm (Algorithm 4 (cell-veto(patch)) in the manuscript, with the set $\mathcal{S}_{\text{veto}}$ sampled using Algorithm 6 (poisson-veto(patch)));
  • EC_cell-veto.py, the non-reversible version of the cell-veto algorithm (Algorithm 4 (cell-veto(patch)) in the manuscript, with the set $\mathcal{S}_{\text{veto}}$ sampled using Walker's algorithm).

Moreover, the script posson_veto.py implements Algorithms 5 (poisson-veto) and 6 (poisson-veto(patch)) in a pedagogical way, and compares their outcomes.

All these algorithms rely on functions.py, which contains some basic functions and parameters. For given values of $N$ and $\rho$ (the system density), the final configuration is stored in InitialConf/, and then used as the starting configuration of the following run. In this way, it is sufficient to reach the equilibrium only once. The consistency of the implementations is checked by comparing the histograms for the pair-correlation function. The experimental data are stored in PairCorrelationData/ and the histograms are produced with the script pair_correlation.py. Some programs also contain internal sanity checks, based on the computation of energy variations or acceptance rates. As for the scaling, the data are stored in ScalingData/ and plotted with scalings.py. This program can be used to reproduce Figure 10 of the manuscript.

All programs can be executed with any Python3 implementation (e.g., standard CPython or PyPy3). The scripts pair_correlation.py and scalings.py rely both on NumPy and Matplotlib to produce the plots, while all other programs do not have any further requirements.

Authors

The authors of this project are:

For any question about the MCLongRange software package, or the related paper, please raise an issue here on GitHub or contact us via e-mail.

Additional contributors

The authors are grateful to Sora Shiratani (University of Tokyo) for his help in detecting and solving bugs and for suggesting several improvements to this software package.

The authors are also thankful to Kush Patel (University of Oxford) for detecting a missing factor in one method of functions.py.

License

This project is licensed under the GNU General Public License, version 3 (see the LICENSE file).

About

Repository accompanying the manuscript "Markov-chain sampling for long-range systems without evaluating the energy" by Gabriele Tartero & Werner Krauth

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages