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
227c86bf
Commit
227c86bf
authored
Jun 04, 2015
by
peastman
Browse files
Merge pull request #950 from swails/topenh
Minor enhancements to Topology
parents
13d366a9
e040c5d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
wrappers/python/simtk/openmm/app/topology.py
wrappers/python/simtk/openmm/app/topology.py
+14
-0
No files found.
wrappers/python/simtk/openmm/app/topology.py
View file @
227c86bf
...
...
@@ -59,6 +59,14 @@ class Topology(object):
self
.
_bonds
=
[]
self
.
_periodicBoxVectors
=
None
def
__repr__
(
self
):
nchains
=
len
(
self
.
_chains
)
nres
=
sum
(
1
for
r
in
self
.
residues
())
natom
=
sum
(
1
for
a
in
self
.
atoms
())
nbond
=
len
(
self
.
_bonds
)
return
'<%s; %d chains, %d residues, %d atoms, %d bonds>'
%
(
type
(
self
).
__name__
,
nchains
,
nres
,
natom
,
nbond
)
def
addChain
(
self
,
id
=
None
):
"""Create a new Chain and add it to the Topology.
...
...
@@ -291,6 +299,9 @@ class Chain(object):
for
atom
in
residue
.
_atoms
:
yield
atom
def
__len__
(
self
):
return
len
(
self
.
_residues
)
class
Residue
(
object
):
"""A Residue object represents a residue within a Topology."""
def
__init__
(
self
,
name
,
index
,
chain
,
id
):
...
...
@@ -309,6 +320,9 @@ class Residue(object):
"""Iterate over all Atoms in the Residue."""
return
iter
(
self
.
_atoms
)
def
__len__
(
self
):
return
len
(
self
.
_atoms
)
class
Atom
(
object
):
"""An Atom object represents a residue within a Topology."""
...
...
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