Re: [PyMOL] Iterate Script Over States
Tsjerk, This will only provide a minor speedup, but the alter* and iterate* commands do take a "space" argument with a dictionary to use in lieu of PyMOL globals(). my_dict = {'L':[]} cmd.iterate_state(1, 'all', 'L.append( (x,y,z) )', space=my_dict) print len(my_dict['L']) etc. Cheers, Warren > -Original Message- > From: Tsjerk Wassenaar [mailto:tsje...@gmail.com] > Sent: Tuesday, September 29, 2009 7:40 AM > To: Warren DeLano > Subject: Re: [PyMOL] Iterate Script Over States > > Hi Warren (e.a.), > > First, as a side note, your first post had 'for state in > cmd.count_states():' whereas it seems it should read 'for state in > range(cmd.count_states()):'. > > I find myself doing something similar to Sean now, accumulating > coordinates over different frames for each of the atoms. The question > is how to do that fastest. At this moment I'm doing the following, > which is painstakingly slow (but it works :)). Aside from that it has > a nasty hack adding to globals(), as cmd.alter executes in its own > scope. > > class AtomVar: > sum = None > ssq = None > N = None > cov = None > var = None > > def __init__( self ): > self.sum = [ 0,0,0 ] # x, y, z > self.ssq = [ 0,0,0,0,0,0 ] # xx, yy, zz, xy, xz, yz > self.N = 0 > > def inc( self, x ): > self.sum = [ self.sum[i] + x[i] for i in range(3) ] > squares = [ x[0]*x[0], x[1]*x[1], x[2]*x[2], x[0]*x[1], > x[0]*x[2], x[1]*x[2] ] > self.ssq = [ self.ssq[i] + squares[i] for i in range(6) ] > self.N = self.N + 1 > > def purge( self ): > s = self.sum > squares = [ s[0]*s[0], s[1]*s[1], s[2]*s[2], s[0]*s[1], > s[0]*s[2], s[1]*s[2] ] > self.cov = [ (squares[i] - self.ssq[i]/self.N)/self.N for i in > range(6) ] > self.var = self.cov[0] + self.cov[1] + self.cov[2] > > def molVar( sele="all" ): > model = cmd.get_model( sele ) > globals()["M"] = {} > for i in model.atom: > M[ i.id ] = AtomVar() > for state in range(cmd.count_states()): > cmd.iterate_state( state, sele, "M[ ID ].inc( (x,y,z) )" ) > for i in M.keys(): > M[ i ].purge() > cmd.alter( sele, "b = M[ ID ].var" ) > > Any suggestions are welcome :) > > Cheers, > > Tsjerk > > > On Mon, Sep 28, 2009 at 9:05 PM, Warren DeLano wrote: > > Sean, > > > > > > > > Yes, that is an alternate route. cmd.get_model is likely slower than > > cmd.iterate_state, but should work regardless. > > > > > > > > Cheers > > > > Warren > > > > > > > > > > > > From: Sean Law [mailto:magic...@hotmail.com] > > Sent: Monday, September 28, 2009 11:58 AM > > To: pymol-users@lists.sourceforge.net > > Subject: Re: [PyMOL] Iterate Script Over States > > > > > > > > I think I figured it out (though, it wasn't documented). What I needed > was > > to use: > > > > cmd.get_model(selection, STATE) > > > > I think that's the correct usage? What I needed was to loop through a > > selection and then to calculate the sugar pucker information. However, > not > > all atoms from the selection are required for the calculation so some > > pre-parsing of the residue is needed. It appears that I can specify the > > state to obtain atom objects from via the get_model command. I hope > that is > > right? > > > > Sean > > > > > > > > Create a cool, new character for your Windows Live(tm) Messenger. Check it > out > > > > > -- > > Come build with us! The BlackBerry® Developer Conference in SF, CA > > is the only developer event you need to attend this year. Jumpstart your > > developing skills, take BlackBerry mobile applications to market and > stay > > ahead of the curve. Join us from November 9-12, 2009. Register > now! > > http://p.sf.net/sfu/devconf > > ___ > > 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 > > > > > > -- > Tsjerk A. Wassenaar, Ph.D. > Junior UD (post-doc) > Biomolecular NMR, Bijvoet Center > Utrecht University > Padualaan 8 > 3584 CH Utrecht > The Netherlands > P: +31-30-2539931 > F: +31-30-2537623 > > > -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail
Re: [PyMOL] DepthQ configuration in a classroom setting
Roger, That's a bit odd: usually it either works or it doesn't. Working for 20 seconds at a time may indicate defective hardware (projector, emitter, graphics card, connector, dead battery, etc.). But as a first test, pease try using some other stereo-3D-capable software (e.g. VMD or Chimera) in order to make certain that the problem is not due to PyMOL itself. Cheers, Warren From: Roger Rowlett [mailto:rrowl...@colgate.edu] Sent: Tuesday, September 29, 2009 9:58 AM To: pymol-users@lists.sourceforge.net Subject: [PyMOL] DepthQ configuration in a classroom setting Has anyone on the board configured a DepthQ projector for classroom use, i.e. using a ceiling-mounted projector. Our IT department has recently installed a DepthQ projector in a classroom-type setting, and it displays stereo Pymol images for about 20 seconds, then loses sync. My configuration is the following: Intel WinXP PC with Quadro 3700 running NVidia driver 191.00 Stereo "ON" enabled in the Global settings of the Nvidia Control panel DepthQ installed as only graphical display device (currently) Screen resolution set to the native resolution of the DepthQ projector I'm running a recent version (1.2) of Pymol I assume that to get a second monitor display of the DepthQ projector I should attach a VGA cable to the "video out" port of the DepthQ and run that to an appropriate LCD monitor. Am I missing anything? I'm wondering if the video cabling is too long or inappropriate, causing the sync dropouts, or if I have missed something really elementary in the Nvidia configuration. At this point, I'm considering breaking down the classroom installation and testing the computer and projector on the bench. Cheers, -- Roger S. Rowlett Professor Department of Chemistry Colgate University 13 Oak Drive Hamilton, NY 13346 tel: (315)-228-7245 ofc: (315)-228-7395 fax: (315)-228-7935 email: rrowl...@colgate.edu -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf___ 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] DepthQ configuration in a classroom setting
Has anyone on the board configured a DepthQ projector for classroom use, i.e. using a ceiling-mounted projector. Our IT department has recently installed a DepthQ projector in a classroom-type setting, and it displays stereo Pymol images for about 20 seconds, then loses sync. My configuration is the following: Intel WinXP PC with Quadro 3700 running NVidia driver 191.00 Stereo "ON" enabled in the Global settings of the Nvidia Control panel DepthQ installed as only graphical display device (currently) Screen resolution set to the native resolution of the DepthQ projector I'm running a recent version (1.2) of Pymol I assume that to get a second monitor display of the DepthQ projector I should attach a VGA cable to the "video out" port of the DepthQ and run that to an appropriate LCD monitor. Am I missing anything? I'm wondering if the video cabling is too long or inappropriate, causing the sync dropouts, or if I have missed something really elementary in the Nvidia configuration. At this point, I'm considering breaking down the classroom installation and testing the computer and projector on the bench. Cheers, -- Roger S. Rowlett Professor Department of Chemistry Colgate University 13 Oak Drive Hamilton, NY 13346 tel: (315)-228-7245 ofc: (315)-228-7395 fax: (315)-228-7935 email: rrowl...@colgate.edu -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf___ 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] Fwd: Iterate Script Over States
... This should've gone to the list ... :S TAW -- Forwarded message -- Hi Warren (e.a.), First, as a side note, your first post had 'for state in cmd.count_states():' whereas it seems it should read 'for state in range(cmd.count_states()):'. I find myself doing something similar to Sean now, accumulating coordinates over different frames for each of the atoms. The question is how to do that fastest. At this moment I'm doing the following, which is painstakingly slow (but it works :)). Aside from that it has a nasty hack adding to globals(), as cmd.alter executes in its own scope. class AtomVar: sum = None ssq = None N = None cov = None var = None def __init__( self ): self.sum = [ 0,0,0 ] # x, y, z self.ssq = [ 0,0,0,0,0,0 ] # xx, yy, zz, xy, xz, yz self.N = 0 def inc( self, x ): self.sum = [ self.sum[i] + x[i] for i in range(3) ] squares = [ x[0]*x[0], x[1]*x[1], x[2]*x[2], x[0]*x[1], x[0]*x[2], x[1]*x[2] ] self.ssq = [ self.ssq[i] + squares[i] for i in range(6) ] self.N = self.N + 1 def purge( self ): s = self.sum squares = [ s[0]*s[0], s[1]*s[1], s[2]*s[2], s[0]*s[1], s[0]*s[2], s[1]*s[2] ] self.cov = [ (squares[i] - self.ssq[i]/self.N)/self.N for i in range(6) ] self.var = self.cov[0] + self.cov[1] + self.cov[2] def molVar( sele="all" ): model = cmd.get_model( sele ) globals()["M"] = {} for i in model.atom: M[ i.id ] = AtomVar() for state in range(cmd.count_states()): cmd.iterate_state( state, sele, "M[ ID ].inc( (x,y,z) )" ) for i in M.keys(): M[ i ].purge() cmd.alter( sele, "b = M[ ID ].var" ) Any suggestions are welcome :) Cheers, Tsjerk On Mon, Sep 28, 2009 at 9:05 PM, Warren DeLano wrote: > Sean, > > > > Yes, that is an alternate route. cmd.get_model is likely slower than > cmd.iterate_state, but should work regardless. > > > > Cheers > > Warren > > > > > > From: Sean Law [mailto:magic...@hotmail.com] > Sent: Monday, September 28, 2009 11:58 AM > To: pymol-users@lists.sourceforge.net > Subject: Re: [PyMOL] Iterate Script Over States > > > > I think I figured it out (though, it wasn't documented). What I needed was > to use: > > cmd.get_model(selection, STATE) > > I think that's the correct usage? What I needed was to loop through a > selection and then to calculate the sugar pucker information. However, not > all atoms from the selection are required for the calculation so some > pre-parsing of the residue is needed. It appears that I can specify the > state to obtain atom objects from via the get_model command. I hope that is > right? > > Sean > > > > Create a cool, new character for your Windows Live™ Messenger. Check it out > > -- > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > ___ > 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 > -- Tsjerk A. Wassenaar, Ph.D. Junior UD (post-doc) Biomolecular NMR, Bijvoet Center Utrecht University Padualaan 8 3584 CH Utrecht The Netherlands P: +31-30-2539931 F: +31-30-2537623 -- Tsjerk A. Wassenaar, Ph.D. Junior UD (post-doc) Biomolecular NMR, Bijvoet Center Utrecht University Padualaan 8 3584 CH Utrecht The Netherlands P: +31-30-2539931 F: +31-30-2537623 -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ 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