NAMD: Building vmd
This is part four of a four-part tutorial on building and testing NAMD and charm++. The full tutorial includes
There is also a troubleshooting page:
Contents |
About VMD
VMD, short for Visual Molecular Dynamics, is a graphical program used to view and manipulation three dimensional molecules. It can take the output (and input) .gro Gromacs files and .pdb Protein Database files and display the molecules. These can then be rotated around in different ways of viewing the molecule. This is done in real time, with the user manipulating the controls.
VMD doesn't necessarily need to run on the cluster. Users can install it on their own computers and then download their files from the cluster. Sometimes, however, it's nice to have a standard install that everyone can use and the system administrator can troubleshoot in one place - like the head node of the cluster. This doesn't need to be installed on all of the nodes, just the one that the users interact with.
Users will need to have a Linux windowing system installed in order to SSH into the cluster and forward the display from VMD to their own computers. This is done with
ssh -X username@yourcluster
Installing VMD
Supporting Packages
VMD requires OpenGL supporting packages. Install them with
apt-get install libglu1-mesa mesa-common-dev libgl1-mesa-dri libglu1-mesa-dev xlibmesa-gl-dev
It also needs the development packages for TK, and the FLTK packages for menu support. Install these with
apt-get install tk8.4-dev tk-dev libfltk1.1 libfltk1.1-dev
This will only need to be done on the head node.
Getting VMD
Like charm++ and namd, vmd can be compiled from source. However, vmd is used for displaying molecules to users, not something that worker nodes will be chugging away with. For that reason, compiling the source to optimize it for an architecture doesn't really pay off all that well. If the prebuilt binaries work for your setup, you can save yourself some time by using those. However, I had just as many difficulties with the prebuilt binaries as with compiling from source, so I'm going to detail below how I compiled vmd.
This one you'll need to go through the process of registering and such for, since they don't list the directory contents. : ) If you don't need 64-bit one, the location is
wget wget http://www.ks.uiuc.edu/Research/vmd/vmd-1.8.6/files/vmd-1.8.6.src.tar.gz
Once you have the tar file, untar it with
tar xvzf vmd*.tar.gz
This will create two directories in the current directory: vmd-1.8.6 and plugins.
Building Plugins
The plugins for VMD must be compiled prior to VMD! If not, you'll see interesting errors.
Cd into the plugins directory. Before running make, the variable PLUGINDIR needs to be set in order to tell make where to install the plugins. This will also be important for VMD itself. VMD will be automatically installed to /usr/local/lib/vmd, so I'd recommend putting the plugins in /usr/local/lib/vmd/plugins. To set the PLUGINDIR variable to this, run
export PLUGINDIR=/usr/local/lib/vmd/plugins
Next, if you run make by itself, you'll see a list of possible architectures. Unless you know your system is 64-bit or one of the other options, you'll probably use LINUX. You can also specify directories to be including that contain TCL and TK. These are important because it won't look the right places and you'll receive errors if you don't specify where to find them. If you installed both with apt-get, your line should be the same as mine (unless you have a different architecture):
make LINUX TCLINC=-I/usr/include/tcl8.4/ TCLLIB=-F/usr/lib/
This should finish without an errors, but you won't get a nice congratulatory message. Instead, it will end without errors (just warnings about unused variables), and if you run the same command again, it will finish without any additional output.
Then run make distrib. This will create new directories at $PLUGINDIR/LINUX and $PLUGINDIR/noarch.
Building VMD
After building the plugins, VMD itself can be built. Cd into the VMD directory from the plugins directory with cd ../vmd-1.8.6. Before compiling, there needs to be a symlink (like a Windows shortcut) in this directory that points to the plugins directory. Create a symlink with
ln -s ../plugins
Now VMD can be built. It follows the source installation paradigm from here. Type ./configure help to see a list of supported architectures. Make sure you choose the same architecture as you used above for the plugins. I'm not sure why it doesn't show all the ./configure options, and make will only show some predetermined combinations. Looking at the Makefile, my ./configure line looked like this:
./configure LINUX MESA TK TCL PTHREADS
PYTHON may also be an option you're interested. Look at the Makefile for more options.
Next, cd into the src directory. Here, run
make veryclean
and then
make
This will error out the first time with the following error:
Compiling PluginMgr.C --> PluginMgr.o ... PluginMgr.C:29:31: libmolfile_plugin.h: No such file or directory PluginMgr.C: In constructor `PluginMgr::PluginMgr()': PluginMgr.C:56: error: `MOLFILE_INIT_ALL' was not declared in this scope PluginMgr.C:56: error: expected `;' before '}' token PluginMgr.C:56: warning: unused variable 'MOLFILE_INIT_ALL' PluginMgr.C: In destructor `virtual PluginMgr::~PluginMgr()': ...snipped...
There may be a better way to solve this (please e-mail me at kwanous <at> debianclusters <dot> org if you know of one), but the way we fixed this was but editing the Makefile in the src directory. Make for VMD doesn't automatically look in the directory the plugins were installed in but we can change this. Look for the line that starts with INCDIRS and append to it so your line looks like this:
INCDIRS = -I../lib/Mesa/include -I../lib/tcl/include -I../lib/tk/include -I../plugins/include -I../plugins/LINUX/molfile -I. -I/usr/local/lib/vmd/plugins/LINUX/molfile/
Once you run make again, you'll see that it also doesn't automatically find TCL:
Compiling VMDApp.C --> VMDApp.o ... VMDApp.C:680:18: tcl.h: No such file or directory VMDApp.C: In member function `char* VMDApp::vmd_choose_file(const char*, const char*, const char*, int)': VMDApp.C:706: error: `Tcl_Eval' was not declared in this scope VMDApp.C:708: error: `TCL_OK' was not declared in this scope VMDApp.C:709: error: `Tcl_GetStringResult' was not declared in this scope
and this is fixed by adding
-I/usr/include/tcl8.4
to the INCDIRS line in the Makefile. Running make a third time will show a new error,
Linking vmd_LINUX ... /usr/bin/ld: cannot find -lmolfile_plugin collect2: ld returned 1 exit status make: *** [vmd_LINUX] Error 1
This can also be fixed by touching up the Makefile. (Again, if there's a better way of doing this, please write me at kwanous <at> debianclusters <dot> org!) Find the LIBS line:
LIBS = -lGL -lGLU -L/usr/X11R6/lib -lXext -lX11 -lpthread -ltk8.4 -lX11 -ltcl8.4 -lmolfile_plugin -lfltk -lX11 -lXft -lm -ldl $(VMDEXTRALIBS)
and replace "-lmolfile_plugin" with the actual location, "/usr/local/lib/vmd/plugins/LINUX/molfile/libmolfile_plugin.a", so that your line looks like this:
LIBS = -lGL -lGLU -L/usr/X11R6/lib -lXext -lX11 -lpthread -ltk8.4 -lX11 -ltcl8.4 /usr/local/lib/vmd/plugins/LINUX/molfile/libmolfile_plugin.a -lfltk -lX11 -lXft -lm -ldl $(VMDEXTRALIBS)
Run make again for it to not find -lXft:
/usr/bin/ld: cannot find -lXft collect2: ld returned 1 exit status make: *** [vmd_LINUX] Error 1
This is fixed in the Makefile under LIBS again. Replace "-lXft" with "/usr/lib/libfltk.a" and then this time, make should finish with an odd little message:
No resource compiler required on this platform.
At this point, you can run make install and VMD should be placed successfully on your system at /usr/local/bin/vmd and in /usr/local/lib/vmd/.
Setting up the Display
Before vmd can be displayed, a graphical display server needs to be installed on the head node. This doesn't mean that a windowing environment (like Gnome or KDE) will be installed, just that the machine will be capable of rendering graphics. Users can then do ssh yourmachine -X to forward the graphics to their terminal (if they're running Linux). The basic linux graphics server is xserver. To install it, run
apt-get install xserver-xorg
There's a great little utility called xlogo that's used to test if the xserver is running correct and forwarding graphics. It's obtained with
apt-get install xutils
Then logout of the machine. From a machine running Linux (with a graphical display), ssh back in with the -X option, and then run xlogo. You should see a little box pop up like that shown to the right.
Now, try entering vmd. If it gives an error,
vmd: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
then apt-get install libstdc++5 and you should be good to go.
Testing
To test VMD, try SSHing into the head node as a user while forwarding graphics. For example,
ssh -X yourclusterhere
Then, run xlogo and make sure that the little window with the logo can pop up on your local computer. If you can't display the xlogo, you won't be able to display vmd, either.
wget http://dx.doi.org/10.2210/pdb4hhb/pdb
and then decompress it with
gunzip pdb4hhb.ent.Z
Then, run vmd. Three different windows should pop up, called VMD, VMD Main, and vmd console. Click on VMD Main, shown to the right. From here, click on the drop down menu "File" and then click on "New Molecule". A new window will pop up. In this one, click on the button "Browse". You should be placed in the home directory; if not, you can type the location in. Select pdb4hhb.ent and click on Load. Move to the "VMD" window and you should see the ubiquitin molecule!
Displayed at right is the ubiquitin molecule displayed with the CPK drawing style. Very cool!
When you're ready to quit VMD, click on the console window and type quit. The program should exit gracefully.
Configuring VMD
VMD has a number of different options that can be customized as part of its startup. The file in charge of these tweaks is located at /usr/local/lib/vmd/.vmdrc.
Unfortunately, describing these options is beyond the scope of this project. Fortunately, UIUC covers these commands.
References
- VMD Plugin Programmer's Guide: Compiling plugins from source code
- Thank you to Charlie Grosvenor for explaining what TCLINC and TCLLIB should point to.
- Thank you to Axel Kohlmeyer for explaining the reason for a missing VMD main menu.


