From: Bernardo Sosa Padilla Araujo (bernardospa_at_gmail.com)
Date: Tue Mar 02 2010 - 14:15:42 CST

Sorry.
I found a previous discussion in the list regarding the same problem:

http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/9545.html

2010/3/2 Edelmiro Moman <edelmiro.moman_at_gmail.com>

> I would be great if you let us know...
>
>
> On Tue, Mar 2, 2010 at 7:33 PM, Bernardo Sosa Padilla Araujo
> <bernardospa_at_gmail.com> wrote:
> > Never mind. I found out what the problem was.
> >
> >
> >
> > 2010/3/1 Bernardo Sosa Padilla Araujo <bernardospa_at_gmail.com>
> >>
> >> Hi all,
> >>
> >> I am trying to write a script to measure the distance between a few
> atoms
> >> for a simulation and write that in a file.
> >> Here is my script:
> >>
> >> =================================================
> >> #opening files to write
> >> set dist1 [open dist1.dat w]
> >> set dist2 [open dist2.dat w]
> >> #getting number of frames
> >> set nf [molinfo top get numframes]
> >> #selecting the atoms
> >> set sub [atomselect top "name H4"]
> >> set base1 [atomselect top "name OE1 and within 6 of name H4"]
> >> set base2 [atomselect top "name OE2 and within 6 of name H4"]
> >> #creating variables with the index from the previous selection
> >> set hydr [$sub get index]
> >> set ox1 [$base1 get index]
> >> set ox2 [$base2 get index]
> >> #outputting the measurements
> >> set a {}
> >> set b {}
> >> for { set i 0} { $i <=$nf } {incr i} {
> >> lappend a [measure bond {$ox1 $hydr} frame $i]
> >> lappend b [measure bond {$ox2 $hydr} frame $i]
> >> }
> >> puts $dist1 "$a"
> >> close $dist1
> >> puts $dist2 "$b"
> >> close $dist2
> >> =================================================
> >>
> >> So, I select three atoms and then from those selections I create 3
> >> different variables (hydr, ox1 and ox2) that hold the indexes for the
> three
> >> atoms(red text).
> >> Then I use the measure command to measure the distances between the
> >> atoms(green text).
> >> The measure command should be used:
> >> measure bond {atomid1 atomid2} ex : measure bond {3 5}
> >> What I am doing is to put the name of the variable that holds the
> atomids
> >> instead of putting the number. And it is not working at all, it gives
> this
> >> error message "expected integer but got $ox1 measure bond: bad atom
> index".
> >> But when I put the numbers (instead of the name of the variables that
> hold
> >> the numbers) it works just fine.
> >> Then my question is if you see any mistake in the script that could be
> >> producing this error or if anyone knows of a different way to do it.
> >> Thanks a lot in advance.
> >>
> >> Bernardo
> >>
> >>
> >
> >
>
>
>
> --
> Edelmiro Moman, PhD
> ProSciens, Computing & Molecular Sciences
> 2 rue du Palais de Justice
> L-1841 Luxembourg
>
> Phone: +352 2728 2588
> E-mail: edelmiro.moman_at_gmail.com
> E-mail: moman_at_prosciens.com
> Website: http://www.edelmiromoman.eu/
> Website: http://www.prosciens.com/
>