Re: [PyMOL] How to count the number of molecules in a selection?

2020-07-10 Thread Pedro Lacerda
Thank you!

Em qui., 9 de jul. de 2020 às 18:40, Thomas Holder <
thomas.hol...@schrodinger.com> escreveu:

> @cmd.extend
> def count_molecules(selection="all", quiet=0):
> tmpsele = cmd.get_unused_name("_tmp")
> count = 0
> if cmd.select(tmpsele, selection):
> count += 1
> while cmd.select(tmpsele, f'{tmpsele} &! bm. first {tmpsele}'):
> count += 1
> cmd.delete(tmpsele)
> if not int(quiet):
> print(f' Number of molecules: {count}')
> return count
>
> Cheers,
>   Thomas
>
>
> > On Jul 9, 2020, at 9:52 PM, Pedro Lacerda  wrote:
> >
> > ... via programming
> >
> > --
> > Pedro Sousa Lacerda
> >
> > Laboratório de Bioinformática e Modelagem Molecular
> > Faculdade de Farmácia / UEFS
> >
> > @pslacerda
> > +55 71 9 9981-1856
> > http://lattes.cnpq.br/8338596525330907
> > ___
> > PyMOL-users mailing list
> > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> > Unsubscribe:
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
>
> --
> Thomas Holder
> PyMOL Principal Developer
> Schrödinger, Inc.
>
>

-- 
Pedro Sousa Lacerda

Laboratório de Bioinformática e Modelagem Molecular / UFBA
Mestrando em Ciências Farmácias / UEFS

@pslacerda
+55 71 9 9981-1856
http://lattes.cnpq.br/8338596525330907
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Re: [PyMOL] How to count the number of molecules in a selection?

2020-07-09 Thread Thomas Holder
@cmd.extend
def count_molecules(selection="all", quiet=0):
tmpsele = cmd.get_unused_name("_tmp")
count = 0
if cmd.select(tmpsele, selection):
count += 1
while cmd.select(tmpsele, f'{tmpsele} &! bm. first {tmpsele}'):
count += 1
cmd.delete(tmpsele)
if not int(quiet):
print(f' Number of molecules: {count}')
return count

Cheers,
  Thomas


> On Jul 9, 2020, at 9:52 PM, Pedro Lacerda  wrote:
> 
> ... via programming
> 
> -- 
> Pedro Sousa Lacerda
> 
> Laboratório de Bioinformática e Modelagem Molecular
> Faculdade de Farmácia / UEFS
> 
> @pslacerda
> +55 71 9 9981-1856
> http://lattes.cnpq.br/8338596525330907
> ___
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> Unsubscribe: 
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

--
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.



___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

[PyMOL] How to count the number of molecules in a selection?

2020-07-09 Thread Pedro Lacerda
... via programming

-- 
Pedro Sousa Lacerda

Laboratório de Bioinformática e Modelagem Molecular
Faculdade de Farmácia / UEFS

@pslacerda
+55 71 9 9981-1856
http://lattes.cnpq.br/8338596525330907
___
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe