@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 <[email protected]> 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/[email protected]
> 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/[email protected]
Unsubscribe:
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe