From: John Stone (
Date: Thu May 07 2009 - 10:19:09 CDT

  Part of the problem you're having is that you're still using
VMD 1.8.6. There were indeed a number of Python bugs in that version,
and although many have been fixed, you won't benefit from those
fixes unless you begin running test versions of VMD 1.8.7.
The VMD 1.8.7 beta versions also support Numpy, for example.

Regarding the issue of the python libraries not being
included by default, unlike the Tcl equivalents, these are
quite large and already some people overseas have difficulity
downloading VMD over slow connections. Another general problem with
Python in VMD is that it really doesn't want to be an "embedded" interpreter,
it prefers to be on top, and to load packages like VMD as a module
under the umbrella of Python itself. This is the main reason we have
had difficulty providing Python support on par with what we've
historically done for Tcl.

Going forward things in the Python world look even less
clear to me given that they've made Python 3.x much less compatible
than prior versions.

In general, the best thing for Python users to do is to compile VMD
from source code, so that they can use whatever Python version they
prefer, along with the existing Python libraries they may already have
installed. We've always had difficulty pleasing Python users because
people prefer whatever version they're already using, and since we can
only compile/link VMD with one specific version, there's always a chorus
of people that would prefer we use a different one than we've selected,
due to incompatibilities from one version to the next.

By luck or coincidence, we haven't had nearly so much difficulty with
Tcl versioning, but I expect that much of this is due to the fact that
Tcl is evolving much more slowly, has very few incompatible changes
from one version to the next, and has a much smaller library
(and no platform dependent object files, e.g. .pyo files).

I've been using Python 2.5.1 and NumPy for VMD 1.8.7 test
builds up until now. Before the final release of VMD I'll be
reevaluating whether I plan to use those versions for the final
builds, but if people have a strong opinion about it, I'd be happy
to hear from them now...

Since Python is still a relatively fast moving target, my general
suggestion is still to build VMD from source code and link against
your favorite Python version.


On Thu, May 07, 2009 at 02:31:25PM +0200, Pawel Kedzierski wrote:
> On Wed, May 06, 2009 at 07:18:54PM -0400, Axel Kohlmeyer wrote:
> > On Wed, 2009-05-06 at 20:50 +0200, Pawel Kedzierski wrote:
> ...
> > > mol = VMD.atomsel.atomsel('all')
> > > vec = (10.0, 0.0, 0.0)
> > > mol.moveby(vec)
> > >
> > > the (top) molecule selected does not move in the OpenGL window.
> ...
> >
> > pawel,
> >
> > it works for me in the tcl script interface of version 1.8.6 and
> > with a self-compiled version of the current development sources
> > using the native python installation.
> I know that it does work in Tcl, and I'm glad it's fixed in new verion,
> thanks. For now I came up with a workaround myself, that is, I use
> Molecule.reps() to save the representations, remove them from the
> molecule prior to moving it, and then I recreate the reps afterwards.
> Vorgive me complaints, I do really like VMD and I appreciate the hard
> work of the developers. But since I like Python too, I would gladly see
> improvements in VMD Python API, and therefore I am reporting odds I've
> bumped into ;-)
> And there are a couple more:
> - VMD.atomsel.atomsel(text_selection, molid=#)
> always selects from top molecule, ignoring molid.
> - the following code fails (M is a VMD.Molecule.Molecule instance):
> Mreps = M.reps()
> M.clearReps()
> for rep in Mreps: M.addRep(rep)
> The reason is that every rep keeps a back reference to M even after
> M.clearReps(), so one must add e.g.:
> for rep in Mreps: rep.remove_molecule(
> Sadly enough, I think the Python interface in VMD has less functionality
> and more bugs than the Tcl due to smaller user base. This situation
> is probably going to persist as new users or new projects choose the
> better supported and documented interface, with many examples around.
> For example, I don't see a single Extension plugin written in Python, at
> least in the standard VMD package. Although the API was probably there
> for years, it may possibly be mostly untested. And even a single example
> would be helpful for programming users to start playing with.
> But the probably most important obstacle for potential writers of
> Python plugins is that the standard Python library and Numeric are
> external to VMD, which means that for most users they are likely not
> installed at all. The old python version and Numeric required by VMD is
> another problem. Numeric is no longer supported and it would be good if
> VMD switched to numpy instead. I was biten by bugs in Numeric which are
> fixed in numpy. But of course I understand this may be nontrivial, and
> if there is small user base indeed, it means low priority, too.
> Cheers,
> Pawel
> > > However, the coordinates _are_ affected within VMD: if there are any
> > > Labels, the Labels do shift according to the translation vector or the
> > > transformation applied. Also, when I create a new graphical
> > > representation, it appears in the new position. Therefore I tried to
> > > do:
> > > VMD.molrep.set_autoupdate(molid, rep_num, 1)
> > > prior to moving the molecule, but it didn't help, either.
> > > As it seem to me, the only way to go is to:
> > > 1) delete all representations;
> > > 2) move; and then
> > > 3) create representation(s) again.
> > >
> > > Is there a better way to get the graphical representations to move with
> > > the molecular coordinates, or have I just discovered a bug?
> > >
> > > With many thanks for the great program,
> > > Pawel
> >
> > --
> > =======================================================================
> > Axel Kohlmeyer
> > Center for Molecular Modeling -- University of Pennsylvania
> > Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
> > tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
> > =======================================================================
> > If you make something idiot-proof, the universe creates a better idiot.
> --
> --> Pawe? K?dzierski Molecular Modelling and Quantum Chemistry Laboratory
> Institute of Physical and Theoretical Chemistry I-30
> Wroclaw University of Technology
> Wroclaw, POLAND

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:                 Phone: 217-244-3349
  WWW:      Fax: 217-244-6078