-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmartini22_ff.py
258 lines (226 loc) · 15.9 KB
/
martini22_ff.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
################################
## 6 # FORCE FIELD PARAMETERS ## -> @FF <-
################################
# New martini 2.2 parameters.
# Changed:
# Unstructured Pro backbone bead
# Proline side chains
# Phe sidechain
# Trp sidechain
# Helix BB-bonds to constraint
class martini22:
ff = True
def __init__(self):
import SS,FUNC,IO
# parameters are defined here for the following (protein) forcefields:
self.name = 'martini22'
# Charged types:
self.charges = {"Qd":1, "Qa":-1, "SQd":1, "SQa":-1, "RQd":1, "AQa":-1} #@#
#----+---------------------+
## A | BACKBONE PARAMETERS |
#----+---------------------+
#
# bbss lists the one letter secondary structure code
# bbdef lists the corresponding default backbone beads
# bbtyp lists the corresponding residue specific backbone beads
#
# bbd lists the structure specific backbone bond lengths
# bbkb lists the corresponding bond force constants
#
# bba lists the structure specific angles
# bbka lists the corresponding angle force constants
#
# bbd lists the structure specific dihedral angles
# bbkd lists the corresponding force constants
#
# -=NOTE=-
# if the secondary structure types differ between bonded atoms
# the bond is assigned the lowest corresponding force constant
#
# -=NOTE=-
# if proline is anywhere in the helix, the BBB angle changes for
# all residues
#
###############################################################################################
## BEADS ## #
# F E H 1 2 3 T S C # SS one letter
self.bbdef = FUNC.spl(" N0 Nda N0 Nd Na Nda Nda P5 P5") # Default beads #@#
self.bbtyp = { # #@#
"ALA": FUNC.spl(" C5 N0 C5 N0 N0 N0 N0 P4 P4"), # ALA specific #@#
"PRO": FUNC.spl(" C5 N0 C5 N0 Na N0 N0 P4 P4"), # PRO specific #@#
"HYP": FUNC.spl(" C5 N0 C5 N0 N0 N0 N0 P4 P4") # HYP specific #@#
} # #@#
## BONDS ## #
self.bbldef = (.365, .350, .310, .310, .310, .310, .350, .350, .350) # BB bond lengths #@#
self.bbkb = (1250, 1250, None, None, None, None, 1250, 1250, 1250) # BB bond kB #@#
self.bbltyp = {} # #@#
self.bbkbtyp = {} # #@#
## ANGLES ## #
self.bbadef = ( 119.2,134, 96, 96, 96, 96, 100, 130, 127) # BBB angles #@#
self.bbka = ( 150, 25, 700, 700, 700, 700, 20, 20, 20) # BBB angle kB #@#
self.bbatyp = { # #@#
"PRO": ( 119.2,134, 98, 98, 98, 98, 100, 130, 127), # PRO specific #@#
"HYP": ( 119.2,134, 98, 98, 98, 98, 100, 130, 127) # PRO specific #@#
} # #@#
self.bbkatyp = { # #@#
"PRO": ( 150, 25, 100, 100, 100, 100, 25, 25, 25), # PRO specific #@#
"HYP": ( 150, 25, 100, 100, 100, 100, 25, 25, 25) # PRO specific #@#
} # #@#
## DIHEDRALS ## #
self.bbddef = ( 90.7, 0, -120, -120, -120, -120) # BBBB dihedrals #@#
self.bbkd = ( 100, 10, 400, 400, 400, 400) # BBBB kB #@#
self.bbdmul = ( 1, 1, 1, 1, 1, 1) # BBBB mltplcty #@#
self.bbdtyp = {} # #@#
self.bbkdtyp = {} # #@#
#
###############################################################################################
# Some Forcefields use the Ca position to position the BB-bead (me like!)
# martini 2.1 doesn't
self.ca2bb = False
# BBS angle, equal for all ss types
# Connects BB(i-1),BB(i),SC(i), except for first residue: BB(i+1),BB(i),SC(i)
# ANGLE Ka
self.bbsangle = [ 100, 25] #@#
# Bonds for extended structures (more stable than using dihedrals)
# LENGTH FORCE
self.ebonds = { #@#
'short': [ .640, 2500], #@#
'long' : [ .970, 2500] #@#
} #@#
#----+-----------------------+
## B | SIDE CHAIN PARAMETERS |
#----+-----------------------+
# To be compatible with Elnedyn, all parameters are explicitly defined, even if they are double.
self.sidechains = {
#RES# BEADS BONDS ANGLES DIHEDRALS
# BB-SC SC-SC BB-SC-SC SC-SC-SC
"TRP": [FUNC.spl("SC4 SNd SC5 SC5"),[(0.300,5000)]+[(0.270,None) for i in range(5)], [(210,50),(90,50),(90,50)], [(0,50),(0,200)]],
"TYR": [FUNC.spl("SC4 SC4 SP1"), [(0.320,5000), (0.270,None), (0.270,None),(0.270,None)],[(150,50),(150,50)], [(0,50)]],
"PHE": [FUNC.spl("SC5 SC5 SC5"), [(0.310,7500), (0.270,None), (0.270,None),(0.270,None)],[(150,50),(150,50)], [(0,50)]],
"HIS": [FUNC.spl("SC4 SP1 SP1"), [(0.320,7500), (0.270,None), (0.270,None),(0.270,None)],[(150,50),(150,50)], [(0,50)]],
"HIH": [FUNC.spl("SC4 SP1 SQd"), [(0.320,7500), (0.270,None), (0.270,None),(0.270,None)],[(150,50),(150,50)], [(0,50)]],
"ARG": [FUNC.spl("N0 Qd"), [(0.330,5000), (0.340,5000)], [(180,25)]],
"LYS": [FUNC.spl("C3 Qd"), [(0.330,5000), (0.280,5000)], [(180,25)]],
"CYS": [FUNC.spl("C5"), [(0.310,7500)]],
"ASP": [FUNC.spl("Qa"), [(0.320,7500)]],
"PAS": [FUNC.spl("P3"), [(0.320,7500)]],
"GLU": [FUNC.spl("Qa"), [(0.400,5000)]],
"ILE": [FUNC.spl("AC1"), [(0.310,None)]],
"LEU": [FUNC.spl("AC1"), [(0.330,7500)]],
"MET": [FUNC.spl("C5"), [(0.400,2500)]],
"ASN": [FUNC.spl("P5"), [(0.320,5000)]],
"PRO": [FUNC.spl("C3"), [(0.300,7500)]],
"HYP": [FUNC.spl("P1"), [(0.300,7500)]],
"GLN": [FUNC.spl("P4"), [(0.400,5000)]],
"SER": [FUNC.spl("P1"), [(0.250,7500)]],
"THR": [FUNC.spl("P1"), [(0.260,None)]],
"VAL": [FUNC.spl("AC2"), [(0.265,None)]],
"ALA": [],
"GLY": [],
}
# Not all (eg Elnedyn) forcefields use backbone-backbone-sidechain angles and BBBB-dihedrals.
self.UseBBSAngles = True
self.UseBBBBDihedrals = True
# Martini 2.2p has polar and charged residues with seperate charges.
self.polar = []
self.charged = []
# If masses or charged diverge from standard (45/72 and -/+1) they are defined here.
self.mass_charge = {
#RES MASS CHARGE
}
# Defines the connectivity between between beads
self.connectivity = {
#RES BONDS ANGLES DIHEDRALS V-SITE
"TRP": [[(0,1),(1,2),(1,3),(2,3),(2,4),(3,4)], [(0,1,2),(0,1,3)], [(0,2,3,1),(1,2,4,3)]],
"TYR": [[(0,1),(1,2),(1,3),(2,3)], [(0,1,2),(0,1,3)], [(0,2,3,1)]],
"PHE": [[(0,1),(1,2),(1,3),(2,3)], [(0,1,2),(0,1,3)], [(0,2,3,1)]],
"HIS": [[(0,1),(1,2),(1,3),(2,3)], [(0,1,2),(0,1,3)], [(0,2,3,1)]],
"HIH": [[(0,1),(1,2),(1,3),(2,3)], [(0,1,2),(0,1,3)], [(0,2,3,1)]],
"GLN": [[(0,1)]],
"ASN": [[(0,1)]],
"SER": [[(0,1)]],
"THR": [[(0,1)]],
"ARG": [[(0,1),(1,2)], [(0,1,2)]],
"LYS": [[(0,1),(1,2)], [(0,1,2)]],
"ASP": [[(0,1)]],
"PAS": [[(0,1)]],
"GLU": [[(0,1)]],
"CYS": [[(0,1)]],
"ILE": [[(0,1)]],
"LEU": [[(0,1)]],
"MET": [[(0,1)]],
"PRO": [[(0,1)]],
"HYP": [[(0,1)]],
"VAL": [[(0,1)]],
"ALA": [],
"GLY": [],
}
#----+----------------+
## C | SPECIAL BONDS |
#----+----------------+
self.special = {
# Used for sulfur bridges
# ATOM 1 ATOM 2 BOND LENGTH FORCE CONSTANT
(("SC1","CYS"), ("SC1","CYS")): (0.24, None),
}
# By default use an elastic network
self.ElasticNetwork = False
# Elastic networks bond shouldn't lead to exclusions (type 6)
# But Elnedyn has been parametrized with type 1.
self.EBondType = 6
#----+----------------+
## D | INTERNAL STUFF |
#----+----------------+
## BACKBONE BEAD TYPE ##
# Dictionary of default bead types (*D)
self.bbBeadDictD = FUNC.hash(SS.bbss,self.bbdef)
# Dictionary of dictionaries of types for specific residues (*S)
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in self.bbtyp.keys()])
## BB BOND TYPE ##
# Dictionary of default abond types (*D)
self.bbBondDictD = FUNC.hash(SS.bbss,zip(self.bbldef,self.bbkb))
# Dictionary of dictionaries for specific types (*S)
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbltyp[i],self.bbkbtyp[i]))) for i in self.bbltyp.keys()])
# This is tricky to read, but it gives the right bondlength/force constant
## BBB ANGLE TYPE ##
# Dictionary of default angle types (*D)
self.bbAngleDictD = FUNC.hash(SS.bbss,zip(self.bbadef,self.bbka))
# Dictionary of dictionaries for specific types (*S)
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbatyp[i],self.bbkatyp[i]))) for i in self.bbatyp.keys()])
## BBBB DIHEDRAL TYPE ##
# Dictionary of default dihedral types (*D)
self.bbDihedDictD = FUNC.hash(SS.bbss,zip(self.bbddef,self.bbkd,self.bbdmul))
# Dictionary of dictionaries for specific types (*S)
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbdtyp[i],self.bbkdtyp[i]))) for i in self.bbdtyp.keys()])
# The following function returns the backbone bead for a given residue and
# secondary structure type.
# 1. Look up the proper dictionary for the residue
# 2. Get the proper type from it for the secondary structure
# If the residue is not in the dictionary of specials, use the default
# If the secondary structure is not listed (in the residue specific
# dictionary) revert to the default.
def bbGetBead(self,r1,ss="C"):
return self.bbBeadDictS.get(r1,self.bbBeadDictD).get(ss,self.bbBeadDictD.get(ss))
def bbGetBond(self,r,a,ss):
# Retrieve parameters for each residue from table defined above
b1 = self.bbBondDictS.get(r[0],self.bbBondDictD).get(ss[0],self.bbBondDictD.get(ss[0]))
b2 = self.bbBondDictS.get(r[1],self.bbBondDictD).get(ss[1],self.bbBondDictD.get(ss[1]))
# Determine which parameters to use for the bond
return ( (b1[0]+b2[0])/2, min(b1[1],b2[1]) )
def bbGetAngle(self,r,ca,ss):
# PRO in helices is dominant
if r[1] == "PRO" and ss[1] in "H123":
return self.bbAngleDictS["PRO"].get(ss[1])
else:
# Retrieve parameters for each residue from table defined above
a = [ self.bbAngleDictS.get(r[0],self.bbAngleDictD).get(ss[0],self.bbAngleDictD.get(ss[0])),
self.bbAngleDictS.get(r[1],self.bbAngleDictD).get(ss[1],self.bbAngleDictD.get(ss[1])),
self.bbAngleDictS.get(r[2],self.bbAngleDictD).get(ss[2],self.bbAngleDictD.get(ss[2])) ]
# Sort according to force constant
a.sort(key=lambda i: (i[1],i[0]))
# This selects the set with the smallest force constant and the smallest angle
return a[0]
def messages(self):
'''Prints any force-field specific logging messages.'''
import logging
logging.info('Note: Cysteine bonds are 0.24 nm constraints, instead of the published 0.39nm/5000kJ/mol.')