From: andrea spitaleri (spitaleri.andrea_at_hsr.it)
Date: Fri Nov 18 2005 - 05:31:21 CST

Hi Nuno,
yes I got it... (a bit stubborn). In fact the problem is the molID. Your
suggestion works and I just changed :
for { set j 2 } { $j < 100 } { incr j } {
in
set nex [expr $i+1]
for { set j $nex } { $j < 100 } { incr j } {

I commented the foreach at the end since it stops the loop after the
first iteration and substitued with $sel1 delete and $sel2 delete

About Luc post,
that's also a good suggestion. thanks.
At end as long as I keep in mind the molID issue any procedure works fine.

Thanks to all, :D

Nuno R. L. Ferreira wrote:

> Hi Andrea
>
> IMHO, I think the problem is not on tcl, but on how vmd deals with the
> id number of the loaded .pdb's.
> When you load pro_1.pdb, it's id will be 0 (first loop). When you load
> the first molecule on loop 2 (pro_2.pdb), this molecule will have id 1
> under vmd (ID1 = 1, and will loop till ID1 = 98, pro_99.pdb). Then
> you go again to the 1st loop, working with the second element
> (pro_2.pdb), which will receive the id 1 (accordingly to your script).
> You need to delete the molecule that resides in id 1 (which is
> pro_2.pdb) before you load another molecule into it. Without deleting
> it, you are concatenating .pdbs to the same id. For that, use: mol
> delete $ID. The same for ID1.
>
> set outfile [open rmsd.dat w]
> # 1st Loop
> for {set i 1} {$i < 100} {incr i} {
> mol load pdb pro_$i.pdb
> set ID [expr $i-1]
> set sel1 [atomselect $ID "protein and backbone"]
> set lig1 [atomselect $ID "segid B"]
> # 2nd Loop
> for { set j 2 } { $j < 100 } { incr j } {
> mol load pdb pro_$j.pdb
> set ID1 [expr $j-1]
> set sel2 [atomselect $ID1 "protein and backbone"]
> set lig2 [atomselect $ID1 "segid B"]
> set all [atomselect $ID1 all]
> $all move [measure fit $sel2 $sel1]
> set rmsd [measure rmsd $lig2 $lig1]
> puts "RMSD of $i and $j is $rmsd"
> puts $outfile "RMSD of $i and $j is $rmsd"
> puts "Done"
> }
> set mol_list [molinfo list]
> foreach mol $mol_list {mol delete $mol} ;# this shoul delete all
> your molecules inside vmd
> }
> Best regards,
> Nuno
>
> ----- Original Message -----
> *From:* andrea spitaleri <mailto:spitaleri.andrea_at_hsr.it>
> *To:* vmd-l_at_ks.uiuc.edu <mailto:vmd-l_at_ks.uiuc.edu>
> *Sent:* Friday, November 18, 2005 9:42 AM
> *Subject:* Re: vmd-l: calculate rmsd in a loop:feedback [sorry if
> you get it twice]
>
> Hi,
> thanks to all for the precious help. My problem is that I don't
> know tcl .... (prefer python/perl)
> Anyway, this below works fine but it does only the rmsd
> calculation for the first pro_1.pdb with the rest of the files.
>
>set outfile [open rmsd.dat w]
>mol load pdb pro_1.pdb
>set sel1 [atomselect 0 "protein and backbone"]
>set lig1 [atomselect 0 "segid B"]
>for { set j 2 } { $j < 100 } { incr j } {
> mol load pdb pro_$j.pdb
> set ID1 [expr $j-1]
> set sel2 [atomselect $ID1 "protein and backbone"]
> set lig2 [atomselect $ID1 "segid B"]
> set all [atomselect $ID1 all]
> $all move [measure fit $sel2 $sel1]
> set rmsd [measure rmsd $lig2 $lig1]
> puts "RMSD of 1 and $j is $rmsd"
> puts $outfile "RMSD of 1 and $j is $rmsd"
> puts Done
>}
>
> In fact, if I use another loop to compare pro_2.pdb with rest and
> so on, vmd or tcl or whatsoever obscure to me does not go inside
> of the second loop (Loop 2) and I don't know why:
>
>set outfile [open rmsd.dat w]
># 1st Loop
>for {set i 1} {$i < 100} {incr i} {
> mol load pdb pro_$i.pdb
> set ID [expr $i-1]
> set sel1 [atomselect $ID "protein and backbone"]
> set lig1 [atomselect $ID "segid B"]
># 2nd Loop
> for { set j 2 } { $j < 100 } { incr j } {
> mol load pdb pro_$j.pdb
> set ID1 [expr $j-1]
> set sel2 [atomselect $ID1 "protein and backbone"]
> set lig2 [atomselect $ID1 "segid B"]
> set all [atomselect $ID1 all]
> $all move [measure fit $sel2 $sel1]
> set rmsd [measure rmsd $lig2 $lig1]
> puts "RMSD of $i and $j is $rmsd"
> puts $outfile "RMSD of $i and $j is $rmsd"
> puts "Done"
> }
>}
>
>
> Then, Luis could you send me the procedure how to test your
> plugin? Reading in your web page, it seem working only on
> trajectories, or am I wrong?
>
> Regards,
>
> andrea
>
>--
>
>
> -------------------------------
> Andrea Spitaleri
> Dulbecco Telethon Institute
> c/o DIBIT Scientific Institute
> Biomolecular NMR, 1B4
> Via Olgettina 58
> 20132 Milano (Italy)
> Get Firefox! <http://www.spreadfirefox.com/?q=affiliates&id=0&t=85>
> -------------------------------
>
>
> ------------------------------------------------------------------------
>
> avast! Antivirus <http://www.avast.com>: Inbound message clean.
>
> Virus Database (VPS): 0546-3, 16-11-2005
> Tested on: 18-11-2005 9:48:55
> avast! - copyright (c) 1988-2005 ALWIL Software.
>
>

-- 
-------------------------------
Andrea Spitaleri
Dulbecco Telethon Institute
c/o DIBIT Scientific Institute
Biomolecular NMR, 1B4
Via Olgettina 58
20132 Milano (Italy)
Get Firefox! <http://www.spreadfirefox.com/?q=affiliates&id=0&t=85>
-------------------------------