File: makeAmberGB.py

package info (click to toggle)
openmm 7.7.0%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 114,116 kB
  • sloc: xml: 376,993; cpp: 198,330; python: 31,278; ansic: 5,610; lisp: 2,294; sh: 415; f90: 233; makefile: 223; csh: 19
file content (66 lines) | stat: -rw-r--r-- 2,123 bytes parent folder | download | duplicates (4)
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
import sys
import xml.etree.ElementTree as etree

gbvalues = {'CT':(0.19,0.72),
            'CX':(0.19,0.72),
            'CI':(0.19,0.72),
            'C':(0.1875,0.72),
            'CA':(0.1875,0.72),
            'CM':(0.1875,0.72),
            'CS':(0.1875,0.72),
            'C4':(0.1875,0.72),
            'CC':(0.1875,0.72),
            'CV':(0.1875,0.72),
            'CW':(0.1875,0.72),
            'CR':(0.1875,0.72),
            'CB':(0.1875,0.72),
            'C*':(0.1875,0.72),
            'CN':(0.1875,0.72),
            'CK':(0.1875,0.72),
            'CP':(0.1875,0.72),
            'C5':(0.1875,0.72),
            'CQ':(0.1875,0.72),
            'N':(0.1706,0.79),
            'NA':(0.1706,0.79),
            'NB':(0.1706,0.79),
            'NC':(0.1706,0.79),
            'N*':(0.1706,0.79),
            'N2':(0.1706,0.79),
            'N3':(0.1625,0.79),
            'OW':(0.1535,0.85),
            'OH':(0.1535,0.85),
            'OS':(0.1535,0.85),
            'O':(0.148,0.85),
            'O2':(0.148,0.85),
            'S':(0.1775,0.96),
            'SH':(0.1775,0.96),
            'H':(0.115,0.85),
            'HW':(0.105,0.85),
            'HO':(0.105,0.85),
            'HS':(0.125,0.85),
            'HA':(0.125,0.85),
            'HC':(0.125,0.85),
            'H0':(0.125,0.85),
            'H1':(0.125,0.85),
            'H2':(0.125,0.85),
            'H3':(0.125,0.85),
            'HP':(0.125,0.85),
            'H4':(0.125,0.85),
            'H5':(0.125,0.85)}

tree = etree.parse(sys.argv[1])
typeMap = {}
for type in tree.getroot().find('AtomTypes').findall('Type'):
    typeMap[type.attrib['name']] = type.attrib['class']
print("<ForceField>")
print(" <GBSAOBCForce>")
for atom in tree.getroot().find('NonbondedForce').findall('Atom'):
    type = atom.attrib['type']
    if type in typeMap:
        atomClass = typeMap[type]
        if atomClass in gbvalues:
            values = gbvalues[atomClass]
            print("""   <Atom type="%s" charge="%s" radius="%g" scale="%g"/>""" % (type, atom.attrib['charge'], values[0], values[1]))
print(" </GBSAOBCForce>")
print("</ForceField>")