[Chimera-users] center of mass for multiple models

Jean Didier Pie Marechal JeanDidier.Marechal at uab.cat
Fri Jul 18 07:44:23 PDT 2008


Hi everyone,

I am stuck with a script and my mistake seems to come from my poor understanding on how to treat atom coordinates with multiple models. I join to this e-mail a chimera file with a simple system to illustrate my problem. 

In the file, I have two indentique phenyl moleculer each of them in different models and I would like to stock the center of mass of both molecules in a list. I wrote this very simple script using the way of calcuting the center of mass you provided me recently. 

import chimera
import BuildStructure
from chimera import runCommand as run
from chimera import selection, Vector
from chimera import openModels, Molecule, Point

#Stock the two fragments in the list FRAG
run("select")
frag=[]
for i in chimera.selection.currentResidues():
    frag.append(i)



#Calculate center of mass of both entities
#stocked in the list MAS
mas=[]
for i in range(len(frag)):
    sum=0
    center = Vector(0, 0, 0)
    for a in frag[i].atoms:
        sum += a.element.mass
        center += a.element.mass * Vector(*a.coord().data())
    mas.append(Point(center[0]/sum,center[1]/sum,center[2]/sum))
    print i,mas[i]

The results I have are 
0 20.0465 70.3735 23.9063
1 20.0465 70.3735 23.9064

Basically, the coordinates of the center of mass are the same? What did I do wrong in the way I treated this problem? 

Thanks a lot for any answer,

All the best
JD


Dr. Jean-Didier Maréchal
Professor Lector
Unitat de Química Física
Departament de Química
Universitat Autònoma de Barcelona
Edifici C.n.
08193 Cerdanyola (Barcelona)
Tel: +34.935814936
e-mail: JeanDidier.Marechal at uab.es

----- Missatge original -----
De: chimera-users-request at cgl.ucsf.edu
Data: Dijous, Juliol 17, 2008 9:00 pm
Assumpte: Chimera-users Digest, Vol 63, Issue 17

> Send Chimera-users mailing list submissions to
> 	chimera-users at cgl.ucsf.edu
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> or, via email, send a message with subject or body 'help' to
> 	chimera-users-request at cgl.ucsf.edu
> 
> You can reach the person managing the list at
> 	chimera-users-owner at cgl.ucsf.edu
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Chimera-users digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Possible image saving bug (Greg Couch)
>   2.  Possible image saving bug (Elaine Meng)
> 
> 
> --------------------------------------------------------------------
> --
> 
> Message: 1
> Date: Thu, 17 Jul 2008 10:35:26 -0700 (PDT)
> From: Greg Couch <gregc at cgl.ucsf.edu>
> Subject: Re: [Chimera-users] Possible image saving bug
> To: Walter Novak <wnovak at brandeis.edu>
> Cc: Chimera forum <chimera-users at cgl.ucsf.edu>
> Message-ID: <Pine.OSF.4.63.0807171001010.1939086 at guanine.cgl.ucsf.edu>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
> 
> On Thu, 17 Jul 2008, Walter Novak wrote:
> 
> > Hi All,
> >
> > I submitted a bug report on this, but the behavior is both odd 
> and 
> > reproducible for me. Using the latest production release and 
> trying to save 
> > an image using supersampling, the image is not stitched back 
> together 
> > appropriately. It is odd, because it always happens for a certain 
> session 
> > file I have. It doesn't seem to happen if I open a new molecule 
> and make a 
> > picture. I can provide the session file if needed. First image is 
> using 3x3 
> > and second is 6x6.
> 
> I see from the bug report that you're using Mac OS X 10.5.  We are 
> having 
> "issues" with the new X11 application in 10.5.  And we have seen 
> that 
> slightly different X11 applications are installed on otherwise 
> identical 
> Macs and that reinstalling from the Mac OS X Install Disk fixed a 
> non-chimera bug.
> 
> Also, I have read on the web that if you install the 10.4 X11 
> application 
> on 10.5, then OpenGL applications will work better.  Since that is 
> not an 
> option for everyone, we are spending more time to improve the Aqua 
> version 
> that is available as a Snapshot release on the chimera download 
> page.  It 
> has different bugs, but the graphics is better.  So you should try 
> it out 
> and see how well it works for you.
> 
> 	Greg Couch
> 	UCSF Computer Graphics Lab
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Thu, 17 Jul 2008 10:40:13 -0700
> From: Elaine Meng <meng at cgl.ucsf.edu>
> Subject: [Chimera-users]  Possible image saving bug
> To: wnovak at brandeis.edu
> Cc: Chimera BB <chimera-users at cgl.ucsf.edu>
> Message-ID: <B15630DD-299C-4B48-A8B4-469FA8995872 at cgl.ucsf.edu>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
> 
> Hi Wally,
> I also had this tiling problem.  We think it may be something about 
> 
> X11 in Mac OS 10.5 (possibly just 10.5.4), as the problem has not 
> been  
> observed with 10.4/X11.
> 
> Two workarounds that were successful in my case (I don't know if 
> they  
> will fix all instances of the problem):
> 
> (A) simply show the Command Line before saving the image.  I tried  
> hiding it again after that, but then the problem reoccurred, albeit 
> in  
> a more subtle fashion.
> 
> (B) save the session, restore it in the aqua version of Chimera 
> (still  
> on Mac OS 10.5.4 but not using X11) and save the image.  Yeah, (A) 
> is  
> easier, but I didn't discover that one until this morning, after  
> receiving your mail.
> 
> I hope these solutions are general!  Sorry about the inconvenience,
> Elaine
> -----
> Elaine C. Meng, Ph.D.                          meng at cgl.ucsf.edu
> UCSF Computer Graphics Lab and Babbitt Lab
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>                      http://www.cgl.ucsf.edu/home/meng/index.html
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
> 
> 
> End of Chimera-users Digest, Vol 63, Issue 17
> *********************************************
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2phe.py
Type: text/x-python
Size: 19257 bytes
Desc: not available
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20080718/900949a6/attachment.py>


More information about the Chimera-users mailing list