VMD-L Mailing List
From: Jerome Henin (jhenin_at_cmm.chem.upenn.edu)
Date: Fri Dec 08 2006 - 10:08:32 CST
- Next message: Olaf Lenz: "Problem solved (was: Re: Unable to compile plugins on MACOSXX86)"
- Previous message: Olaf Lenz: "Unable to compile plugins on MACOSXX86"
- In reply to: Nels Thorsteinson: "problem/bug? calling hbonds within a loop over the residues (tcl)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi Nels,
For free, a golden rule of problem reporting: do not use the word 'bug' (even
with a question mark) unless you are pretty much sure about there being
one :-)
Back to your problem: it should work if you replace the curly braces around
the selection text with double quotes. The curly braces prevent Tcl from
performing variable substitution. You will then have to escape the double
quotes inside the string: "residue $res and name \"N.*\" \"O.*\" \"S.*\""
Cheers,
Jerome
On Thursday 07 December 2006 18:31, Nels Thorsteinson wrote:
> hello,
>
> I load a trajectory, then for each frame, I loop through each residue and
> call "measure hbonds" in order to get the hydrogen bonds for each residue.
> Everything works fine with these atom selections:
>
> set selection1 [atomselect top "residue $res" frame 1]
> set selection2 [atomselect top "protein and not residue $res" frame 1]
>
> where $res is the current residue number.
>
> The problem is that these selections return way too many hydrogen bonds
> because all atoms are considered. So then I tried limiting the atoms to O
> N and S.
>
> set selection1 [atomselect top {residue $res and (name "N.*" "O.*" "S.*")}
> frame $i] set selection2 [atomselect top {protein and not residue $res and
> (name "N.*" "O.*" "S.*")} frame $i]
>
> These selections are fine in and of themselves but when I use them in a
> loop over the residues, I witness some bug-like behavior. The atom
> selections do not get updated when the residue number $res is updated in
> the loop. The hydrogen bonds returned are always those from having $res=0
> even when $res=56,57 etc. as I loop through the residues.
>
> Here is the code:
>
>
> set res_list [atomselect top "all and name CA"]
> set resi [lsort -unique -integer [$res_list get residue]]
> $res_list delete
>
> for {set i $start_frame} {$i < $end_frame} {incr i 1} {
>
> set energy 0.0
>
> foreach res $resi {
>
> set selection1 [atomselect top {residue $res and (name "N.*" "O.*"
> "S.*")} frame $i] set selection2 [atomselect top {protein and not residue
> $res and (name "N.*" "O.*" "S.*")} frame $i] set hbonds [measure hbonds 4.5
> 45 $selection1 $selection2 ] $selection1 delete
> $selection2 delete
>
> if {$i==$start_frame} {
> puts "residue $res"
> puts "$hbonds"
> }
> }
> }
>
>
> The puts "$hbonds" is always the same even though $res is always being
> updated
>
> Thanks in advance for any help,
> Nels
>
> ---------------------------------------------------------------------------
>- Nels Thorsteinson, UBC Bioinformatics
> Graduate Student
> CIHR Bioinformatics Training Program for Health Research
> ---------------------------------------------------------------------------
>-
- Next message: Olaf Lenz: "Problem solved (was: Re: Unable to compile plugins on MACOSXX86)"
- Previous message: Olaf Lenz: "Unable to compile plugins on MACOSXX86"
- In reply to: Nels Thorsteinson: "problem/bug? calling hbonds within a loop over the residues (tcl)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]