mmtk questions

Konrad Hinsen hinsen@ibs.ibs.fr
Sat, 6 Sep 1997 18:57:01 +0200


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

I had thought about that too when considering visualization. I'd
probably use the Model-View-Controller pattern popularized by
Smalltalk. But I deferred all details to the time when I will
implement visualization, and that might be never ;-)

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

That's one of the difficulties: there might be any number of
properties that can change. Worse, an MMTK application program might
change them directly without using MMTK functions; I guess I can't do
anything about that. I'd probably add event notification at the level
of universe variables (e.g. configurations); that seems sufficiently
general and also sufficiently low-level to catch all modifications
except malicious ones.

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

But that requires another notification to indicat the command
is completed. At least in a multi-threading environment.

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

Well, MMTK does not use the concept of selection used e.g. in CHARMM;
what you use instead is collections, which can be constructed
according to any rule expressible as Python code. But they are static,
at least at the moment. But I see no problem in defining dynamic
collections by some rule (perhaps given as a filter function) and
having them receive notification for each event that influences that
filter function. It's not trivial, but doable...

> 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 think I'll like that! I remember spending a lot of time to
get decent pictures of path integral simulations. About every
visualization programs would add bonds between the beads of each
path integral! I ended up using XMol with hand-edited input
files in Alchemy format...

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

That's not quite the same: in one case you want to eliminate
a bond, in the other case an energy term. The first would
require a change to MMTK's database files, whereas the second
could be implemented in a specific force field.

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

Nothing I know of - but that's a nice topic for SPAM6. Doing
it all in Python code is certainly possible, but I worry a bit
about efficiency...

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------