From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Jul 13 2004 - 10:15:33 CDT

Dear Ken,
  As you've already observed, there don't seem to be any commonly used
trajectory formats that include bond information. At present, VMD itself
also takes the point of view that bonds are a static property of the
structure and it assumes they are unchanging throughout the course of a
trajectory. The one exception as you've already seen is the "DynamicBonds"
representation which performs a distance-based bond search on a per-frame
basis, which is a hack to get around this limitation. In the long term, if
we want to support this type of data properly, we'll have to teach VMD to
store per-frame bond information, and find some trajectory file format(s)
that contain such information.

In the mean time, the only method I can think of for doing this easily
would be to remap the bonds every timestep, by reading an ASCII text file
containing the per-frame bond information into an array of timesteps
accessible within Tcl/Python. From there, a relatively simple Tcl
script could use the bonding information to enable/delete bonds
as the timestep is changed, by monitoring the vmd_frame variable.

Here are a couple of useful scripts that you can hack to get something
like I've described.

GUI-based bond creation/deletion:
  http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/pickbond/

Reading files in Tcl:
  http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/readcube/

And last, here's a simple script that traces vmd_frame which is how you'd
update the bonds when the user animates the scene, etc:
##
## Example script showing a way to add user-drawn geometry that updates
## as a trajectory is animated.
##
## To use this script:
## 1) load your trajectory
## 2) source frameupdate.vmd
## 3) enabletrace
## 4) do your thing :-)
## 5) disabletrace

proc enabletrace {} {
  global vmd_frame;
  trace variable vmd_frame([molinfo top]) w drawcounter
}

proc disabletrace {} {
  global vmd_frame;
  trace vdelete vmd_frame([molinfo top]) w drawcounter
}

proc drawcounter { name element op } {
  global vmd_frame;

  draw delete all
  # puts "callback!"
  draw color white
  set psperframe 1.03
  set time [format "%8.3f ps" [expr $vmd_frame([molinfo top]) * $psperframe]]
  draw text {10 10 0} "$time"
}

Hope that helps,
  John Stone
  vmd_at_ks.uiuc.edu
 

On Tue, Jul 13, 2004 at 09:27:07AM -0400, Kenneth Smith wrote:
> Hello.
> I am currently working on simulations where we allow the bonding structure to be altered after each time step in the MD simulation. I would like to use VMD as the visualization program, but so far I can not identify any possible trajectory file formats that allow for updated connectivity at every time step. The dynamic bonding method is not sufficient as we may break specific bonds and also at times form bonds with radical molecules which would have the possibility of one additional bond beyond the traditional valance limits. Are there any ways to address these issues with VMD as it is currently written or would this require source code modification?
> Thanks for you help! Ken
>
> -----------------------------------------------------------------------
> Kenneth D. Smith
>
> Department of Chemical Engineering
> University of Massachusetts- Amherst
> 159 Goessmann Lab
> 686 N. Pleasant St.
> Amherst, MA 01003
> Office: 216 Goessmann
> tel: (413) 545-2234
> fax: (413) 545-1647
> email: ksmith_at_ecs.umass.edu
>

-- 
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