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
d1334405
Commit
d1334405
authored
Jul 21, 2013
by
Robert McGibbon
Browse files
Add support for pickle protocol 2 for Vec3
parent
49cb91c5
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 @
d1334405
...
@@ -40,6 +40,10 @@ class Vec3(tuple):
...
@@ -40,6 +40,10 @@ class Vec3(tuple):
"""Create a new Vec3."""
"""Create a new Vec3."""
return
tuple
.
__new__
(
cls
,
(
x
,
y
,
z
))
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
):
def
__add__
(
self
,
other
):
"""Add two Vec3s."""
"""Add two Vec3s."""
return
Vec3
(
self
[
0
]
+
other
[
0
],
self
[
1
]
+
other
[
1
],
self
[
2
]
+
other
[
2
])
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