[Chimera-users] Total number of atoms in all submodels

Eric Pettersen pett at cgl.ucsf.edu
Thu Mar 19 13:23:29 PDT 2015


On Mar 19, 2015, at 1:16 PM, "Cruz, Phil (NIH/NIAID) [C]" <phil.cruz at nih.gov> wrote:

> numAtoms = len(openModels.list(modelTypes=[Molecule])[0].atoms)

Because of the "[0]" subscript in the above, you are only getting the first Molecule model in the list.  Try this:

numAtoms = sum([len(m.atoms) for m in openModels.list(modelTypes=[Molecule])])

--Eric

                        Eric Pettersen
                        UCSF Computer Graphics Lab
                        http://www.cgl.ucsf.edu


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20150319/ebfc9121/attachment.html>


More information about the Chimera-users mailing list