next up previous contents index
Next: Atom selections in Python Up: Python Text Interface Previous: Using the Python interpreter   Contents   Index


Python modules within VMD

Once you enter the VMD Python environment, you will find a module called ``VMD" already loaded. This module contains all the other built-in modules for writing VMD Python scripts.

VMD is not distributed with an entire Python environment. In order to use the set of libraries that normally come with a Python distribution, you must tell Python where to find the libraries. There are two primary means of doing this. The PYTHONHOME environment variable points to the location where Python is installed; the version installed at this point must match VMD's version (2.5). Thus if you have Python libraries in /usr/local/lib/python2.5, adding the line set env(PYTHONHOME) /usr/local to your startup script or .vmdrc file will do the trick.

If you have additional modules that you want to use within VMD, use the PYTHONPATH environment variable to tell Python where to find them. Please note that any of these modules have to be compiled against matching versions of the Python package and its subpackages that are distributed with the pre-compiled VMD binaries. If you want to use the native Python and its packages, you will have to compile VMD from source code or install a user contributed package that matches your OS. See any Python book and the instructions for compiling VMD from source code for more information.

if the Tkinter module is found in the Python installation, VMD will load it at Python startup in order to make Tkinter windows work in harmony with windows created from within Tk. In addition, if you have Numeric Python installed in your system, a submodule called vmdnumpy will become available within the VMD module; see below for details.


next up previous contents index
Next: Atom selections in Python Up: Python Text Interface Previous: Using the Python interpreter   Contents   Index
vmd@ks.uiuc.edu