Re: [PyMOL] Multiple PyMOL Instances in Python Script

2018-04-25 Thread Thomas Holder

> On Apr 24, 2018, at 7:17 PM, Yang Su  wrote:
> 
> OK, thanks. If you don't mind, I can add it to the wiki: 
> https://pymolwiki.org/index.php/Launching_From_a_Script

Sure, that would be great. Thanks a lot!

Cheers,
  Thomas

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


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Multiple PyMOL Instances in Python Script

2018-04-24 Thread Thomas Holder
Hi Yang,

Very good questions. I don't think that it's documented anywhere. Reference 
counting is maintained, I fixed that up as best as I could before the PyMOL 2.0 
release (in PyMOL 1.x it leaks references). Looks like there is no way to 
introspect whether start() has been called already.

Cheers,
  Thomas

> On Apr 24, 2018, at 6:16 PM, Yang Su  wrote:
> 
> Thanks Thomas. The code snippet works. Does start(), stop() maintain 
> reference counting? Is there a way to know if it's already started/stopped? 
> Is this API documented somewhere?
> 
> Thanks,
> Yang
> 
> 
> On Mon, Apr 23, 2018 at 1:15 PM, Thomas Holder 
>  wrote:
> Hi Yang,
> 
> Yes it's possible to have independent instances. The API has actually been 
> around for a long time. For some reason it was never widely adopted and thus 
> is not very thoroughly tested. Please report any bugs you encounter.
> 
> Example:
> 
> import pymol2
> p = pymol2.PyMOL()
> p.start()
> p.cmd.fragment('ala')
> p.cmd.show_as('sticks')
> p.cmd.zoom()
> p.cmd.png('/tmp/ala.png', 1000, 800, dpi=150, ray=1)
> p.stop()
> 
> Cheers,
>   Thomas
> 
> > On Apr 19, 2018, at 3:33 PM, Yang Su  wrote:
> > 
> > Hi,
> > 
> > Is it possible to start multiple independent pymol backend processes in a 
> > python script/jupyter notebook? Now with PyMOL 2.1 I can 'import pymol' and 
> > call a pymol.cmd function to start a backend process, but this is kind of 
> > 'global'. I'm looking for a way to manage multiple PyMOL sessions in 
> > parallel, each manipulating its own structures.
> > 
> > Thanks,
> > Yang

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


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Multiple PyMOL Instances in Python Script

2018-04-24 Thread Yang Su
Thanks Thomas. The code snippet works. Does start(), stop() maintain
reference counting? Is there a way to know if it's already started/stopped?
Is this API documented somewhere?

Thanks,
Yang


On Mon, Apr 23, 2018 at 1:15 PM, Thomas Holder <
thomas.hol...@schrodinger.com> wrote:

> Hi Yang,
>
> Yes it's possible to have independent instances. The API has actually been
> around for a long time. For some reason it was never widely adopted and
> thus is not very thoroughly tested. Please report any bugs you encounter.
>
> Example:
>
> import pymol2
> p = pymol2.PyMOL()
> p.start()
> p.cmd.fragment('ala')
> p.cmd.show_as('sticks')
> p.cmd.zoom()
> p.cmd.png('/tmp/ala.png', 1000, 800, dpi=150, ray=1)
> p.stop()
>
> Cheers,
>   Thomas
>
> > On Apr 19, 2018, at 3:33 PM, Yang Su  wrote:
> >
> > Hi,
> >
> > Is it possible to start multiple independent pymol backend processes in
> a python script/jupyter notebook? Now with PyMOL 2.1 I can 'import pymol'
> and call a pymol.cmd function to start a backend process, but this is kind
> of 'global'. I'm looking for a way to manage multiple PyMOL sessions in
> parallel, each manipulating its own structures.
> >
> > Thanks,
> > Yang
>
> --
> Thomas Holder
> PyMOL Principal Developer
> Schrödinger, Inc.
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Multiple PyMOL Instances in Python Script

2018-04-23 Thread Thomas Holder
Hi Yang,

Yes it's possible to have independent instances. The API has actually been 
around for a long time. For some reason it was never widely adopted and thus is 
not very thoroughly tested. Please report any bugs you encounter.

Example:

import pymol2
p = pymol2.PyMOL()
p.start()
p.cmd.fragment('ala')
p.cmd.show_as('sticks')
p.cmd.zoom()
p.cmd.png('/tmp/ala.png', 1000, 800, dpi=150, ray=1)
p.stop()

Cheers,
  Thomas

> On Apr 19, 2018, at 3:33 PM, Yang Su  wrote:
> 
> Hi,
> 
> Is it possible to start multiple independent pymol backend processes in a 
> python script/jupyter notebook? Now with PyMOL 2.1 I can 'import pymol' and 
> call a pymol.cmd function to start a backend process, but this is kind of 
> 'global'. I'm looking for a way to manage multiple PyMOL sessions in 
> parallel, each manipulating its own structures.
> 
> Thanks,
> Yang

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


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] Multiple PyMOL Instances in Python Script

2018-04-19 Thread Yang Su
Hi,

Is it possible to start multiple independent pymol backend processes in a
python script/jupyter notebook? Now with PyMOL 2.1 I can 'import pymol' and
call a pymol.cmd function to start a backend process, but this is kind of
'global'. I'm looking for a way to manage multiple PyMOL sessions in
parallel, each manipulating its own structures.

Thanks,
Yang
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net