-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbedam_analyze.py
62 lines (50 loc) · 1.75 KB
/
bedam_analyze.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# python script
__doc__="""
$Revision: 0.1 $
BEDAM analysis script
"""
# Contributors: Emilio Gallicchio, Junchao Xia
import os, sys, time
from operator import itemgetter, attrgetter
from schrodinger import structure, structureutil
from schrodinger.application import inputconfig
from schrodinger.utils import cmdline
import schrodinger.utils.log
from bedam import bedam_job
##################### MAIN CODE ##########################
if __name__ == '__main__':
# Setup the logger
logger = schrodinger.utils.log.get_output_logger("bedam_analyze")
# Parse arguments:
usage = "%prog [options] <inputfile>"
parser = cmdline.SingleDashOptionParser(usage)
(options, args) = parser.parse_args(sys.argv[1:])
if len(args) != 1:
parser.error("Please specify ONE input file")
commandFile = args[0]
print ""
print "===================================="
print " BEDAM Job Analysis "
print "===================================="
print ""
print "SCHRODINGER: " + os.environ['SCHRODINGER']
print "Started at: " + str(time.asctime())
print "Input file:", commandFile
print ""
sys.stdout.flush()
print "Reading options"
bedam = bedam_job(commandFile, options)
print "Collecting binding energies ..."
bedam.getBindingEnergies()
print "Writing binding energy histograms/trajectories ..."
bedam.be_histograms()
bedam.lbe_trj()
bedam.lbe_lmb()
print "Running MBAR:"
(Deltaf_ij, dDeltaf_ij) = bedam.runMBAR()
#Assume binding free energy is G(maxlambda)-G(minlambda)
#typically maxlambda=1 and minlambda=0
nf = len(Deltaf_ij[0])-1
print "DG(binding) = %f +- %f kcal/mol" % (Deltaf_ij[0][nf], dDeltaf_ij[0][nf])
print Deltaf_ij
#EOF