File: bindingEnergy_BV.py

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 239,924 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; javascript: 164; makefile: 88
file content (67 lines) | stat: -rw-r--r-- 2,142 bytes parent folder | download | duplicates (8)
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
63
64
65
66
67
# -*- coding: utf-8 -*-
#
# Lara Schneider 2010-05-20
#
# description
#

import sys
from BALL import *

# for use in BALLView
system1 = getSystems()[0]
system2 = getSystems()[1]

# normalize the names and build all bonds
print "normalizing names and building all bonds..."
db = FragmentDB("")
system1.apply(db.normalize_names)
system1.apply(db.build_bonds)
system2.apply(db.normalize_names)
system2.apply(db.build_bonds)
 
# calculate the atomic contact energies of file1 and file2
  float ACE_system1 = calculateACE(system1)
  float ACE_system2 = calculateACE(system2)

# calculate the electrostatic energies of file1 and file2
amber = AmberFF()
amber.options[AmberFF.Option.ASSIGN_CHARGES] = "true"
amber.options[AmberFF.Option.OVERWRITE_CHARGES] = "true"
amber.setup(system1)
amber.updateEnergy()
float ES_system1 = amber.getESEnergy()
float C_system1 = calculateCoulomb(system1)
amber.setup(system2)
amber.updateEnergy()
float ES_system2 = amber.getESEnergy()
float C_system2 = calculateCoulomb(system2)

# finally, join the to systems into a single system
print "atoms in file1:  ", system1.countAtoms()
print "atoms in file2:  ", system2.countAtoms()
system1.splice(system2)
print "final atoms: ", system1.countAtoms()
float ACE_system1&system2 = calculateACE(system1)
amber.setup(system1)
amber.updateEnergy()
float ES_system1&system2 = amber.getESEnergy()
float C_system1&system2 = calculateCoulomb(system1)

# print the resulting energies
print "ES energy of system1: ", ES_system1
print "ES energy of system2: ", ES_system2
print "ES energy of system1&system2: ", ES_system1&system2
print "C energy of system1: ", C_system1
print "C energy of system2: ", C_system2
print "C energy of system1&system2: ", C_system1&system2
print "change in atomic contact energy on binding:   ", (ACE_system1&system2 - ACE_system1 - ACE_system2), " kJ/mol"
print "change in electrostatic energy on binding:    ", (ES_system1&system2 - ES_system1 - ES_system2), " kJ/mol"
print "total binding free energy:                    ", (ACE_system1&system2 - ACE_system1 - ACE_system2) + (ES_system1&system2 - ES_system1 - ES_system2), " kJ/mol"

# done