From: Jérôme Hénin (jhenin_at_ifr88.cnrs-mrs.fr)
Date: Thu Nov 18 2010 - 08:07:24 CST

Hi Sergio,

Your script is fairly long. Can you try shortening it until you find
the smallest possible script that exhibits the problem?

Best,
Jerome

On 18 November 2010 14:12, Alberto Sergio Garay <sgaray_at_fbcb.unl.edu.ar> wrote:
> Hi all
>
> I'm running a tcl script to calculate a frequency of thymine piling up
> during a MD simulation. When I load the trajectory in VMD (graphical mode)
> and then run the script, everything is OK, but when I try to run vmd without
> open the graphical environment, the trajectory starts to be loaded, but
> after some time, it gives me the message: killed.
>
> my script includes the directive waitfor all
>
> Could anyone give a clue about this problem? What am I doing wrong?
> Why the script works well under the graphical environment and not in command
> line?
>
> Below I paste the script
>
> mol new run_completo.gro
> mol addfile run_completo.xtc steps 1 waitfor all
>
> #Enter the name for the output file
> set filename1 "file_out.dat"
>
> #Distance cutoff between thymine rings
> set dist_cutoff 5.0
>
> set PI 3.14159265358979
>
> #Angle between normal vectors of close (within dist_cutoff distance) thymine
> rings
> set angle_cutoff 20.0
>
> #Extract frames from file
> set num_steps [expr [molinfo top get numframes] - 1]
>
> #Open files for writing
> set out [open $filename1 w]
>
> #Making an array of list of resids
> for {set j 1} {$j <= 16} {incr j} {
>        set r($j) {}
>        set Center($j) 0.0
>        #array over each atom selected
>        for {set k 1} {$k <=4} {incr k} {
>                set at($j,$k) {}
>        }
> }
>
> #Making an array of residues' piling ups
> for {set i 1} {$i <= 16} {incr i} {
>        for {set j 1} {$j <= 16} {incr j} {
>                set Pile($i,$j) 0
>        }
> }
>
> #Making selections
> set sel1 [atomselect top "resid 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32
> and name CT2 NT1 NT2 CT5"]
>
> for {set frame 1} {$frame <= $num_steps} {incr frame} {
> $sel1 frame $frame
> $sel1 update
>
> puts "frame: $frame"
>
> #making a list of at. names and coordinates
> set at_names [$sel1 get name]
> set coords [$sel1 get {x y z}]
>
>        for {set i 1} {$i <= 16} {incr i} {
>                #Assign the first 4 elements of the list to a residue
>                set r($i) [lrange $coords 0 3]
>                #then delete the 4 first elements of the list
>                set coords [lreplace $coords 0 3]
>                #summing over resids
>                set Sum {0 0 0}
>                set at_idx 0
>                foreach b $r($i) {
>                        set at_idx [expr $at_idx + 1]
>                        set Sum [vecadd $Sum $b]
>                        set at($i,$at_idx) $b
>                }
>                set Center($i) [vecscale [expr 1.0 / 4] $Sum]
>                #puts "Center($i): $Center($i)"
>        }
>
>
>        for {set i 1} {$i <= 16} {incr i} {
>                for {set j 16} {$j > $i} {incr j -1} {
>                        set dist [veclength [vecsub $Center($i) $Center($j)]]
>                        if {$dist <= $dist_cutoff} {
>                                puts "dist: $dist"
>                                set v1 [vecnorm [vecsub $at($i,1) $at($i,2)]]
>
>                                set v2 [vecnorm [vecsub $at($i,3) $at($i,2)]]
>                                set N1 [veccross $v1 $v2]
>
>                                ####################################
>                                set v3 [vecnorm [vecsub $at($j,1) $at($j,2)]]
>                                set v4 [vecnorm [vecsub $at($j,3) $at($j,2)]]
>                                set N2 [veccross $v3 $v4]
>
>                                ######################################
>                                set angle [expr 180 - (acos([vecdot $N1 $N2])
> * 180 / $PI)]
>                                puts "angle: $angle"
>                                if {$angle <= $angle_cutoff} {
>                                        set Pile($i,$j) [expr $Pile($i,$j) +
> 1.0]
>                                        puts "Pile($i,$j): $Pile($i,$j)"
>                                }
>                                if {$angle >= [expr 180 -$angle_cutoff]} {
>                                        set Pile($i,$j) [expr $Pile($i,$j) +
> 1.0]
>                                        puts "Pile($i,$j): $Pile($i,$j)"
>                                }
>                        }
>                }
>        }
> }
> #Normalizing by the number of frames
> #Making an array of residues' piling ups
> for {set i 1} {$i <= 16} {incr i} {
>        for {set j 1} {$j <= 16} {incr j} {
>                #puts "Pile($i,$j): $Pile($i,$j) --> num_steps: $num_steps"
>                set Pile($i,$j) [expr ($Pile($i,$j) * 1.0) / $num_steps]
>                puts "Pile($i,$j) after normalization: $Pile($i,$j)"
>        }
> }
> #writing the matrix of interations
> for {set j 1} {$j <= 16} {incr j} {
> puts $out "$Pile($j,1) $Pile($j,2) $Pile($j,3) $Pile($j,4) $Pile($j,5)
> $Pile($j,6) $Pile($j,7) $Pile($j,8) $Pile($j,9) $Pile($j,10) $Pile($j,11)
> $Pile($j,12) $Pile($j,13) $Pile($j,14) $Pile($j,15) $Pile($j,16)"
> }
> close $out
> quit
>
> Thank you in advance.
>
> Sergio
>
> --
> Dr. Sergio Garay
> Facultad de Bioquimica y Cs. Biológicas
> Universidad Nacional del Litoral
> Santa Fe - Argentina
> C.C. 242 - Ciudad Universitaria - C.P. S3000ZAA
> Argentina
> Ph. +54 (342) 4575-213
> Fax. +54 (342) 4575-221
>
>
>
>
>
>
>