From: John Stone (johns_at_ks.uiuc.edu)
Date: Sat Mar 31 2007 - 00:05:17 CDT

Hi,
  What error message do you get?
I suspect you might have a problem with the 'if' statement
that begins on the same line as the 'set psi' without any semicolon.

Also, if you're running this for batch analysis, you're going to
need to replace the deprecated "mol load" command with the new
"mol new" and "mol addfile" commands, in order to guarantee that
the loading completes before your script commences trying to process
the data:

# DON'T use 'mol load' anymore, it will be removed from a future VMD release
mol load parm7 $parm dcd $dcdFile

# Use these commands instead, they have long since replaced 'mol load'
# and are the only way to access various new features that did not exist
# in the old versions of VMD
mol new $parm type parm7 waitfor all
mol addfile $dcd type dcd waitfor all

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Mar 30, 2007 at 03:49:45PM -0400, Jianhui Tian wrote:
> Hi all,
>
> I write a tcl script to calculate the helix content of the peptide.
> But there is a small bug I can't find out myself to make it run
> properly. Can someone help? Thanks a lot.
>
> Jianhui
> ##########################
> set dcdFile n_aka3rm14w6_run10.dcd ;# name of your psf file
>
> set parm aka3rm14w6.prmtop ;# name of parm file
>
> set incrm 1
> ##########################
> mol load parm7 $parm dcd $dcdFile
>
> set num_steps [molinfo top get numframes]
> puts $num_steps
> set out [open helixcontent.dat w]
>
> for {set frme 1} {$frme <= $num_steps} {incr frme $incrm} {
> puts $frme
>
> set hlxflag 0
> set hlxcont 0
>
> ###### From resid 125 to 148 is amino acid.
> for {set i 125} {$i <= 148 } { incr i} {
> set atom [atomselect top "protein and name CA and resid $i"]
> $atom frame $frme
>
> set phi [$atom get phi]
> set psi [$atom get psi] if { $phi <= -30 && $phi >= -90
> && $psi <= -17 && $psi >= -77 } {
> if {$hlxflag == 0} {
> set num 1
> set hlxflag 1
> } elseif {$hlxflag == 1} {
> set num [expr $num + 1]
> }
> } else {
> if {$hlxflag == 1} {
> set hlxflag 0
> if { $num > 2 } { set hlxcont [expr $num - 2]
> }
> }
>
> $atom delete
> }
> set cont [expr $hlxcont / 24]
> puts $out "$frme $cont"
> }
> exit

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078