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
cb0b20f5
Commit
cb0b20f5
authored
Apr 23, 2012
by
Peter Eastman
Browse files
Set units correctly on Numpy arrays
parent
c9d7d1e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
wrappers/python/simtk/openmm/app/amberinpcrdfile.py
wrappers/python/simtk/openmm/app/amberinpcrdfile.py
+7
-7
No files found.
wrappers/python/simtk/openmm/app/amberinpcrdfile.py
View file @
cb0b20f5
...
...
@@ -32,7 +32,7 @@ __author__ = "Peter Eastman"
__version__
=
"1.0"
from
simtk.openmm.app.internal
import
amber_file_parser
from
simtk.unit
import
nanometers
,
picoseconds
from
simtk.unit
import
Quantity
,
nanometers
,
picoseconds
try
:
import
numpy
except
:
...
...
@@ -84,7 +84,7 @@ class AmberInpcrdFile(object):
"""
if
asNumpy
:
if
self
.
_numpyPositions
is
None
:
self
.
_numpyPositions
=
numpy
.
array
(
self
.
positions
.
value_in_unit
(
nanometers
))
*
nanometers
self
.
_numpyPositions
=
Quantity
(
numpy
.
array
(
self
.
positions
.
value_in_unit
(
nanometers
))
,
nanometers
)
return
self
.
_numpyPositions
return
self
.
positions
...
...
@@ -96,7 +96,7 @@ class AmberInpcrdFile(object):
"""
if
asNumpy
:
if
self
.
_numpyVelocities
is
None
:
self
.
_numpyVelocities
=
numpy
.
array
(
self
.
velocities
.
value_in_unit
(
nanometers
/
picoseconds
))
*
nanometers
/
picoseconds
self
.
_numpyVelocities
=
Quantity
(
numpy
.
array
(
self
.
velocities
.
value_in_unit
(
nanometers
/
picoseconds
))
,
nanometers
/
picoseconds
)
return
self
.
_numpyVelocities
return
self
.
velocities
...
...
@@ -109,9 +109,9 @@ class AmberInpcrdFile(object):
if
asNumpy
:
if
self
.
_numpyBoxVectors
is
None
:
self
.
_numpyBoxVectors
=
[]
self
.
_numpyBoxVectors
.
append
(
numpy
.
array
(
self
.
boxVectors
[
0
].
value_in_unit
(
nanometers
))
*
nanometers
)
self
.
_numpyBoxVectors
.
append
(
numpy
.
array
(
self
.
boxVectors
[
1
].
value_in_unit
(
nanometers
))
*
nanometers
)
self
.
_numpyBoxVectors
.
append
(
numpy
.
array
(
self
.
boxVectors
[
2
].
value_in_unit
(
nanometers
))
*
nanometers
)
self
.
_numpyBoxVectors
.
append
(
Quantity
(
numpy
.
array
(
self
.
boxVectors
[
0
].
value_in_unit
(
nanometers
))
,
nanometers
)
)
self
.
_numpyBoxVectors
.
append
(
Quantity
(
numpy
.
array
(
self
.
boxVectors
[
1
].
value_in_unit
(
nanometers
))
,
nanometers
)
)
self
.
_numpyBoxVectors
.
append
(
Quantity
(
numpy
.
array
(
self
.
boxVectors
[
2
].
value_in_unit
(
nanometers
))
,
nanometers
)
)
return
self
.
_numpyBoxVectors
return
self
.
boxVectors
\ No newline at end of file
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