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
73cfcd68
Commit
73cfcd68
authored
Oct 26, 2015
by
John Chodera (MSKCC)
Browse files
Add getNumAtoms(), getNumResidues(), and getNumChains() to simtk.openmm.app.Topology
parent
8eaf3c9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
wrappers/python/simtk/openmm/app/topology.py
wrappers/python/simtk/openmm/app/topology.py
+24
-0
No files found.
wrappers/python/simtk/openmm/app/topology.py
View file @
73cfcd68
...
@@ -68,6 +68,30 @@ class Topology(object):
...
@@ -68,6 +68,30 @@ class Topology(object):
return
'<%s; %d chains, %d residues, %d atoms, %d bonds>'
%
(
return
'<%s; %d chains, %d residues, %d atoms, %d bonds>'
%
(
type
(
self
).
__name__
,
nchains
,
nres
,
natom
,
nbond
)
type
(
self
).
__name__
,
nchains
,
nres
,
natom
,
nbond
)
def
getNumAtoms
(
self
):
"""Return the number of atoms in the Topology.
Returns: the number of atoms in the Topology
"""
natom
=
sum
(
1
for
a
in
self
.
atoms
())
return
natom
def
getNumResidues
(
self
):
"""Return the number of residues in the Topology.
Returns: the number of residues in the Topology
"""
nres
=
sum
(
1
for
r
in
self
.
residues
())
return
nres
def
getNumChains
(
self
):
"""Return the number of chains in the Topology.
Returns: the number of chains in the Topology
"""
nchain
=
sum
(
1
for
c
in
self
.
chains
())
return
nchain
def
addChain
(
self
,
id
=
None
):
def
addChain
(
self
,
id
=
None
):
"""Create a new Chain and add it to the Topology.
"""Create a new Chain and add it to the 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