VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Jan 25 2012 - 09:12:16 CST
- Next message: jeela keel: "atomselect counting"
- Previous message: John Stone: "Re: ionic radii of sodium and chloride"
- In reply to: jeela keel: "atomselect counting"
- Next in thread: jeela keel: "Re: Re: atomselect counting"
- Reply: jeela keel: "Re: Re: atomselect counting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Wed, Jan 25, 2012 at 9:39 AM, jeela keel <jeela22_at_gmail.com> wrote:
> Hello VMD users,
>
> Is possible to count how many of same atomselect is in a list or how many
> times atomselect is selected? Using VMD , selected molecules that are close
> to different parts of protein and selected some molecules more than once and
> want to know how many times the same atomselect is been selected or how many
> of them are in the list per each frame.
>
> for example in frame 1 there are 4 of atomselect2345 (same molecule) and 5
> of atomselect8509 and so on.
your wording is a bit confusing. lets first see whether we are on the same page.
an "atom selection", i.e. the procedure that is created by the
atomselect command,
is in essence a list of atoms that is generated based on a rule (the
selection text).
from what i gather, you are now looking for the *intersection*
of two atom selections, right?
there are multiple ways to do that. for example, create a new
selection that contains
the first selection text combined with the section selection text via
an "and" condition.
if you want to do that in an automated fashion, there should be
something like this:
set selintersect [atomselect top "([$sel1 text]) and ([$sel2 text])"]
you could also write a small proc that computes the intersection of
[$sel1 get index] and [$sel2 get index]. there is an 'intersect' command
in TclX that does this automatically, but VMD does not contain TclX.
it should also be straightforward to write a small proc to do this.
you can write the proc fairly efficiently, since you can rely on the
fact that index lists are always pre-sorted with increasing index.
a good place to look for Tcl script hacks and existing solutions
is the Tcl/Tk wiki at: http://wiki.tcl.tk
axel.
> I have used the command llength and num before that counts how many atoms
> are in a list, but this time I need to count how many times each specific
> atomselect is selected in the same frame. then move to next frame where
> there are different atomselect that again change with next frame.
>
> I am trying to write a script to do the above but I am wondering if there is
> a command that can be useful to use in the script . Did anybody wrote
> something similar to what am trying to do or have any suggestion. Thank you
> for your help and suggestions.
>
> jeela
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 College of Science and Technology Temple University, Philadelphia PA, USA.
- Next message: jeela keel: "atomselect counting"
- Previous message: John Stone: "Re: ionic radii of sodium and chloride"
- In reply to: jeela keel: "atomselect counting"
- Next in thread: jeela keel: "Re: Re: atomselect counting"
- Reply: jeela keel: "Re: Re: atomselect counting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]