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
9d97adde
Commit
9d97adde
authored
Aug 03, 2015
by
peastman
Browse files
Added a more useful string representation of atoms, residues, and chains
parent
b32e5832
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
wrappers/python/simtk/openmm/app/topology.py
wrappers/python/simtk/openmm/app/topology.py
+8
-0
No files found.
wrappers/python/simtk/openmm/app/topology.py
View file @
9d97adde
...
@@ -302,6 +302,9 @@ class Chain(object):
...
@@ -302,6 +302,9 @@ class Chain(object):
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
_residues
)
return
len
(
self
.
_residues
)
def
__repr__
(
self
):
return
"<Chain %d>"
%
self
.
index
class
Residue
(
object
):
class
Residue
(
object
):
"""A Residue object represents a residue within a Topology."""
"""A Residue object represents a residue within a Topology."""
def
__init__
(
self
,
name
,
index
,
chain
,
id
):
def
__init__
(
self
,
name
,
index
,
chain
,
id
):
...
@@ -323,6 +326,9 @@ class Residue(object):
...
@@ -323,6 +326,9 @@ class Residue(object):
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
_atoms
)
return
len
(
self
.
_atoms
)
def
__repr__
(
self
):
return
"<Residue %d (%s) of chain %d>"
%
(
self
.
index
,
self
.
name
,
self
.
chain
.
index
)
class
Atom
(
object
):
class
Atom
(
object
):
"""An Atom object represents a residue within a Topology."""
"""An Atom object represents a residue within a Topology."""
...
@@ -339,3 +345,5 @@ class Atom(object):
...
@@ -339,3 +345,5 @@ class Atom(object):
## A user defined identifier for this Atom
## A user defined identifier for this Atom
self
.
id
=
id
self
.
id
=
id
def
__repr__
(
self
):
return
"<Atom %d (%s) of chain %d residue %d (%s)>"
%
(
self
.
index
,
self
.
name
,
self
.
residue
.
chain
.
index
,
self
.
residue
.
index
,
self
.
residue
.
name
)
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