From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Nov 01 2011 - 16:50:51 CDT

On Tue, Nov 1, 2011 at 4:46 PM, Casey Johnson <j.casey.johnson_at_gmail.com> wrote:
> Hello,
>
> I'm wondering if it's possible to determine if a specific residue is found
> (via tcl script) without using atomselect.  Currently I'm doing this:

yes, anything that looks at per atom properties (and residue name
is one of them) to go through an atom selection unless it is a code
that has direct access to internal VMD data structures.

> if {[[atomselect top "resname NAME"] num] == 0}
>
> Is there a more refined method?

the biggest issue here is that this may easily lead to memory leaks.
i strongly recommend to not use atom selections without assigning
them to a variable and explicitly deleting them.

if you worry about needing to search the same system multiple
times, than you can try using a cache list. i.e. create an
atom selection, query it for the residue name and then sort/uniq
the list to have only a list of unique residue names and keep this
list around for processing with lsearch, which should be much
faster than repeatedly creating an atom selection (not to mention
the savings in memory, if this would be in a long/nested loop.

cheers,
    axel.

>
> Thanks
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.