Back to Table of Contents

3. Generating potentials


Boltzmann inversion tool provides a simple and straightforward way to calculate effective potentials for coarse-grained simulations using the iterative Boltzmann inversion method. In short, this method allows to determine the effective interaction between coarse-grained particles by inverting the Boltzmann distribution iteratively using the differences of potentials of mean force.

User interface

The interface is divided into two main parts: two charts and controls below them. The chart on the left P(r) displays distributions of the target atomistic system and the obtained distributions from the coarse-grained simulations. The chart on the right U(r) displays the calculated potentials.

The charts are interactive and can be zoomed and panned using a mouse. To zoom, scrool the mouse wheel. To pan, click and drag. A vertical ruler follows your mouse and is synchronized between the two charts such that the x-position of the ruler is the same on both charts. This makes it easy to determine if a bump in the distribution is caused by a bump in the potential and vice-versa. Ranges of x- and y-axis may be set using the xr and yr input boxes on the corresponding chart.

Controls are comprised of three input select boxes displaying the uploaded or generated files, corresponding to target distribution files, obtained distribution files and potential files. Four buttons are below each input box: the plus button (+) adds a file from one's local machine, the minus button (-) removes a selected file, the Smoothen button smooths a selected file and the Download button which downloads the selected file. The gear button allows one to choose the format of potential files. On the right side are parameters for the potential generation (range, cutoff, grid density, the kBT constant and pressure correction parameters) and a Generate potential button.

Below the controls is a status window which displays the history of the user's or system's actions. The colors of the file names in the panels and in the status window also match the colors in the charts.

Usage overview

Generating potentials with the Boltzmann inversion tool involves 4 steps. These are:
1.) Upload target distribution file. Initial guess potential is generated.
2.) Download generated potential and run a simulation.
3.) Upload obtained distribution.
4.) Generate new potential.

Repeat steps 2, 3, and 4 until the obtained distribution matches the target distribution. A very good matching is usually obtained within 5 iteration, but further iterations are necessary for a pixel perfect match.

Target distribution

Usually these are distributions obtained with atomistic simulations. To upload a target distribution file, press the plus button (+) beneath the Target distribution select box. Once the file is uploaded, its data is displayed in the left chart. The file should be a plain text file with two columns separated by spaces or tabs. The first column is r (distance) and the second is P(r) (distribution). Sample files are provided in the examples page.

Obtained distribution

These distributions are obtained with coarse-grained simulations. Handling these files is the same as for the target distribution files. Their format is also the same: two columns with r and P(r). When the file is uploaded, its data is displayed in the left chart.


The potential select box shows generated potentials, but you may upload your existing potential file (and continue iterating it) by pressing the plus (+) button. There is also a gear button, which allows you to select the format of the potentials. In case your simulation package is not listed, you may use the general format, and convert it manually (using a script).

STOCK uses whatever units are provided, but must be consistent throughout the iteration process. Different simulation packages, use different units. Normally you will use a single simulation package while iterating. If you change the format of potential files in the iteration process, note that STOCK will not convert any of the already uploaded files.


The following parameters may be set and affect the generated potential files:

If one wishes to also match the pressures of the coarse-grained and atomistic systems, an additional correction can be applied to the effective potential. STOCK offers two methods to match pressures. If you enter the current (ie. coarse-grained) and target pressure of the systems, a simple linear function will be added to the potential. If you enter the current (ie. coarse-grained) particle density as well, advanced pressure correction will be used.

Generating potentials

To generate a potential file, you must either:

Smoothing files

All the files (target, obtained or potential) may be smoothed. Smoothing is necessary in case of poor data sampling. When you select a file and press Smoothen button, a window opens displaying the original and the smoothed curve. Smoothing is applied in real-time which allows you to visually inspect the outcome and tune the smoothing parameters until reaching the best results. If you press Accept, a new file is created, and "_smt" is appended to its name. If you press Cancel, no changes will occur.

Since smoothing may smear out steep peaks, it is possible to do smoothing in two separate ranges independently. This is useful to smooth the region before and after the first peak with different parameters, but ranges are allowed to overlap. Data points which are not covered by the smoothing range remain unchanged. If the ranges overlap, smoothing in first range is applied first and then smoothing from the second range is added.

The potential is automatically smoothed when creating the initial guess, and afterwards smoothing is only applied to the potential update (and not the total potential anymore) to avoid the above mentioned smearing out of peaks. However, you may apply additional smoothing if wanted or needed.

Smoothing is implemented with convolution of a Kaiser window over the data. It is also possible to do interpolation of data points with various splines in two ranges. You are of course able to smooth an already smoothed file, for even finer control.

Back to Table of Contents