Written by Conrad Shyu
release 2, September 8, 2008
release 3, March 11, 2014
last updated on July 5, 2020
^ Synopsis This archive contains the implementation of cubic spline interpolating polynomial for estimates of free energy differences using thermodynamic integration. It also contains an example data file to jumpstart the use of software. The implementation makes heavy use of STL (standard template library) which requires a C++ compiler. This program is self-contained and should not require any additional libraries.
To compile the program, simply type:
make
The make program will invoke the Makefile and compiles the source code. Alternatively, to compile the files manually, issue the command:
g++ -I. driver.cpp spline.cpp -o spline -lm
The archive lists three implementation files and an example file.
Filename | Description |
---|---|
driver.cpp |
the user interface program |
spline.cpp |
main implementation of cubic spline interpolation polynomial |
spline.h |
the header file for cubic spline interpolation polynomial |
example.csv |
example file of simulations data from thermodynamic integration |
Makefile |
the makefile to compile the source code |
README.md |
this file |
The purpose of the program is to construct a series of third degree polynomials (cubic spline functions) that optimally fits the thermodynamic integration data. The implementation also contains an estimate function that allows the interpolating polynomial be used to extrapolate points. This feature may be useful to determine the accuracy of the interpolating polynomials.
The spline interpolation program takes three command-line parameters: input_file
, plot_file
(optional), and
data_points
(optional). The followings detail the format and meaning of each command-line parameter.
The input file must be saved in the plain text format. The first column contains the lambda values and second the ensemble averages from the simulations. Each column of data must be separated by either a comma or a white space. For example, followings list the contents of the example input file:
0.0, 51.49866347
0.1, 23.92508775
0.2, 10.35390700
0.3, 2.58426990
0.4, -2.18351656
0.5, -5.41745387
0.6, -7.62452181
0.7, -9.25455804
0.8, -10.45592989
0.9, -11.39244138
1.0, -12.12433704
To run the analysis program with only the required parameter, type:
spline example.csv
The program will output a series of third degree polynomials and the estimates of free energy using the spline and trapezoidal rule. For example, the example file should generate the following output:
Interval, Polynomial Degree and Coefficients
0.00 - 0.10, 51.49866347 -309.60058285 0.00000000 3386.48256486
0.10 - 0.20, 57.81516389 -499.09559542 1894.95012574 -2930.01785428
0.20 - 0.30, 33.31312080 -131.56494904 57.29689381 132.73753226
0.30 - 0.40, 47.71391686 -275.57290964 537.32342915 -400.62528478
0.40 - 0.50, 21.96112315 -82.42695686 54.45854721 1.76211684
0.50 - 0.60, 36.35675808 -168.80076643 227.20616634 -113.40296258
0.60 - 0.70, 11.42711029 -44.15252748 19.45910143 2.01207348
0.70 - 0.80, 26.87059434 -110.33888769 114.01104459 -43.01266135
0.80 - 0.90, 1.65602114 -15.78423817 -4.18226731 6.23455194
0.90 - 1.00, 36.94299518 -133.40748500 126.51022916 -42.17007639
Free energy difference
Cubic Spline: 0.76994786
Trapezoid: 1.02220063
The output lists piecewise polynomials for each interval. The second column lists the coefficients of the constant term (X0), third the first degree (X1), forth the second degree (X2), and finally fifth the third degree (X3).
This parameter specifies the name of the file that contains the estimates obtained from the piecewise polynomials. This parameter is optional. If this parameter is not given, no plot data will be generated by the program. For example, to generate a file of plot data with the default number of data points extrapolated from the piecewise polynomials, issue the command:
spline example.csv plot.csv
The file, example.csv, is the input file that contains the thermodynamic integration data. The file, plot.csv
,
is the output file that contains the estimates from the piecewise polynomials.
This parameter specifies the number of data points extrapolated from the piecewise polynomials. This parameter is optional. If this parameter is not given, the number of data points will be the same as the input file. For example, to generate a file of plot data with 100 data points extrapolated from the piecewise polynomials, issue the command:
spline example.csv plot.csv 100
Please report any problems or send comments to me.
C. Shyu and F.M. Ytreberg (2011). Accurate estimation of solvation free energy using polynomial fitting techniques. Journal of Computational Chemistry, 32(1): 134-141, doi: 10.1002/jcc.21609.
Copyright (C) 2014 Conrad Shyu
Department of Physics
University of Idaho
Moscow, ID 83844
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.