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
e93c2aba
Commit
e93c2aba
authored
Aug 17, 2016
by
peastman
Committed by
GitHub
Aug 17, 2016
Browse files
Merge pull request #1563 from peastman/ffopt
Optimization to ForceField
parents
7fb7ac1f
b8be9b8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+13
-2
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
e93c2aba
...
...
@@ -40,6 +40,7 @@ import math
from
math
import
sqrt
,
cos
from
copy
import
deepcopy
from
heapq
import
heappush
,
heappop
from
collections
import
defaultdict
import
simtk.openmm
as
mm
import
simtk.unit
as
unit
from
.
import
element
as
elem
...
...
@@ -1662,6 +1663,7 @@ class HarmonicBondGenerator(object):
def
__init__
(
self
,
forcefield
):
self
.
ff
=
forcefield
self
.
bondsForAtomType
=
defaultdict
(
set
)
self
.
types1
=
[]
self
.
types2
=
[]
self
.
length
=
[]
...
...
@@ -1670,8 +1672,13 @@ class HarmonicBondGenerator(object):
def
registerBond
(
self
,
parameters
):
types
=
self
.
ff
.
_findAtomTypes
(
parameters
,
2
)
if
None
not
in
types
:
index
=
len
(
self
.
types1
)
self
.
types1
.
append
(
types
[
0
])
self
.
types2
.
append
(
types
[
1
])
for
t
in
types
[
0
]:
self
.
bondsForAtomType
[
t
].
add
(
index
)
for
t
in
types
[
1
]:
self
.
bondsForAtomType
[
t
].
add
(
index
)
self
.
length
.
append
(
_convertParameterToNumber
(
parameters
[
'length'
]))
self
.
k
.
append
(
_convertParameterToNumber
(
parameters
[
'k'
]))
...
...
@@ -1697,7 +1704,7 @@ class HarmonicBondGenerator(object):
for
bond
in
data
.
bonds
:
type1
=
data
.
atomType
[
data
.
atoms
[
bond
.
atom1
]]
type2
=
data
.
atomType
[
data
.
atoms
[
bond
.
atom2
]]
for
i
in
range
(
len
(
self
.
types1
))
:
for
i
in
self
.
bondsForAtomType
[
type1
]
:
types1
=
self
.
types1
[
i
]
types2
=
self
.
types2
[
i
]
if
(
type1
in
types1
and
type2
in
types2
)
or
(
type1
in
types2
and
type2
in
types1
):
...
...
@@ -1717,6 +1724,7 @@ class HarmonicAngleGenerator(object):
def
__init__
(
self
,
forcefield
):
self
.
ff
=
forcefield
self
.
anglesForAtom2Type
=
defaultdict
(
list
)
self
.
types1
=
[]
self
.
types2
=
[]
self
.
types3
=
[]
...
...
@@ -1726,9 +1734,12 @@ class HarmonicAngleGenerator(object):
def
registerAngle
(
self
,
parameters
):
types
=
self
.
ff
.
_findAtomTypes
(
parameters
,
3
)
if
None
not
in
types
:
index
=
len
(
self
.
types1
)
self
.
types1
.
append
(
types
[
0
])
self
.
types2
.
append
(
types
[
1
])
self
.
types3
.
append
(
types
[
2
])
for
t
in
types
[
1
]:
self
.
anglesForAtom2Type
[
t
].
append
(
index
)
self
.
angle
.
append
(
_convertParameterToNumber
(
parameters
[
'angle'
]))
self
.
k
.
append
(
_convertParameterToNumber
(
parameters
[
'k'
]))
...
...
@@ -1755,7 +1766,7 @@ class HarmonicAngleGenerator(object):
type1
=
data
.
atomType
[
data
.
atoms
[
angle
[
0
]]]
type2
=
data
.
atomType
[
data
.
atoms
[
angle
[
1
]]]
type3
=
data
.
atomType
[
data
.
atoms
[
angle
[
2
]]]
for
i
in
range
(
len
(
self
.
types1
))
:
for
i
in
self
.
anglesForAtom2Type
[
type2
]
:
types1
=
self
.
types1
[
i
]
types2
=
self
.
types2
[
i
]
types3
=
self
.
types3
[
i
]
...
...
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