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
8f9f355e
Unverified
Commit
8f9f355e
authored
Feb 01, 2022
by
Peter Eastman
Committed by
GitHub
Feb 01, 2022
Browse files
Fixed exception when splitting AMOEBA force field between two files (#3438)
parent
33c694d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
wrappers/python/openmm/app/forcefield.py
wrappers/python/openmm/app/forcefield.py
+16
-9
No files found.
wrappers/python/openmm/app/forcefield.py
View file @
8f9f355e
...
@@ -3465,8 +3465,14 @@ class AmoebaAngleGenerator(object):
...
@@ -3465,8 +3465,14 @@ class AmoebaAngleGenerator(object):
# <AmoebaAngleForce angle-cubic="-0.014" angle-quartic="5.6e-05" angle-pentic="-7e-07" angle-sextic="2.2e-08">
# <AmoebaAngleForce angle-cubic="-0.014" angle-quartic="5.6e-05" angle-pentic="-7e-07" angle-sextic="2.2e-08">
# <Angle class1="2" class2="1" class3="3" k="0.0637259642196" angle1="122.00" />
# <Angle class1="2" class2="1" class3="3" k="0.0637259642196" angle1="122.00" />
generator
=
AmoebaAngleGenerator
(
forceField
,
element
.
attrib
[
'angle-cubic'
],
element
.
attrib
[
'angle-quartic'
],
element
.
attrib
[
'angle-pentic'
],
element
.
attrib
[
'angle-sextic'
])
existing
=
[
f
for
f
in
forceField
.
_forces
if
isinstance
(
f
,
AmoebaAngleGenerator
)]
forceField
.
_forces
.
append
(
generator
)
if
len
(
existing
)
==
0
:
generator
=
AmoebaAngleGenerator
(
forceField
,
element
.
attrib
[
'angle-cubic'
],
element
.
attrib
[
'angle-quartic'
],
element
.
attrib
[
'angle-pentic'
],
element
.
attrib
[
'angle-sextic'
])
forceField
.
registerGenerator
(
generator
)
else
:
generator
=
existing
[
0
]
if
tuple
(
element
.
attrib
[
x
]
for
x
in
(
'angle-cubic'
,
'angle-quartic'
,
'angle-pentic'
,
'angle-sextic'
))
!=
(
generator
.
cubic
,
generator
.
quartic
,
generator
.
pentic
,
generator
.
sextic
):
raise
ValueError
(
'All <AmoebaAngleForce> tags must use identical scale factors'
)
for
angle
in
element
.
findall
(
'Angle'
):
for
angle
in
element
.
findall
(
'Angle'
):
types
=
forceField
.
_findAtomTypes
(
angle
.
attrib
,
3
)
types
=
forceField
.
_findAtomTypes
(
angle
.
attrib
,
3
)
if
None
not
in
types
:
if
None
not
in
types
:
...
@@ -3694,13 +3700,14 @@ class AmoebaOutOfPlaneBendGenerator(object):
...
@@ -3694,13 +3700,14 @@ class AmoebaOutOfPlaneBendGenerator(object):
# get global scalar parameters
# get global scalar parameters
generator
=
AmoebaOutOfPlaneBendGenerator
(
forceField
,
element
.
attrib
[
'type'
],
existing
=
[
f
for
f
in
forceField
.
_forces
if
isinstance
(
f
,
AmoebaOutOfPlaneBendGenerator
)]
float
(
element
.
attrib
[
'opbend-cubic'
]),
if
len
(
existing
)
==
0
:
float
(
element
.
attrib
[
'opbend-quartic'
]),
generator
=
AmoebaOutOfPlaneBendGenerator
(
forceField
,
element
.
attrib
[
'type'
],
element
.
attrib
[
'opbend-cubic'
],
element
.
attrib
[
'opbend-quartic'
],
element
.
attrib
[
'opbend-pentic'
],
element
.
attrib
[
'opbend-sextic'
])
float
(
element
.
attrib
[
'opbend-pentic'
]),
forceField
.
registerGenerator
(
generator
)
float
(
element
.
attrib
[
'opbend-sextic'
]))
else
:
generator
=
existing
[
0
]
forceField
.
_forces
.
append
(
generator
)
if
tuple
(
element
.
attrib
[
x
]
for
x
in
(
'type'
,
'opbend-cubic'
,
'opbend-quartic'
,
'opbend-pentic'
,
'opbend-sextic'
))
!=
(
generator
.
type
,
generator
.
cubic
,
generator
.
quartic
,
generator
.
pentic
,
generator
.
sextic
):
raise
ValueError
(
'All <AmoebaOutOfPlaneBendForce> tags must use identical scale factors'
)
for
angle
in
element
.
findall
(
'Angle'
):
for
angle
in
element
.
findall
(
'Angle'
):
if
'class3'
in
angle
.
attrib
and
'class4'
in
angle
.
attrib
and
angle
.
attrib
[
'class3'
]
==
'0'
and
angle
.
attrib
[
'class4'
]
==
'0'
:
if
'class3'
in
angle
.
attrib
and
'class4'
in
angle
.
attrib
and
angle
.
attrib
[
'class3'
]
==
'0'
and
angle
.
attrib
[
'class4'
]
==
'0'
:
...
...
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