From: Tsjerk W. <ts...@gm...> - 2013-05-07 07:40:16
|
Hi Bharat, Not exactly a Pymol question, is it? But in case you're using a list of simple vectors as tuples or lists you can easily add them the Python way, provided that the list is not too long (or it'll be slow): vecs = [(a,b,c),(d,e,f),...] v = [sum(i) for i in zip(vecs)] Alternatively, you can use numpy, or use (rosetta.numeric): import numpy arr = numpy.array(vecs) v = arr.sum(axis=0) Hope it helps, Tsjerk On Mon, May 6, 2013 at 9:01 AM, bharat gupta <bha...@gm...>wrote: > Dear Members, > > > I want to know that how can I store a 3d vector in to list , so that I can > add them and final create a single vector out of the list. For eg. > > vec1 = ( 3.281000000000001 -0.02150000000000318 -0.572500000000001 > ) + ( 3.072000000000000 0.03000000000000114 -0.934499999999999) + > (3.003500000000000 0.4934999999999974 -1.14699999999999) > > vec2 = ( -3.496000000000000 -0.7375000000000114 > 0.0164999999999970 ) + (-3.439000000000000 0.1749999999999972 > 0.491999999999997) + (-1.611000000000000 -1.171500000000002 > 2.75350000000000) > > Finally I want to add those single vectors for each vec1 and vec2 to get > two final vectors. These vectors I got from pyrosetta. When I try to append > them to list I get an output like this :- > > [<rosetta.numeric.__numeric_all_at_once_.xyzVector_double object at > 0x0AE068A0>, <rosetta.numeric.__numeric_all_at_once_.xyzVector_double > object at 0x > 0AE068F0>, <rosetta.numeric.__numeric_all_at_once_.xyzVector_double object > at 0x0AE06850>] > > -- > Bharat > > > > > ------------------------------------------------------------------------------ > Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET > Get 100% visibility into your production application - at no cost. > Code-level diagnostics for performance bottlenecks with <2% overhead > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap1 > _______________________________________________ > PyMOL-users mailing list (PyM...@li...) > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users > Archives: http://www.mail-archive.com/pym...@li... > -- Tsjerk A. Wassenaar, Ph.D. |