packmol-memgen-minimal 1.1.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. packmol_memgen/__init__.py +2 -0
  2. packmol_memgen/__version__.py +34 -0
  3. packmol_memgen/data/LICENSE.Apache-2.0 +201 -0
  4. packmol_memgen/data/extra_solvents.lib +789 -0
  5. packmol_memgen/data/frcmod.lipid_ext +97 -0
  6. packmol_memgen/data/frcmod.solvents +129 -0
  7. packmol_memgen/data/insane_lipids.txt +138 -0
  8. packmol_memgen/data/insane_solvents.txt +45 -0
  9. packmol_memgen/data/leaprc.extra_solvents +42 -0
  10. packmol_memgen/data/leaprc.lipid_ext +48 -0
  11. packmol_memgen/data/lipid_ext.lib +12312 -0
  12. packmol_memgen/data/martini_v3.0.0.itp +356605 -0
  13. packmol_memgen/data/memgen.parm +4082 -0
  14. packmol_memgen/data/pdbs.tar.gz +0 -0
  15. packmol_memgen/data/solvent.parm +14 -0
  16. packmol_memgen/example/example.sh +31 -0
  17. packmol_memgen/lib/__init__.py +0 -0
  18. packmol_memgen/lib/amber.py +77 -0
  19. packmol_memgen/lib/charmmlipid2amber/__init__.py +0 -0
  20. packmol_memgen/lib/charmmlipid2amber/charmmlipid2amber.csv +7164 -0
  21. packmol_memgen/lib/charmmlipid2amber/charmmlipid2amber.py +225 -0
  22. packmol_memgen/lib/pdbremix/LICENSE +21 -0
  23. packmol_memgen/lib/pdbremix/__init__.py +0 -0
  24. packmol_memgen/lib/pdbremix/_version.py +1 -0
  25. packmol_memgen/lib/pdbremix/amber.py +1103 -0
  26. packmol_memgen/lib/pdbremix/asa.py +227 -0
  27. packmol_memgen/lib/pdbremix/data/aminoacid.pdb +334 -0
  28. packmol_memgen/lib/pdbremix/data/binaries.json +26 -0
  29. packmol_memgen/lib/pdbremix/data/charmm22.parameter +2250 -0
  30. packmol_memgen/lib/pdbremix/data/charmm22.topology +1635 -0
  31. packmol_memgen/lib/pdbremix/data/color_b.py +682 -0
  32. packmol_memgen/lib/pdbremix/data/hin.lib +130 -0
  33. packmol_memgen/lib/pdbremix/data/hydroxide.lib +88 -0
  34. packmol_memgen/lib/pdbremix/data/make_chi.py +92 -0
  35. packmol_memgen/lib/pdbremix/data/opls.parameter +1108 -0
  36. packmol_memgen/lib/pdbremix/data/opls.topology +1869 -0
  37. packmol_memgen/lib/pdbremix/data/phd.frcmod +82 -0
  38. packmol_memgen/lib/pdbremix/data/phd.leaprc +4 -0
  39. packmol_memgen/lib/pdbremix/data/phd.prepin +35 -0
  40. packmol_memgen/lib/pdbremix/data/template.pdb +334 -0
  41. packmol_memgen/lib/pdbremix/data/znb.frcmod +24 -0
  42. packmol_memgen/lib/pdbremix/data/znb.leaprc +7 -0
  43. packmol_memgen/lib/pdbremix/data/znb.lib +69 -0
  44. packmol_memgen/lib/pdbremix/data.py +264 -0
  45. packmol_memgen/lib/pdbremix/fetch.py +102 -0
  46. packmol_memgen/lib/pdbremix/force.py +627 -0
  47. packmol_memgen/lib/pdbremix/gromacs.py +978 -0
  48. packmol_memgen/lib/pdbremix/lib/__init__.py +0 -0
  49. packmol_memgen/lib/pdbremix/lib/docopt.py +579 -0
  50. packmol_memgen/lib/pdbremix/lib/pyqcprot.py +305 -0
  51. packmol_memgen/lib/pdbremix/namd.py +1078 -0
  52. packmol_memgen/lib/pdbremix/pdbatoms.py +543 -0
  53. packmol_memgen/lib/pdbremix/pdbtext.py +120 -0
  54. packmol_memgen/lib/pdbremix/protein.py +311 -0
  55. packmol_memgen/lib/pdbremix/pymol.py +480 -0
  56. packmol_memgen/lib/pdbremix/rmsd.py +203 -0
  57. packmol_memgen/lib/pdbremix/simulate.py +420 -0
  58. packmol_memgen/lib/pdbremix/spacehash.py +73 -0
  59. packmol_memgen/lib/pdbremix/trajectory.py +286 -0
  60. packmol_memgen/lib/pdbremix/util.py +273 -0
  61. packmol_memgen/lib/pdbremix/v3.py +16 -0
  62. packmol_memgen/lib/pdbremix/v3array.py +482 -0
  63. packmol_memgen/lib/pdbremix/v3numpy.py +350 -0
  64. packmol_memgen/lib/pdbremix/volume.py +155 -0
  65. packmol_memgen/lib/utils.py +1017 -0
  66. packmol_memgen/main.py +2827 -0
  67. packmol_memgen_minimal-1.1.16.dist-info/METADATA +664 -0
  68. packmol_memgen_minimal-1.1.16.dist-info/RECORD +71 -0
  69. packmol_memgen_minimal-1.1.16.dist-info/WHEEL +4 -0
  70. packmol_memgen_minimal-1.1.16.dist-info/entry_points.txt +2 -0
  71. packmol_memgen_minimal-1.1.16.dist-info/licenses/LICENSE +338 -0
@@ -0,0 +1,305 @@
1
+
2
+
3
+ __doc__ = """
4
+ QCP rotation calculation
5
+
6
+ This is an RMSD and optimal rotation calculator, written in pure Python. The
7
+ goal of this is to allow the code to be run in a JIT compiler such as PyPy,
8
+ Jython that cannot interface with extern C modules, such as numpy.
9
+
10
+ The algorithm was originally developed by Douglas Theobald as a C module,
11
+ [qcp][qcp], which solves the eigenvalue decomposition in quaternion space, and
12
+ thus avoids the expensive SVD decomposition of 3D rotational matrices. The
13
+ current code is based on a Cython adaption of qcp, [pyqcprot][pyqcprot],
14
+ written by Joshua Adelman.
15
+
16
+ [pyqcprot]: https://github.com/synapticarbors/pyqcprot
17
+ [qcp]: http://theobald.brandeis.edu/qcp/
18
+
19
+ References:
20
+
21
+ Douglas L. Theobald. (2005) "Rapid calculation of RMSD using a quaternion-
22
+ based characteristic polynomial." Acta Crystallographica A. 61(4):478-480
23
+
24
+ Pu Liu, Dmitris K. Agrafiotis and Douglas L. Theobald. (2010) "Fast
25
+ determination of the optimal rotational matrix for macromolecular
26
+ superpositions."J. Comput. Chem. 31, 1561-1563
27
+
28
+ Joshua L. Adelman (2011) "Pyqcprot"
29
+ https://github.com/synapticarbors/pyqcprot
30
+
31
+
32
+ # BSD License
33
+ -----------------------------------------------------------------------------
34
+ Redistribution and use in source and binary forms, with or without
35
+ modification, are permitted provided that the following conditions are met:
36
+
37
+ * Redistributions of source code must retain the above copyright notice, this
38
+ list of conditions and the following disclaimer.
39
+
40
+ * Redistributions in binary form must reproduce the above copyright notice,
41
+ this list of conditions and the following disclaimer in the documentation
42
+ and/or other materials provided with the distribution.
43
+
44
+ * Neither the name of the <ORGANIZATION> nor the names of its contributors may
45
+ be used to endorse or promote products derived from this software without
46
+ specific prior written permission.
47
+
48
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
52
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58
+ -----------------------------------------------------------------------------
59
+ """
60
+
61
+
62
+ import math
63
+
64
+
65
+ def make_correlation_matrix(coords1, coords2):
66
+ """
67
+ Returns E0, and A, a 3x3 matrix reprsented as a list of 9 values, which
68
+ represents the correlation matrix between the coords. E0 is the static
69
+ component of the RMSD, which is half the sum of the squared lengths of the
70
+ coordinate vectors.
71
+
72
+ Parameters:
73
+ - coords1, coords2: a list of 3 floats, a list of N coordinates
74
+ """
75
+
76
+ N = len(coords1)
77
+ assert N == len(coords2)
78
+
79
+ G1 = 0.0
80
+ G2 = 0.0
81
+
82
+ A = [0.0 for i in range(9)]
83
+
84
+ for i in range(N):
85
+ x1 = coords1[i][0]
86
+ y1 = coords1[i][1]
87
+ z1 = coords1[i][2]
88
+
89
+ G1 += (x1*x1 + y1*y1 + z1*z1)
90
+
91
+ x2 = coords2[i][0]
92
+ y2 = coords2[i][1]
93
+ z2 = coords2[i][2]
94
+
95
+ G2 += (x2*x2 + y2*y2 + z2*z2)
96
+
97
+ A[0] += (x1 * x2)
98
+ A[1] += (x1 * y2)
99
+ A[2] += (x1 * z2)
100
+
101
+ A[3] += (y1 * x2)
102
+ A[4] += (y1 * y2)
103
+ A[5] += (y1 * z2)
104
+
105
+ A[6] += (z1 * x2)
106
+ A[7] += (z1 * y2)
107
+ A[8] += (z1 * z2)
108
+
109
+ E0 = (G1 + G2) * 0.5
110
+
111
+ return E0, A
112
+
113
+
114
+ def calc_rms_rot(coords1, coords2):
115
+ """
116
+ Returns rms and a list of 9 values that represents a rotation
117
+ matrix.
118
+
119
+ Args:
120
+ coords1, coords2: a list of 3 floats, representing an Nx3 matrix,
121
+ or a list of N set of coordinate vectors.
122
+ """
123
+ E0, A = make_correlation_matrix(coords1, coords2)
124
+ N = len(coords1)
125
+
126
+ oldg = 0.0
127
+ evecprec = 1e-6
128
+ evalprec = 1e-14
129
+
130
+ Sxx = A[0]
131
+ Sxy = A[1]
132
+ Sxz = A[2]
133
+ Syx = A[3]
134
+ Syy = A[4]
135
+ Syz = A[5]
136
+ Szx = A[6]
137
+ Szy = A[7]
138
+ Szz = A[8]
139
+
140
+ Sxx2 = Sxx * Sxx
141
+ Syy2 = Syy * Syy
142
+ Szz2 = Szz * Szz
143
+
144
+ Sxy2 = Sxy * Sxy
145
+ Syz2 = Syz * Syz
146
+ Sxz2 = Sxz * Sxz
147
+
148
+ Syx2 = Syx * Syx
149
+ Szy2 = Szy * Szy
150
+ Szx2 = Szx * Szx
151
+
152
+ SyzSzymSyySzz2 = 2.0*(Syz*Szy - Syy*Szz)
153
+ Sxx2Syy2Szz2Syz2Szy2 = Syy2 + Szz2 - Sxx2 + Syz2 + Szy2
154
+
155
+ C = [0.0 for i in range(3)]
156
+
157
+ C[2] = -2.0 * (Sxx2 + Syy2 + Szz2 + Sxy2 + Syx2 + Sxz2 + Szx2 + Syz2 + Szy2)
158
+ C[1] = 8.0 * (Sxx*Syz*Szy + Syy*Szx*Sxz + Szz*Sxy*Syx - Sxx*Syy*Szz - Syz*Szx*Sxy - Szy*Syx*Sxz)
159
+
160
+ SxzpSzx = Sxz + Szx
161
+ SyzpSzy = Syz + Szy
162
+ SxypSyx = Sxy + Syx
163
+ SyzmSzy = Syz - Szy
164
+ SxzmSzx = Sxz - Szx
165
+ SxymSyx = Sxy - Syx
166
+ SxxpSyy = Sxx + Syy
167
+ SxxmSyy = Sxx - Syy
168
+ Sxy2Sxz2Syx2Szx2 = Sxy2 + Sxz2 - Syx2 - Szx2
169
+
170
+ C[0] = (Sxy2Sxz2Syx2Szx2 * Sxy2Sxz2Syx2Szx2
171
+ + (Sxx2Syy2Szz2Syz2Szy2 + SyzSzymSyySzz2) * (Sxx2Syy2Szz2Syz2Szy2 - SyzSzymSyySzz2)
172
+ + (-(SxzpSzx)*(SyzmSzy)+(SxymSyx)*(SxxmSyy-Szz)) * (-(SxzmSzx)*(SyzpSzy)+(SxymSyx)*(SxxmSyy+Szz))
173
+ + (-(SxzpSzx)*(SyzpSzy)-(SxypSyx)*(SxxpSyy-Szz)) * (-(SxzmSzx)*(SyzmSzy)-(SxypSyx)*(SxxpSyy+Szz))
174
+ + (+(SxypSyx)*(SyzpSzy)+(SxzpSzx)*(SxxmSyy+Szz)) * (-(SxymSyx)*(SyzmSzy)+(SxzpSzx)*(SxxpSyy+Szz))
175
+ + (+(SxypSyx)*(SyzmSzy)+(SxzmSzx)*(SxxmSyy-Szz)) * (-(SxymSyx)*(SyzpSzy)+(SxzmSzx)*(SxxpSyy-Szz)))
176
+
177
+ mxEigenV = E0
178
+ n_iter = 50
179
+ for i in range(n_iter):
180
+ oldg = mxEigenV
181
+ x2 = mxEigenV*mxEigenV
182
+ b = (x2 + C[2])*mxEigenV
183
+ a = b + C[1]
184
+ delta = ((a*mxEigenV + C[0])/(2.0*x2*mxEigenV + b + a))
185
+ mxEigenV -= delta
186
+ if (abs(mxEigenV - oldg) < abs((evalprec)*mxEigenV)):
187
+ break
188
+ else:
189
+ raise Exception("More iterations needed to find eigenvalue")
190
+
191
+ val = 2.0 * (E0 - mxEigenV)/float(N)
192
+ if abs(val) < evecprec:
193
+ rms = 0.0
194
+ else:
195
+ rms = math.sqrt(val)
196
+
197
+ rot = [0.0 for i in range(9)]
198
+
199
+ a11 = SxxpSyy + Szz-mxEigenV
200
+ a12 = SyzmSzy
201
+ a13 = - SxzmSzx
202
+ a14 = SxymSyx
203
+
204
+ a21 = SyzmSzy
205
+ a22 = SxxmSyy - Szz-mxEigenV
206
+ a23 = SxypSyx
207
+ a24= SxzpSzx
208
+
209
+ a31 = a13
210
+ a32 = a23
211
+ a33 = Syy-Sxx-Szz - mxEigenV
212
+ a34 = SyzpSzy
213
+
214
+ a41 = a14
215
+ a42 = a24
216
+ a43 = a34
217
+ a44 = Szz - SxxpSyy - mxEigenV
218
+
219
+ a3344_4334 = a33 * a44 - a43 * a34
220
+ a3244_4234 = a32 * a44-a42*a34
221
+ a3243_4233 = a32 * a43 - a42 * a33
222
+ a3143_4133 = a31 * a43-a41*a33
223
+ a3144_4134 = a31 * a44 - a41 * a34
224
+ a3142_4132 = a31 * a42-a41*a32
225
+
226
+ q1 = a22*a3344_4334-a23*a3244_4234+a24*a3243_4233
227
+ q2 = -a21*a3344_4334+a23*a3144_4134-a24*a3143_4133
228
+ q3 = a21*a3244_4234-a22*a3144_4134+a24*a3142_4132
229
+ q4 = -a21*a3243_4233+a22*a3143_4133-a23*a3142_4132
230
+
231
+ qsqr = q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4
232
+
233
+ # The following code tries to calculate another column in the adjoint
234
+ # matrix when the norm of the current column is too small. Usually
235
+ # this commented block will never be activated. To be absolutely safe
236
+ # this should be uncommented, but it is most likely unnecessary.
237
+
238
+ if (qsqr < evecprec):
239
+ q1 = a12*a3344_4334 - a13*a3244_4234 + a14*a3243_4233
240
+ q2 = -a11*a3344_4334 + a13*a3144_4134 - a14*a3143_4133
241
+ q3 = a11*a3244_4234 - a12*a3144_4134 + a14*a3142_4132
242
+ q4 = -a11*a3243_4233 + a12*a3143_4133 - a13*a3142_4132
243
+ qsqr = q1*q1 + q2 *q2 + q3*q3+q4*q4
244
+
245
+ if (qsqr < evecprec):
246
+ a1324_1423 = a13 * a24 - a14 * a23
247
+ a1224_1422 = a12 * a24 - a14 * a22
248
+ a1223_1322 = a12 * a23 - a13 * a22
249
+ a1124_1421 = a11 * a24 - a14 * a21
250
+ a1123_1321 = a11 * a23 - a13 * a21
251
+ a1122_1221 = a11 * a22 - a12 * a21
252
+
253
+ q1 = a42 * a1324_1423 - a43 * a1224_1422 + a44 * a1223_1322
254
+ q2 = -a41 * a1324_1423 + a43 * a1124_1421 - a44 * a1123_1321
255
+ q3 = a41 * a1224_1422 - a42 * a1124_1421 + a44 * a1122_1221
256
+ q4 = -a41 * a1223_1322 + a42 * a1123_1321 - a43 * a1122_1221
257
+ qsqr = q1*q1 + q2 *q2 + q3*q3+q4*q4
258
+
259
+ if (qsqr < evecprec):
260
+ q1 = a32 * a1324_1423 - a33 * a1224_1422 + a34 * a1223_1322
261
+ q2 = -a31 * a1324_1423 + a33 * a1124_1421 - a34 * a1123_1321
262
+ q3 = a31 * a1224_1422 - a32 * a1124_1421 + a34 * a1122_1221
263
+ q4 = -a31 * a1223_1322 + a32 * a1123_1321 - a33 * a1122_1221
264
+ qsqr = q1*q1 + q2 *q2 + q3*q3 + q4*q4
265
+
266
+ if (qsqr < evecprec):
267
+ # if qsqr is still too small, return the identity matrix. #
268
+ rot[0] = rot[4] = rot[8] = 1.0
269
+ rot[1] = rot[2] = rot[3] = rot[5] = rot[6] = rot[7] = 0.0
270
+
271
+ return rms, rot
272
+
273
+
274
+ normq = math.sqrt(qsqr)
275
+ q1 /= normq
276
+ q2 /= normq
277
+ q3 /= normq
278
+ q4 /= normq
279
+
280
+ a2 = q1 * q1
281
+ x2 = q2 * q2
282
+ y2 = q3 * q3
283
+ z2 = q4 * q4
284
+
285
+ xy = q2 * q3
286
+ az = q1 * q4
287
+ zx = q4 * q2
288
+ ay = q1 * q3
289
+ yz = q3 * q4
290
+ ax = q1 * q2
291
+
292
+ rot[0] = a2 + x2 - y2 - z2
293
+ rot[1] = 2 * (xy + az)
294
+ rot[2] = 2 * (zx - ay)
295
+ rot[3] = 2 * (xy - az)
296
+ rot[4] = a2 - x2 + y2 - z2
297
+ rot[5] = 2 * (yz + ax)
298
+ rot[6] = 2 * (zx + ay)
299
+ rot[7] = 2 * (yz - ax)
300
+ rot[8] = a2 - x2 - y2 + z2
301
+
302
+ return rms, rot
303
+
304
+
305
+