mmtk questions

Andrew Dalke dalke@tull.mag.com
Fri, 5 Sep 1997 13:14:26 -0700


I was thinking this morning of something I would like from
MMTK; event notification.  I'm not sure which events need
notification or how to do it correctly.  Let me give some
examples.

Suppose I use MMTK to build a structure visualization program
and I allow the user to call MMTK routines directly.
  The graphics display depends on the coordinates, so when
the user says something like "sidechain.translate(offset)"
I need MMTK to tell me the internal state has changed and
that I need to update my display.
  This specific notification exists in VMD for just this reason.
There are other terms which are not updated, and it makes for
strange behaviour.  For example, I can color the system based
on its beta value, and I can change the beta value by hand,
but no event is available to force an automatic update of the
display.  Thus, I have to press a button "Update" for VMD to
recompute the new coloring.

  I would imagine that I register a callback for certain
classes of events.  When I execute the user command, I
would flag when specific events came back, and act on them
after the user command has been completed.  (In that way,
I don't redraw the screen after every coordinate change, but
just when they are finishied - like X or Tk does it.)



As another example, suppose I've made a selection like "all atoms
with 4 bonds and charge > 0.2".  I would like some way to keep
that selection "active", so I need notification when certain
properties change.  One way could be something like:

  selection = protein.select('bonds > 4 && charge > 0.2');
  for keyword in selection.keywords:
    Protein.notify(selection, 'change', keyword)

And have
  class Selection:
    def event(self, action, field):
      # whatever is needed to regenerate the selection, eg.
      new_selection = self.protein(self.selection_text)
      self.__atoms = new_selection.atomList()


One that I added to VMD for the next release is a way to
override the determination of the bond topology. This was
done specifically to address someone's desired to visualize
his dense fluid system where VMD tried to make nearby atoms
bond to each other when they shouldn't.
  I know MMTK doesn't suffer from this problem, given that
it uses a residue library, but regardless, it does provide
a mechanism for overriding any problems that might occur,
like the questions I had yesterday about Zn fingers or heme.



Of course, it would be nice if this was tied into a more
general notification scheme.  What Tcl has is pretty nice
(though not object based) and the new one for Java sound
great.  Has there been anything along that line developed
for Python?

						Andrew