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
99df6758
Commit
99df6758
authored
Jul 22, 2013
by
peastman
Browse files
Merge pull request #69 from rmcgibbo/pickle2-vec3
Add support for pickle protocol 2 for Vec3
parents
1d1d1390
d1334405
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
wrappers/python/simtk/openmm/vec3.py
wrappers/python/simtk/openmm/vec3.py
+4
-0
No files found.
wrappers/python/simtk/openmm/vec3.py
View file @
99df6758
...
...
@@ -40,6 +40,10 @@ class Vec3(tuple):
"""Create a new Vec3."""
return
tuple
.
__new__
(
cls
,
(
x
,
y
,
z
))
def
__getnewargs__
(
self
):
"Support for pickle protocol 2: http://docs.python.org/2/library/pickle.html#pickling-and-unpickling-normal-class-instances"
return
self
[
0
],
self
[
1
],
self
[
2
]
def
__add__
(
self
,
other
):
"""Add two Vec3s."""
return
Vec3
(
self
[
0
]
+
other
[
0
],
self
[
1
]
+
other
[
1
],
self
[
2
]
+
other
[
2
])
...
...
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