From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Feb 29 2012 - 16:56:31 CST

On Wed, Feb 29, 2012 at 5:09 PM, Ajasja Ljubetič
<ajasja.ljubetic_at_gmail.com> wrote:
> Hi,
>
> Also, I think there is no need to create a new atom selection for each frame
> (actually you create  $molnumb atomselections for each frame, which is even
> worse). At the very least you have to free the atom selection using
> $mol_select  delete or you might run out of memory.
>
> Much better would be to create the atomselection(s) outside the loop and
> then update the slection using
> $mol_select frame $i
> $mol_select update

even better / faster is to leave out the "update".
this only needs to be done for selections that
change over time. segid and resid are stored
globally and thus don't change.

cheers,
     axel.

>
> Best regards,
> Ajasja
>
>
> On Wed, Feb 29, 2012 at 21:05, John Stone <johns_at_ks.uiuc.edu> wrote:
>>
>>
>> Hi,
>>  This command is incorrect, and is the most likely source of your error:
>> set coordz [$centmas get z]
>>
>> Your $centmas variable is not an atom selection, but rather a vector,
>> therefore this can't work the way you have written it.
>> You would need to change that to something like this:
>> set coordz [lindex $centmas 2]
>>
>> It would also help others read your script if you indented the code
>> rather than writing it all starting in column zero...
>>
>> Cheers,
>>  John Stone
>>  vmd_at_ks.uiuc.edu
>>
>> On Wed, Feb 29, 2012 at 08:51:58PM +0100, vladanstefanovic_at_kg.ac.rs wrote:
>> > Hello VMD users,
>> >
>> > I'm trying to calculate adsorption of molecules of glucose on silica
>> > nanochannel wall.
>> > I need to know how many molecules are adsorbed on the surface of the
>> > silicate wall-SiO2 per time.
>> > I made VMD Tk console script to count for each frame all molecules that
>> > have coord z under min value of molecules distance from the wall; and
>> > put
>> > the total number of those molecules into the array consisting of
>> > molecules
>> > number for each frame.
>> > The script doesn't work and I don't know why?
>> >
>> > set frmnum [molinfo top get numframes]
>> > set layer_min 17.64
>> > set molnumb 29
>> > set counter 0
>> >
>> > set file_out [open Adsorption.dat w]
>> >
>> > for {set i 0} {$i < $frmnum} {incr i} {
>> > for {set j 1} {$j <= $molnumb} {incr j} {
>> >
>> > set mol_select [atomselect top "segid GLUB and resid $j"]
>> > $mol_select frame $i
>> > set centmas [measure center $mol_select weight mass]
>> > set coordz [$centmas get z]
>> >
>> > if {$coordz <= $layer_min} {
>> > incr counter
>> > }
>> > }
>> > set array($i.r) $counter
>> > puts $file_out "$array($i.r)"
>> >
>> > set counter 0
>> > }
>> > close $file_out
>> >
>> > After I start the script it shows message: "invalid command name" then
>> > some three numbers and stops working.
>> > Can somebody please explane to me, why it doesn't work and what would be
>> > the best solution.
>> >
>> > Best greetings,
>> > Vlada
>> >
>> >
>>
>> --
>> NIH Resource 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/           Phone: 217-244-3349
>> http://www.ks.uiuc.edu/Research/vmd/       Fax: 217-244-6078
>
>

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