VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Oct 18 2006 - 12:58:30 CDT
- Next message: John Stone: "Re: Using VMDPLUGIN_register_tcl"
- Previous message: Vlad Cojocaru: "retrieving the center of mass for each frame of trajectory"
- In reply to: Vlad Cojocaru: "retrieving the center of mass for each frame of trajectory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Vlad,
You need to fix a couple of problems with that script.
The version you posted creates a new selection at each frame, which is
very slow, and unnecessary unless you're fundamentally changing what
is selected for each frame. In general, you want to use '$sel update'
for position-based selections (faster than re-creating from scratch), or
'$sel frame' for the simplest case (the one below) where the selected atoms
remain constant, and you're just stepping through frames.
Your original script also leaked selections, since they were not being
deleted within the loop. I wasn't sure why you placed the extra braces
around your variables, as that shouldn't be necessary, but I've left those
parts as you wrote them.
Try this version instead (or something like it):
set numframes [molinfo 0 get numframes]
set ref [atomselect 0 "resid ${resid_ref}"]
for {set frame 0} {${frame} < ${numframes}} {incr frame} {
$ref frame $frame
set com_ref [measure center ${ref} weight mass]
}
$ref delete
Cheers,
John Stone
vmd_at_ks.uiuc.edu
On Wed, Oct 18, 2006 at 07:35:14PM +0200, Vlad Cojocaru wrote:
> Dear vmd users,
>
> I am trying to retrieve the center of mass of a residue during a
> trajectory. However, the script below will give me only the CoM for the
> last frame. Is there a way to modify this script such as to retrieve the
> CoM for each frame?
>
> Thanks
>
> Best
> vlad
>
> set numframes [molinfo 0 get numframes]
> for {set frame 0} {${frame} < ${numframes}} {incr frame} {
> set ref [atomselect 0 "resid ${resid_ref}" frame ${frame}]
> set com_ref [measure center ${ref} weight mass]
> }
>
> --
> Dr. Vlad Cojocaru
> EML Research gGmbH
> Molecular and Cellular Modeling Group
> Schloss-Wolfsbrunnenweg 33
> 69118 Heidelberg, Germany
> Phone: +49-6221-533266
> Fax: +49-6221-533298
> e-mail: Vlad.Cojocaru_at_eml-r.villa-bosch.de
> http://projects.villa-bosch.de/mcm/people/cojocaru/
>
-- NIH Resource for Macromolecular Modeling and Bioinformatics Beckman Institute for Advanced Science and Technology University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 Email: johns_at_ks.uiuc.edu Phone: 217-244-3349 WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
- Next message: John Stone: "Re: Using VMDPLUGIN_register_tcl"
- Previous message: Vlad Cojocaru: "retrieving the center of mass for each frame of trajectory"
- In reply to: Vlad Cojocaru: "retrieving the center of mass for each frame of trajectory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]