VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Jun 20 2003 - 09:55:54 CDT
- Next message: John Stone: "Re: coloring method: user"
- Previous message: Timothy W Suen: "Bond Lengths"
- In reply to: Timothy W Suen: "Bond Lengths"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Dear Tim,
You should be able to use a technique very similar to some scripts
we suggested for someone that was interested in measuring Dihedrals:
http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/1546.html
http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/1549.html
You could also use something like 'label graph Bonds xxx myfile.dat'
where xxx is the label index you're interested in.
The "Save" feature in the GUI actually triggers the "vmd_labelcb" proc
defined in 'graphlabels.tcl' in the VMD distribution, you can override
these callbacks if you like:
############################################################################
#cr
#cr (C) Copyright 1995-2003 The Board of Trustees of the
#cr University of Illinois
#cr All Rights Reserved
#cr
############################################################################
# Callback for plotting values of labels. Triggered by the "graph" button
# on the Labels menu.
# This callback sends data to xmgr, one dataset at a time. If xmgrace is
# not found, it reverts to the save dialog.
proc vmd_labelcb_xmgr { args } {
global vmd_graph_label
foreach item $vmd_graph_label {
foreach { type id } $item { break }
set data [label graph $type $id]
set input "@type xy\n@ title \"$item\"\n"
set i 0
foreach elem $data {
append input " $i $elem\n"
incr i
}
set rc [catch {exec xmgrace -pipe << $input &} msg]
if { $rc } {
vmd_labelcb_save
}
}
}
# This callback simply saves the data to a file of the user's choice using
# the Tk dialog box if available, otherwise through the text interface.
proc vmd_labelcb_save { args } {
global vmd_graph_label tk_version
foreach item $vmd_graph_label {
foreach { type id } $item { break }
set data [label graph $type $id]
set title "Enter filename to save label data for $item"
if [info exists tk_version] {
set fname [tk_getSaveFile -title $title]
} else {
puts $title
gets stdin fname
}
if { [string length $fname] } {
set fd [open $fname w]
foreach elem $data { puts $fd $elem }
close $fd
}
}
}
# Choose a callback based on the platform: xmgr for unix, save for everyone
# else (for now). Exception: if a command named vmd_labelcb_user is defined,
# use that one instead of the default.
proc vmd_labelcb { args } {
global tcl_platform
if { [llength [info commands vmd_labelcb_user]] } {
vmd_labelcb_user $args
} else {
switch $tcl_platform(platform) {
unix {
# Set the display variable to :0.0, unless it's already been set
global env
if { ![info exists env(DISPLAY)] } {
puts "Setting DISPLAY environment variable to :0.0."
set env(DISPLAY) :0.0
}
vmd_labelcb_xmgr $args
}
default {
vmd_labelcb_save $args
}
}
}
}
trace variable vmd_graph_label w vmd_labelcb
On Fri, Jun 20, 2003 at 09:54:25AM -0400, Timothy W Suen wrote:
> Hi,
>
> I'm new to this list and VMD, so please let me know if this question has
> been answered before.
>
> I've been having some trouble getting VMD to print bond lengths for a
> dynamics simulation. I have about 20 hydrogen bonds whose lengths I'd
> like to keep track of. So instead of going to Graphics -> Labels ->
> Geometry Data -> Save for all 20 of them, I'd like to write a script that
> will do it for me.
>
> The Save procedure actually does not get logged, so I don't know how it
> works. Using "animate next" and "label list Bonds" has been giving me
> some trouble. Please let me know if you have any suggestions. Thanks a
> lot!
>
> --Tim
-- 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
- Next message: John Stone: "Re: coloring method: user"
- Previous message: Timothy W Suen: "Bond Lengths"
- In reply to: Timothy W Suen: "Bond Lengths"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]