Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
b3471976
Commit
b3471976
authored
Jul 11, 2016
by
Justin MacCallum
Committed by
GitHub
Jul 11, 2016
Browse files
Merge pull request #1 from peastman/fix_gb
Eliminated dependence on numpy and scipy
parents
c92dfe31
994190c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
wrappers/python/simtk/openmm/app/internal/customgbforces.py
wrappers/python/simtk/openmm/app/internal/customgbforces.py
+25
-9
No files found.
wrappers/python/simtk/openmm/app/internal/customgbforces.py
View file @
b3471976
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
...
@@ -6,7 +6,7 @@ Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.
Medical Research, grant U54 GM072970. See https://simtk.org.
Portions copyright (c) 2012-201
5
University of Virginia and the Authors.
Portions copyright (c) 2012-201
6
University of Virginia and the Authors.
Authors: Christoph Klein, Michael R. Shirts
Authors: Christoph Klein, Michael R. Shirts
Contributors: Jason M. Swails, Peter Eastman, Justin L. MacCallum
Contributors: Jason M. Swails, Peter Eastman, Justin L. MacCallum
...
@@ -34,11 +34,10 @@ from __future__ import division, absolute_import
...
@@ -34,11 +34,10 @@ from __future__ import division, absolute_import
from
collections
import
defaultdict
from
collections
import
defaultdict
import
copy
import
copy
import
numpy
as
np
from
scipy
import
interpolate
from
simtk.openmm.app
import
element
as
E
from
simtk.openmm.app
import
element
as
E
from
simtk.openmm
import
CustomGBForce
,
Discrete2DFunction
from
simtk.openmm
import
CustomGBForce
,
Discrete2DFunction
import
simtk.unit
as
u
import
simtk.unit
as
u
from
math
import
floor
def
strip_unit
(
value
,
unit
):
def
strip_unit
(
value
,
unit
):
...
@@ -715,13 +714,30 @@ class GBSAGBnForce(CustomAmberGBForceBase):
...
@@ -715,13 +714,30 @@ class GBSAGBnForce(CustomAmberGBForceBase):
self
.
_radiusToIndex
=
{
r
:
i
for
i
,
r
in
enumerate
(
self
.
_uniqueRadii
)}
self
.
_radiusToIndex
=
{
r
:
i
for
i
,
r
in
enumerate
(
self
.
_uniqueRadii
)}
def
_createUniqueTable
(
self
,
fullTable
):
def
_createUniqueTable
(
self
,
fullTable
):
fullTable
=
np
.
array
(
fullTable
).
reshape
((
21
,
21
))
tablePositions
=
[(
r
+
self
.
OFFSET
-
0.1
)
*
200
for
r
in
self
.
_uniqueRadii
]
xs
=
np
.
linspace
(
0.1
,
0.2
,
21
)
numRadii
=
len
(
self
.
_uniqueRadii
)
interp
=
interpolate
.
interp2d
(
xs
,
xs
,
fullTable
.
T
,
kind
=
'linear'
)
index1
=
[
0
]
*
numRadii
index2
=
[
0
]
*
numRadii
weight1
=
[
0
]
*
numRadii
weight2
=
[
0
]
*
numRadii
for
i
,
p
in
enumerate
(
tablePositions
):
if
p
<=
0
:
weight1
[
i
]
=
1.0
elif
p
>=
20
:
index1
[
i
]
=
20
weight1
[
i
]
=
1.0
else
:
index1
[
i
]
=
int
(
floor
(
p
))
index2
[
i
]
=
index1
[
i
]
+
1
weight1
[
i
]
=
index2
[
i
]
-
p
weight2
[
i
]
=
1.0
-
weight1
[
i
]
table
=
[]
table
=
[]
for
r1
in
self
.
_uniqueRadii
:
for
i
in
range
(
numRadii
):
for
r2
in
self
.
_uniqueRadii
:
for
j
in
range
(
numRadii
):
table
.
append
(
interp
(
r1
+
self
.
OFFSET
,
r2
+
self
.
OFFSET
)[
0
])
table
.
append
(
weight1
[
i
]
*
weight1
[
j
]
*
fullTable
[
index1
[
i
]
*
21
+
index1
[
j
]]
+
weight1
[
i
]
*
weight2
[
j
]
*
fullTable
[
index1
[
i
]
*
21
+
index2
[
j
]]
+
weight2
[
i
]
*
weight1
[
j
]
*
fullTable
[
index2
[
i
]
*
21
+
index1
[
j
]]
+
weight2
[
i
]
*
weight2
[
j
]
*
fullTable
[
index2
[
i
]
*
21
+
index2
[
j
]])
return
table
return
table
def
_addParticles
(
self
):
def
_addParticles
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment