Hi Chris,
I don't know how you opened your file, but if you opened it with chimera.openModels.open() then the return value is a list of models from that file, so...

models = chimera.openModels.open("myfile.mol2")
for i in range(len(models)):
...

though perhaps more direct would be:

models = chimera.openModels.open("myfile.mol2")
for m in models: m.display = False
for i, m in enumerate(models):
... setup stuff
m.display = True
... more stuff
m.display = False

--Eric

                        Eric Pettersen

                        UCSF Computer Graphics Lab

                        http://www.cgl.ucsf.edu



On Jun 29, 2009, at 5:11 PM, cdlau@ucsd.edu wrote:

Hi,

I am currently using the modeldisp command on the command line to hide and
view various molecules within a single mol2 file.  I was wondering how I
would be able to access how many total molecules there were in a single
mol2 file.  For example, if the mol2 file is loaded into model 0, I would
be using

modeldisp #0.$i

etc in a large loop where $i is changing.  What command can I use to
return a value for the total number of molecules in the mol2 file so I can
have this be the upper limit of $i?

Thanks for your help,

Chris
_______________________________________________
Chimera-users mailing list
Chimera-users@cgl.ucsf.edu
http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users