VMD-L Mailing List
From: Amit Gupta (amit__at_outlook.in)
Date: Tue Dec 20 2016 - 00:31:18 CST
- Next message: Norman Geist: "AW: Draw arrows in trajectory file"
- Previous message: Axel Kohlmeyer: "Re: vmd1.9.23 rlwrap: No match"
- Next in thread: Norman Geist: "AW: Draw arrows in trajectory file"
- Reply: Norman Geist: "AW: Draw arrows in trajectory file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
I want to draw come arrows in a lammps trajectory file, indicating movement of certain vectors.
I have written script below, it works fine for single frame, but for more than one frame, VMD crashes without any message (even in console). Can anyone suggest a reason?
draw color yellow
##-----------Draw arrow subroutine from VMD website----------
proc vmd_draw_arrow {mol start end} {
# an arrow is made of a cylinder and a cone
set middle [vecadd $start [vecscale 0.75 [vecsub $end $start]]]
graphics $mol cylinder $start $middle radius 0.1
graphics $mol cone $middle $end radius 0.3
}
##--------------------------------------------------------------------------------
set n [molinfo top get numframes]
set sel [atomselect top "all"]
set n_list [atomselect top "type 6"] #get indexes of all nitrogens in molecules
set all_n_atoms [$n_list get index]
for {set i 0} {$i < $n} {incr i} {
$sel frame $i
foreach n_atom $all_n_atoms {
set current_c_atom_index [expr $n_atom - 1] # get index of C attached to N
set end [lindex [[atomselect top "index $n_atom"] get {x y z}] 0]
set start [lindex [[atomselect top "index $current_c_atom_index"] get {x y z}] 0]
draw arrow $start $end
}
}
Sorry if certain logic seems slightly convoluted, still getting used to TCL!
- Next message: Norman Geist: "AW: Draw arrows in trajectory file"
- Previous message: Axel Kohlmeyer: "Re: vmd1.9.23 rlwrap: No match"
- Next in thread: Norman Geist: "AW: Draw arrows in trajectory file"
- Reply: Norman Geist: "AW: Draw arrows in trajectory file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]