From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Thu May 26 2016 - 13:14:36 CDT

Well, I'm not actually sure what the default behavior is for which frame
gets picked if its not specified in the selection command. Is it the
current frame? Is it the last frame? Is it the first frame? If it picks
the current frame, the two loops should give identical results. Since
they don't, it must be one of the other two options, and that lesson
must be the reason why I've only ever seen it done the $sel frame then
$sel update way.

-Josh

On 05/26/2016 12:11 PM, Chitrak Gupta wrote:
> Hi Josh,
>
> Thanks a lot for the explanation. Could you clarify a bit on what you
> meant by "doesn't depend on any default behavior for which frame gets
> selected"?
>
> On Thu, May 26, 2016 at 7:46 AM, Josh Vermaas <vermaas2_at_illinois.edu
> <mailto:vermaas2_at_illinois.edu>> wrote:
>
> Hi Chitrak,
>
> The first one would be the one I recommend, as its the loop form I
> tend to use. It doesn't need the $sel delete statement to avoid
> leaking memory, and doesn't depend on any default behavior for
> which frame gets selected. The second loop could have something like:
>
> set sel [atomselect top "?? condition ??" frame $i]
>
> as well, which would technically make for shorter code, but in
> this case it might be a useful way of double checking that the
> second loop variant gives incorrect results.*
>
> *-Josh
> *
> *
> On 05/25/2016 09:05 PM, Chitrak Gupta wrote:
>> Oops, don't know how that happened. Thanks for pointing this out.
>>
>> So here is my question. What is the difference between the
>> following two ways?
>>
>> ...
>> set sel [atomselect top "?? condition ??"]
>> for {set i 0} {$i < $nf} {incr i 1} {
>> $sel frame $i
>> $sel update
>> ...
>> }
>>
>> As opposed to
>>
>> ...
>> for {set i 0} {$i < $nf} {incr i 1} {
>> molinfo top set frame $i
>> set sel [atomselect top "?? condition ??"]
>> ...
>> }
>>
>>
>> I am trying to look for choline Nitrogens within a specific
>> distance of aromatic side chains, and I am getting different
>> results based on these two methods.
>>
>>
>> Regards,
>> Chitrak
>>
>> On Wed, May 25, 2016 at 10:52 PM, John Stone <johns_at_ks.uiuc.edu
>> <mailto:johns_at_ks.uiuc.edu>> wrote:
>>
>> I'm afraid your email appears to have been truncated, and thus
>> nobody will be able to answer your question.
>>
>> Cheers,
>> John Stone
>> vmd_at_ks.uiuc.edu <mailto:vmd_at_ks.uiuc.edu>
>>
>> On Wed, May 25, 2016 at 02:07:49PM -0400, Chitrak Gupta wrote:
>> > Hello,
>> >
>> > I have this general question. When scripting in VMD, what
>> is the difference
>> > between the following two ways?
>>
>> --
>> NIH Center for Macromolecular Modeling and Bioinformatics
>> Beckman Institute for Advanced Science and Technology
>> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
>> http://www.ks.uiuc.edu/~johns/
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ks.uiuc.edu_-7Ejohns_&d=CwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=zFfoK61upjM5BwyoRAsX8dLq7rwWm8aw7r7dqtjgcCE&m=lFWIxr7A6D2G9K7iKkjOW0Og6DvNtk1VrQUEexIBve8&s=zQmuF6cr_nJ4WNP7OSRtWpQ-6XTHlDinPHN6iCm590Y&e=>
>> Phone: 217-244-3349 <tel:217-244-3349>
>> http://www.ks.uiuc.edu/Research/vmd/
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ks.uiuc.edu_Research_vmd_&d=CwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=zFfoK61upjM5BwyoRAsX8dLq7rwWm8aw7r7dqtjgcCE&m=lFWIxr7A6D2G9K7iKkjOW0Og6DvNtk1VrQUEexIBve8&s=ZM-r0a7aSdcfVGOTtAdCGZ8QI9-AJMnw_m-NFg53FMI&e=>
>>
>>
>
>