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
321dcc40
Commit
321dcc40
authored
Feb 17, 2016
by
ChayaSt
Browse files
moved logic to find if NBFIX is needed to NBFixGenerator
parent
b91e8d13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
wrappers/python/simtk/openmm/app/forcefield.py
wrappers/python/simtk/openmm/app/forcefield.py
+13
-14
No files found.
wrappers/python/simtk/openmm/app/forcefield.py
View file @
321dcc40
...
...
@@ -940,18 +940,6 @@ class ForceField(object):
# Add forces to the System
for
force
in
self
.
_forces
:
NBFIX
=
False
# check if at least 2 atoms have nbfix and only then call the NBFixGenerator
if
isinstance
(
force
,
NBFixGenerator
):
for
a
in
data
.
atoms
:
atype
=
data
.
atomType
[
a
]
if
atype
in
force
.
types1
:
for
b
in
data
.
atoms
:
btype
=
data
.
atomType
[
b
]
if
btype
in
force
.
type2
:
NBFIX
=
True
if
not
NBFIX
and
isinstance
(
force
,
NBFixGenerator
):
continue
force
.
createForce
(
sys
,
data
,
nonbondedMethod
,
nonbondedCutoff
,
args
)
if
removeCMMotion
:
sys
.
addForce
(
mm
.
CMMotionRemover
())
...
...
@@ -960,8 +948,6 @@ class ForceField(object):
for
force
in
self
.
_forces
:
if
'postprocessSystem'
in
dir
(
force
):
if
not
NBFIX
and
isinstance
(
force
,
NBFixGenerator
):
continue
force
.
postprocessSystem
(
sys
,
data
,
args
)
# Execute scripts found in the XML files.
...
...
@@ -1731,6 +1717,17 @@ class NBFixGenerator(object):
The nonbonded method to apply here. Ewald and PME will be interpreted as CutoffPeriodic for the
CustomNonbondedForce
"""
# First check if there are at least two atoms in the system that need nbfix
self
.
NBFIX
=
False
for
a
in
data
.
atoms
:
atype
=
data
.
atomType
[
a
]
if
atype
in
self
.
types1
:
for
b
in
data
.
atoms
:
btype
=
data
.
atomType
[
b
]
if
btype
in
self
.
type2
:
self
.
NBFIX
=
True
if
not
self
.
NBFIX
:
return
# NonBondedForce for 'standard' nonbonded interactions. This will be modified
nonbonded
=
[
f
for
f
in
sys
.
getForces
()
if
isinstance
(
f
,
mm
.
openmm
.
NonbondedForce
)][
0
]
...
...
@@ -1828,6 +1825,8 @@ class NBFixGenerator(object):
sys
.
addForce
(
self
.
force
)
def
postprocessSystem
(
self
,
sys
,
data
,
args
):
if
not
self
.
NBFIX
:
return
nonbonded
=
[
f
for
f
in
sys
.
getForces
()
if
isinstance
(
f
,
mm
.
NonbondedForce
)][
0
]
# transfer the exclusions from NonBonded
...
...
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