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
645bf229
Commit
645bf229
authored
Nov 14, 2014
by
Jason Swails
Browse files
Use tempfile to make a file.
parent
efce20c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
wrappers/python/tests/TestDcdFile.py
wrappers/python/tests/TestDcdFile.py
+3
-3
No files found.
wrappers/python/tests/TestDcdFile.py
View file @
645bf229
import
unittest
import
tempfile
import
numpy
as
np
from
simtk.openmm
import
app
import
simtk.openmm
as
mm
from
simtk
import
unit
...
...
@@ -10,13 +9,14 @@ import os
class
TestDCDFile
(
unittest
.
TestCase
):
def
test_dcd
(
self
):
""" Test the DCD file """
fname
=
tempfile
.
mktemp
(
suffix
=
'.dcd'
)
pdbfile
=
app
.
PDBFile
(
'systems/alanine-dipeptide-implicit.pdb'
)
natom
=
len
(
list
(
pdbfile
.
topology
.
atoms
()))
dcd
=
app
.
DCDFile
(
open
(
'test.dcd'
,
'w'
),
pdbfile
.
topology
,
0.001
)
dcd
=
app
.
DCDFile
(
open
(
fname
,
'w'
),
pdbfile
.
topology
,
0.001
)
for
i
in
range
(
5
):
dcd
.
writeModel
([
mm
.
Vec3
(
random
(),
random
(),
random
())
for
j
in
range
(
natom
)]
*
unit
.
angstroms
)
dcd
.
_file
.
close
()
os
.
remove
(
'test.dcd'
)
os
.
remove
(
fname
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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