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
ed57e864
"platforms/brook/tests/TestBrookHarmonicBondForce.cpp" did not exist on "8c3878b27503402cf889d7a06feb9115cc1724ed"
Commit
ed57e864
authored
Oct 25, 2019
by
João Rodrigues
Browse files
Fix position of existing atoms on addHydrogens()
parent
c7441b96
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
36 deletions
+40
-36
wrappers/python/simtk/openmm/app/modeller.py
wrappers/python/simtk/openmm/app/modeller.py
+40
-36
No files found.
wrappers/python/simtk/openmm/app/modeller.py
View file @
ed57e864
...
...
@@ -712,6 +712,8 @@ class Modeller(object):
automatically, this function will only add hydrogens. It will never remove ones that are already present in the
model, regardless of the specified pH.
In all cases, the positions of existing atoms (including existing hydrogens) are not modified.
Definitions for standard amino acids and nucleotides are built in. You can call loadHydrogenDefinitions() to load
additional definitions for other residue types.
...
...
@@ -930,14 +932,16 @@ class Modeller(object):
# The hydrogens were added at random positions. Now perform an energy minimization to fix them up.
addedH
=
set
(
newIndices
)
# keep track of Hs added
if
forcefield
is
not
None
:
# Use the ForceField the user specified.
system
=
forcefield
.
createSystem
(
newTopology
,
rigidWater
=
False
,
nonbondedMethod
=
CutoffNonPeriodic
)
atoms
=
list
(
newTopology
.
atoms
())
for
i
in
range
(
system
.
getNumParticles
()):
if
atoms
[
i
].
element
!=
elem
.
hydrogen
:
#
This is a heavy
atom,
so
make it immobile.
if
i
not
in
addedH
:
#
Existing
atom, make it immobile.
system
.
setParticleMass
(
i
,
0
)
else
:
# Create a System that restrains the distance of each hydrogen from its parent atom
...
...
@@ -955,7 +959,7 @@ class Modeller(object):
bondedTo
=
[]
for
atom
in
newTopology
.
atoms
():
nonbonded
.
addParticle
([])
if
atom
.
element
!=
elem
.
hydrogen
:
if
atom
.
index
not
in
addedH
:
# make immobile
system
.
addParticle
(
0.0
)
else
:
system
.
addParticle
(
1.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