calc_dg.py

This document describes calc_dg.py, which is a complete program to read output files from Amber, Gromos, or Q, and estimate free energy differences.

Currently, the program is able to read the following output files:

  1. Amber output files with only <DV/DL> records
  2. Amber output files with both <DV/DL> and BAR-energies (Amber11 and newer)
  3. Amber output files with <DV/DL> decomposition energies
  4. Gromos output files with <DV/DL> records
  5. Pure energy files with records of V0tot and V1tot energies. See below
  6. Q output files
The program can be used to estimate Bennet's acceptance ratio (BAR), free energy peturbation (FEP) for forward or reverse direction as well as their average, and thermodynamic integration (TI). The following estimators can be used with the different output files The recommended usage of the program is:

calc_dg.py calc.in

where calc.in is a textfile controlling the behaviour of calc_dg.py.

The code is written in Pyhton and located locally in /away/bio/Dg_tools/


Control file

The control file contains values of variables determining the execution of calc_dg.py. Each variable name starts with an ampersand (&) and the rows that follow the variable name sets the variable and associated variables.
Note that the file cannot contain any emptly lines - it will give an error.

Currently, the following variables can be set:


Example of basic control files:

Read 3 Amber11 output files and perform bootstrap and diagnostics:
&base_path
$FEP_PATH
&filenames
3
prot_l005_v0_sander.out4
prot_l050_v0_sander.out4
prot_l095_v0_sander.out4
&application
Amber11
&bootstrap
200
&diagnostics
1
prot_

Read 3 Q output files divided into two output files for each lambda, and calculate TI of intermolecular energies:
&base_path
$FEP_PATH
&filenames
3
prot_l005_q.out3
prot_l050_q.out3
prot_l095_q.out3
&expand_filenames
1
&application
Q
&estimates
TI
&qextract
Q-surr.
3 4

Similar to the one above, but here we have a simulated ligand in water with Amber
&base_path
$FEP_PATH
&filenames
3
prot_l005_q.out4
prot_l050_q.out4
prot_l095_q.out4
&application
Decomp
&estimates
TI
&dextract
TDC
3 4
2 :

We have run 5 independent simulations with Amber 11
&base_path
$FEP_PATH
&filenames
3
prot_r*_l005_v0_sander.out4
prot_r*_l050_v0_sander.out4
prot_r*_l095_v0_sander.out4
&nsim
5
&application
Amber11


Pure energy file format

The pure-energy files should have the following format

Note! The mixing of of V0 and V1, is as follow: V = l V0 + (1 - l) V1, i.e., the opposite of what is done in for instance Amber, where V = (1 - l) V0 + l V1 is used. If you want the Amber-type of mixing, just specify 1 - l on the first row.

Example:
20 0.99
-765.1850 -733.4273
-790.8062 -752.5439
-717.3305 -680.7185
-679.1150 -653.5069
-699.8720 -669.2577
-671.9884 -637.7892
-760.1654 -718.7986
-771.3860 -726.2168
-757.0964 -721.2894
-796.7219 -765.2958
-693.3311 -665.8190
-745.6914 -728.7871
-696.9361 -673.9320
-684.1877 -666.7317
-710.9796 -681.1000
-724.3771 -686.8643
-718.2849 -700.4401
-773.8563 -732.4859
-741.6559 -711.3101
-744.6763 -708.1315

This is an energy file for 20 snapshots sampled with Amber at l = 0.01.


Paulius' result.bash script
#!/bin/bash
# 2013-05-31
# PM

cat << EOF > prot.in
&base_path
/platon/nobackup/users/ulf/Sampl4/Oa/Fep/1-4/
&filenames
11
prot_l005_v0_sander.out4
prot_l010_v0_sander.out4
prot_l020_v0_sander.out4
prot_l030_v0_sander.out4
prot_l040_v0_sander.out4
prot_l050_v0_sander.out4
prot_l060_v0_sander.out4
prot_l070_v0_sander.out4
prot_l080_v0_sander.out4
prot_l090_v0_sander.out4
prot_l095_v0_sander.out4
&application
Amber11
&estimates
TI BAR
&nsim
1
&select_frames
0 -1 10
&verbosity
3
&diagnostics
0
&bootstrap
100
EOF
cat << EOF > wat.in
&base_path
/platon/nobackup/users/ulf/Sampl4/Oa/Fep/1-4/
&filenames
11
wat_l005_v0_sander.out4
wat_l010_v0_sander.out4
wat_l020_v0_sander.out4
wat_l030_v0_sander.out4
wat_l040_v0_sander.out4
wat_l050_v0_sander.out4
wat_l060_v0_sander.out4
wat_l070_v0_sander.out4
wat_l080_v0_sander.out4
wat_l090_v0_sander.out4
wat_l095_v0_sander.out4
&application
Amber11
&estimates
TI BAR
&nsim
1
&select_frames
0 -1 10
&verbosity
3
&diagnostics
0
&bootstrap
100
EOF
calc_dg.py prot.in #> prot-tibar.txt
calc_dg.py  wat.in #>  wat-tibar.txt