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
5e671019
Commit
5e671019
authored
Jul 30, 2019
by
peastman
Browse files
Fixed error on Python 2.7
parent
09cac167
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
wrappers/python/simtk/openmm/app/simulatedtempering.py
wrappers/python/simtk/openmm/app/simulatedtempering.py
+6
-7
wrappers/python/tests/TestSimulatedTempering.py
wrappers/python/tests/TestSimulatedTempering.py
+1
-1
No files found.
wrappers/python/simtk/openmm/app/simulatedtempering.py
View file @
5e671019
...
...
@@ -200,7 +200,6 @@ class SimulatedTempering(object):
def
_attemptTemperatureChange
(
self
,
state
):
"""Attempt to move to a different temperature."""
i
=
self
.
currentTemperature
# Compute the probability for each temperature. This is done in log space to avoid overflow.
...
...
@@ -212,17 +211,17 @@ class SimulatedTempering(object):
for
j
in
range
(
len
(
probability
)):
if
r
<
probability
[
j
]:
if
j
!=
self
.
currentTemperature
:
# Rescale the velocities.
scale
=
math
.
sqrt
(
self
.
temperatures
[
j
]
/
self
.
temperatures
[
self
.
currentTemperature
])
velocities
=
[
v
*
scale
for
v
in
state
.
getVelocities
().
value_in_unit
(
unit
.
nanometers
/
unit
.
picoseconds
)]
self
.
simulation
.
context
.
setVelocities
(
velocities
)
# Select this temperature.
self
.
_hasMadeTransition
=
True
self
.
currentTemperature
=
j
self
.
simulation
.
integrator
.
setTemperature
(
self
.
temperatures
[
j
])
# Rescale the velocities.
scale
=
math
.
sqrt
(
self
.
temperatures
[
j
]
/
self
.
temperatures
[
i
])
velocities
=
[
v
*
scale
for
v
in
state
.
getVelocities
().
value_in_unit
(
unit
.
nanometers
/
unit
.
picoseconds
)]
self
.
simulation
.
context
.
setVelocities
(
velocities
)
if
self
.
_updateWeights
:
# Update the weight factors.
...
...
wrappers/python/tests/TestSimulatedTempering.py
View file @
5e671019
...
...
@@ -35,7 +35,7 @@ class TestSimulatedTempering(unittest.TestCase):
distances
=
[[]
for
i
in
range
(
10
)]
count
=
0
for
i
in
range
(
5
000
):
for
i
in
range
(
7
000
):
st
.
step
(
5
)
pos
=
simulation
.
context
.
getState
(
getPositions
=
True
).
getPositions
().
value_in_unit
(
nanometers
)
r
=
norm
(
pos
[
0
]
-
pos
[
1
])
...
...
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