From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Feb 29 2012 - 14:05:21 CST

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