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
40632e11
Commit
40632e11
authored
Jan 12, 2015
by
Robert McGibbon
Browse files
bytes issue
parent
7cdeded0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
24 deletions
+9
-24
wrappers/python/src/swig_doxygen/swig_lib/python/pythoncode.i
...pers/python/src/swig_doxygen/swig_lib/python/pythoncode.i
+9
-24
No files found.
wrappers/python/src/swig_doxygen/swig_lib/python/pythoncode.i
View file @
40632e11
...
@@ -9,6 +9,10 @@ import sys
...
@@ -9,6 +9,10 @@ import sys
import
math
import
math
RMIN_PER_SIGMA
=
math
.
pow
(
2
,
1
/
6.0
)
RMIN_PER_SIGMA
=
math
.
pow
(
2
,
1
/
6.0
)
RVDW_PER_SIGMA
=
math
.
pow
(
2
,
1
/
6.0
)
/
2.0
RVDW_PER_SIGMA
=
math
.
pow
(
2
,
1
/
6.0
)
/
2.0
if
sys
.
version_info
[
0
]
==
2
:
_string_types
=
(
basestring
,)
else
:
_string_types
=
(
bytes
,
str
)
import
simtk
.
unit
as
unit
import
simtk
.
unit
as
unit
from
simtk
.
openmm
.
vec3
import
Vec3
from
simtk
.
openmm
.
vec3
import
Vec3
...
@@ -215,25 +219,6 @@ class State(_object):
...
@@ -215,25 +219,6 @@ class State(_object):
return
self
.
_paramMap
return
self
.
_paramMap
#
Strings
can
cause
trouble
#
as
can
any
container
that
has
infinite
levels
of
containment
def
_is_string
(
x
)
:
#
step
1
)
String
is
always
a
container
#
and
its
contents
are
themselves
containers
.
try
:
first_item
=
iter
(
x
)
.
next
()
inner_item
=
iter
(
first_item
)
.
next
()
if
first_item
==
inner_item
:
return
True
else
:
return
False
except
TypeError
:
return
False
except
StopIteration
:
return
False
except
ValueError
:
return
False
def
stripUnits
(
args
)
:
def
stripUnits
(
args
)
:
"""
"""
getState(self, quantity)
getState(self, quantity)
...
@@ -282,13 +267,13 @@ def stripUnits(args):
...
@@ -282,13 +267,13 @@ def stripUnits(args):
if
arg
.
unit
.
is_compatible
(
unit
.
bar
)
:
if
arg
.
unit
.
is_compatible
(
unit
.
bar
)
:
arg
=
arg
/
unit
.
bar
arg
=
arg
/
unit
.
bar
else
:
else
:
arg
=
arg
.
value_in_unit_system
(
unit
.
md_unit_system
)
arg
=
arg
.
value_in_unit_system
(
unit
.
md_unit_system
)
#
JDC
:
End
workaround
.
#
JDC
:
End
workaround
.
elif
isinstance
(
arg
,
dict
)
:
elif
isinstance
(
arg
,
dict
)
:
newKeys
=
stripUnits
(
arg
.
keys
())
newKeys
=
stripUnits
(
arg
.
keys
())
newValues
=
stripUnits
(
arg
.
values
())
newValues
=
stripUnits
(
arg
.
values
())
arg
=
dict
(
zip
(
newKeys
,
newValues
))
arg
=
dict
(
zip
(
newKeys
,
newValues
))
elif
not
_
is_string
(
arg
)
:
elif
not
is
instance
(
arg
,
_string
_types
)
:
try
:
try
:
iter
(
arg
)
iter
(
arg
)
#
Reclusively
strip
units
from
all
quantities
#
Reclusively
strip
units
from
all
quantities
...
...
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