From: Joaquim Rui de Castro Rodrigues (joaquim.rodrigues_at_ipleiria.pt)
Date: Sat Oct 13 2012 - 14:38:36 CDT

Hi Brian,

Check this link:
http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/11074.html

The following sequence of commands (in that order) inside the for loop should do the job:
animate goto $i
display update ui
mol ssrecalc 0
$protCA frame $i
$protCA update
Regarding lsearch, it works as it should. See:
http://www.tcl.tk/man/tcl8.4/TclCmd/lsearch.htm
It returns the (0-based) index of the first matching element in the list, which may correspond to vmd's "residue".

HTH,
Rui Rodrigues

________________________________
De: owner-vmd-l_at_ks.uiuc.edu [owner-vmd-l_at_ks.uiuc.edu] Em Nome De Bennion, Brian [Bennion1_at_llnl.gov]
Enviado: sexta-feira, 12 de Outubro de 2012 17:27
Para: vmd-l_at_ks.uiuc.edu
Assunto: RE: vmd-l: secondary structure calculations

I appreciate the responses from Rui and Chris. The basis for my little script was the sscache script found in the vmd script library. At least as it was written many years ago, vmd_calculate_structure should have been able to calculate the sec structure for the current frame and that information was then stored.

For some reason my keyword search was insufficient to find the mol ssrecalc command. Thank you. I have incorporated it into the script.

echo $sscache_data(0) will return a array populated with single characters.
echo $sscache_data(60) will return a slightly different set of single characters.

for some reason that I don't understand lsearch $sscache_data(0) H will return the RESIDUE/RESID of the first H stored in the array. the -all switch will return what also appears to be the RESIDUE/RESID of all the H elements in the sscache_data array.

Even accounting for this behaviour using llength, it does not seem that the secondary structure information is being updated with each frame. I have double checked it with the timeline plugin and do see variation in the number of residues classified as Helical, or beta.

Brian

puts "Getting secondary structure information"
set fd [open "sec_structure.dat" w ]
set n [molinfo 0 get numframes]
set protCA [atomselect 0 "protein name CA"]
set numRes [llength [$protCA get resid]]
for {set i 0 } { $i < $n } { incr i } {
$protCA frame $i
$protCA update
#vmd_calculate_structure 0
mol ssrecalc 0
set sscache_data($i) [$protCA get structure]
set helix [llength [lsearch -all $sscache_data($i) H ]]
set beta [llength [lsearch -all $sscache_data($i) B ]]
puts "this is number of helix and beta resids: $helix $beta"
set helixPercent [expr { [llength [lsearch -all $sscache_data($i) H ]] / double($numRes)}]
set betaPercent [expr { [llength [lsearch -all $sscache_data($i) B ]] / double($numRes)}]
puts "betapercent $betaPercent"
puts "helixpercent $helixPercent"
lappend ThelixPercent $helixPercent
lappend TbetaPercent $betaPercent
puts $fd $sscache_data($i)
puts "Structure: $i"
}
close $fd
$protCA delete
write_vector $ThelixPercent helixPercent.plt
write_vector $TbetaPercent betaPercent.plt

________________________________
From: Mayne, Christopher G [cmayne2_at_illinois.edu]
Sent: Thursday, October 11, 2012 5:37 PM
To: Bennion, Brian
Cc: vmd-l_at_ks.uiuc.edu
Subject: Re: vmd-l: secondary structure calculations

You have to explicitly tell VMD to recalculate the secondary structure. I believe what you are looking for is:

 ssrecalc <molid> -- Recalculate secondary structure (Cartoon)

this also might be helpful:
http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/10995.htm

Chris

On Oct 11, 2012, at 6:16 PM, Bennion, Brian wrote:

Hello,

I am just looking for a quick way to output the secondary structure as given by vmd_calculate_structure

The script I am using is below. What I get is the same structure determination for frames that span 6 ns. Each frame is identical to the last. I know my protein isn't that stable, but maybe I am not using the output from the vmd_calculate_structure command correctly.
The output from this script is below.

puts "Getting secondary structure information"
set fd [open "sec_structure.dat" w ]
set n [molinfo 0 get numframes]
set protCA [atomselect 0 "protein name CA"]
set numRes [llength [$protCA get resid]]
for {set i 0 } { $i < $n } { incr i } {
$protCA frame $i
$protCA update
vmd_calculate_structure 0
set sscache_data($i) [$protCA get structure]a
set helixPercent [expr { [lsearch $sscache_data($i) H]/ double($numRes)}]
set betaPercent [expr { [lsearch $sscache_data($i) B]/ double($numRes)}]
puts "betapercent $betaPercent"
puts "helixpercent $helixPercent"
puts $fd $sscache_data($i)
puts "Structure: $i"
}
close $fd
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 0
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 1
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 2
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 3
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 4
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 5
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 6
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 7
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 8
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 9
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 10
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 11
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 12
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 13
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 14
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 15
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 16
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 17
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 18
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 19
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 20
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 21
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 22
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 23
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 24
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 25
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 26
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 27
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 28
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 29
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 30
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 31
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 32
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 33
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 34
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 35
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 36
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 37
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 38
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 39
betapercent 0.06839186691312385
helixpercent 0.15157116451016636
Structure: 40