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
fb3f0677
Commit
fb3f0677
authored
Sep 05, 2019
by
peastman
Browse files
Workaround for limitations of NamedTemporaryFile on Windows
parent
0a214970
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
wrappers/python/tests/TestCharmmFiles.py
wrappers/python/tests/TestCharmmFiles.py
+4
-2
No files found.
wrappers/python/tests/TestCharmmFiles.py
View file @
fb3f0677
...
@@ -5,6 +5,7 @@ from simtk.openmm import *
...
@@ -5,6 +5,7 @@ from simtk.openmm import *
from
simtk.unit
import
*
from
simtk.unit
import
*
import
simtk.openmm.app.element
as
elem
import
simtk.openmm.app.element
as
elem
import
math
import
math
import
os
import
tempfile
import
tempfile
import
warnings
import
warnings
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
0
):
...
@@ -337,10 +338,11 @@ class TestCharmmFiles(unittest.TestCase):
...
@@ -337,10 +338,11 @@ class TestCharmmFiles(unittest.TestCase):
# The following values were computed with CHARMM.
# The following values were computed with CHARMM.
modeEnergy
=
{
0
:
754318.20507
,
1
:
754318.20507
,
2
:
908.35224
,
3
:
59.65279
,
4
:
-
241.12856
,
5
:
39.13169
}
modeEnergy
=
{
0
:
754318.20507
,
1
:
754318.20507
,
2
:
908.35224
,
3
:
59.65279
,
4
:
-
241.12856
,
5
:
39.13169
}
for
nbxmod
in
range
(
-
5
,
6
):
for
nbxmod
in
range
(
-
5
,
6
):
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.par'
,
mode
=
'w'
)
as
parfile
:
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.par'
,
mode
=
'w'
,
delete
=
False
)
as
parfile
:
parfile
.
write
(
par
.
replace
(
'nbxmod 5'
,
'nbxmod %d'
%
nbxmod
))
parfile
.
write
(
par
.
replace
(
'nbxmod 5'
,
'nbxmod %d'
%
nbxmod
))
parfile
.
flush
()
parfile
.
close
()
params
=
CharmmParameterSet
(
'systems/charmm22.rtf'
,
parfile
.
name
)
params
=
CharmmParameterSet
(
'systems/charmm22.rtf'
,
parfile
.
name
)
os
.
remove
(
parfile
.
name
)
system
=
self
.
psf_c
.
createSystem
(
params
,
nonbondedMethod
=
NoCutoff
)
system
=
self
.
psf_c
.
createSystem
(
params
,
nonbondedMethod
=
NoCutoff
)
context
=
Context
(
system
,
VerletIntegrator
(
1
*
femtoseconds
),
Platform
.
getPlatformByName
(
'Reference'
))
context
=
Context
(
system
,
VerletIntegrator
(
1
*
femtoseconds
),
Platform
.
getPlatformByName
(
'Reference'
))
context
.
setPositions
(
crd
.
positions
)
context
.
setPositions
(
crd
.
positions
)
...
...
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