From: Roni Saiba (
Date: Sat Jun 19 2021 - 11:21:25 CDT

Dear Joaquim,
Thanks for your reply. Instead of molinfo top set frame $i, I used the
animate goto $i command to change to a specific frame. This solved the
issue of secondary structure not updating every frame. ssrecalc is
also computationally less intensive compared to reanalyze so I changed
the command for that bit as well. Thanks once again.
Roni Saiba

Quoting Joaquim Rui de Castro Rodrigues <>:

> Dear Roni,
> Try entering the following command inside the loop, after "set helix 0":
> molinfo top set frame $i
> Also, "mol ssrecalc" should suffice instead of "mol reanalyze"...
> Hope this helps,
> Rui Rodrigues
> ________________________________
> De: <> em nome de
> Roni Saiba <>
> Enviado: 19 de junho de 2021 03:09
> Para: vmd-l <>
> Assunto: vmd-l: Measure helicity at each frame
> I am trying to write a tcl script to measure percentage helicity at
> each frame of a VMD .dcd trajectory. I found the following discussion
> on the VMD mailing list:
> "to calculate the secondary structure for a selection at a given
> timestep, you should go to that timestep, and the use the command mol
> reanalyze top which runs that timestep through stride (among other
> things). Once this is done, you can access the secondary structure of
> an atomselect object with $sel get structure"
> I have tried to implement it as follows,
> set outfile [open ./percent_helix.dat w]
> set lookup {H G I}
> set frame_num [molinfo top get numframes]
> set full [atomselect top "name CA"]
> set len [llength [$full get resid]]
> for {set i 0} {$i < $frame_num} {incr i} {
> set helix 0
> $full frame i
> $full update
> mol reanalyze top
> set struc_string [$full get structure]
> foreach letter $lookup {
> set temp [expr {[llength [split $struc_string $letter]] - 1}]
> incr helix $temp
> }
> set percent [expr {double($helix) / double($len) * 100}]
> puts $outfile "$i\t$percent"
> }
> $full delete
> close $outfile
> However, the output i am the same percentage value at each timestep. I
> have figured that the reason behind that is the command mol reanalyze
> top is not changing the secondary structure values at each frame. What
> should I correct in my script?
> Regards,
> Roni Saiba