Python implementation of the Free energy extrapolation method (FENEX) for estimating free energies at phase coexistence from polynomial models
The development version can be installed from this repository:
git clone https://github.com/iquintelam/FENEX
cd FENEX
pip install
Import "FENEX" and use simulation or experimental data to estimate the next coexistence point in the thermodynamic integration and calculate free energies. Coexistence properties can also be refined from the “near coexistence” simulated data. According to the reference paper, one can choose one of two types of integration.
Suppose we want to integrate on a property that can be linearly decoupled from the Halmitonion (type 2).
Read data from the test system, which corresponds to an integration on the pair potential energy parameter(
>>> from FENEX import read_test_system
>>> Npoints,f1new,f,free_energy,z,cov,stats = read_test_system()
We have the number of integration points, the next f1new
, the previous integration points (free_energy[:,0]
, the ensemble average of conjugate variables z
(u,v) concatenated in an array of shape (2,Npoints,iphase), covariances (cov(u,U),cov(v,V),cov(u,V)] cov
of previous points for both phases concatenated in an array of shape (3,npoints,iphase). Simulation statistics (acceptance probability of perturbation, potential energy) stats
for both phases concatenated in an array of shape (2,npoints,iphase). This array is a non-default argument that can be passed to refine the coexistence values.
We also need to define the integration type that can be 'coupled' or 'decoupled'.
To calculate the next point in the integration and the free energies of the previous point, we call estimate_coexistence
from the class Integration. For that, we need to initialize the class Integration with all the data from the simulation as attributes:
>>> int_1 = FENEX.Integrate(f1new,f,free_energy,z,cov,'coupled',stats)
>>> FENEX.Integrate.estimate_coexistence(int_1)
>>> print(int_1.free_energy,int_1.f2new)
The coexistence pressure correspondent to the next f2new
can be used as an input in a new simulation to continue the integration. The free energy of both phases from the previous coexistence points free_energy
are also calculated.
To refine the coexistence properties, we call refine_coex
. This function calculates the refined properties: zsat
,free_energy_sat
,enesat
,f2sat
).
>>> results_sat = FENEX.Integrate.refine_coexistence(int_1)
>>> print(int_1.free_energy_sat)
Please cite the original FENEX papers:
- Escobedo, F. A. J. Chem. Phys. 140, 094102 (2014). DOI
- Escobedo, F. A. J. Chem. Phys. 147, 214501 (2017). DOI
Copyright (c) 2022, Isabela Quintela Matos
Project based on the Computational Molecular Science Python Cookiecutter version 1.6.