pyMSER - An open-source library for automatic equilibration detection in Monte Carlo simulations
Grand Canonical Monte Carlo (GCMC) is the de facto standard method to simulate gas adsorption into nanoporous solid materials at the molecular level. In these simulations, the system starts in a transient out-of-equilibrium condition, often called “initialization” stage, and a set of random moves are applied to the adsorbate molecules driving the system towards the “production” stage in which the properties of interest fluctuate around some equilibrium value. The information contained in this initial transient stage must be discarded and only the information accumulated after this point should be used to calculate the ensemble average of the properties of interest. Most GCMC simulation software allow the user to split these two stages by defining a fixed number of steps for each one and calculating the average only over the production stage. However, the number of necessary initialization steps is highly sensitive to simulation conditions, such as the adsorbed phase composition, temperature, pressure, among others. This makes the optimal number of MC steps for each stage impossible to anticipate and demands a case-by-case analysis, which is detrimental to high-throughput automated screening workflows. Here, we propose the use of the Marginal Standard Error Rule (MSER) to automatically detect the initial transient regime and determine the optimal truncation point for the production stage. This approach allows a simple, fast, robust, and reproducible calculation of the equilibration point, allowing for the minimization of the excluded initialization data and, thus, the maximization of the production stage given a fixed total number of simulation steps. We also present an open-source Python implementation of this method (https://github.com/IBM/pymser) and demonstrate its use on several examples of typical GCMC simulation data.