Using VMD on Digital Research Alliance of Canada systems
Overview
Teaching: 10 min
Exercises: 5 minQuestions
What is VMD used for?
How to use VMD remotely on Alliance clusters?
Objectives
Learn how to run vmd on a compute node
Learn how to connect graphically to VMD running on a compute node
Introduction
Molecular modelling and simulations are widely used in structural biology, chemistry, drug design, materials science and many other fields of science. Visualization is one of the most useful means for evaluating the quality of molecular models. The ability to visualize atomic details is crucial to understanding molecular functions.
Visualizing macromolecular structures is challenging, and it requires specialized software. VMD is one of the molecular visualization packages. Alternative molecular visualization software includes UCSF Chimera, PyMol, and JMol
VMD (Visual Molecular Dynamics) is a software package for the 3D visualization, modeling and analysis of molecular systems. It is developed and freely distributed by the Theoretical and Computational Biophysics Group at the University of Illinois at Urbana-Champaign.
- VMD (Visual Molecular Dynamics) is a software package for the 3D visualization, modeling and analysis of molecular systems.
VMD features
- VMD works efficiently with large MD trajectories.
- VMD supports
- wide variety of file formats
- photorealistic rendering of images
- VMD offers
- built-in tools and plugins for analysis of structures and trajectories
- powerful scripting capability
- ability to make custom trajectory movies
Using VMD on a remote server
The trajectory files generated by MD simulations are large, so transferring them to your local computer can be time-consuming. By visualizing and analyzing them remotely, you could save a lot of time and efforts. That’s why, we’ll start our workshop by showing you how to use VMD remotely. I encourage you to consider remote connection, but if you are not comfortable with this you can use your own computer.
To use VMD GUI on Alliance clusters you need to establish graphical connection. Currently there are two options: remote desktop with VNC or JupyterHub.
- To use VMD GUI on Alliance clusters you need to establish graphical connection.
- There are two options: remote desktop with VNC or JupyterHub.
Connecting to the training cluster
- ssh: moledyn.ace-net.training
- JupyterHub: jupyter.moledyn.ace-net.training
- Login sheet
Connecting graphically to a cluster with JupyterHub
JupyterHub provides remote desktop via noVNC (the open source VNC client). JupyterHub runs in any browser. It is convenient to use as it allocates resources and launches remote desktop in one step without requiring any additional software.
Here is the list of JupyterHubs on clusters.
Steps to connect to a Jupyter Hub:
- Login with your CC credentials
- Request resources and spin up a Jupyter server
- Choose
Desktop
in JupyterLab Launcher
The drawbacks:
- If cluster usage is high the Jupyter server may fail to start due to a timeout.
- Does not support copy/paste from the host machine
Connecting graphically to a cluster using TigerVNC
Connecting to a visualization node on Graham
Graham has dedicated visualization nodes. You need to install TigerVNC Viewer to use them (RealVNC or any other client will not work). To start using a dedicated visualization node simply connect TigerVNC viewer to gra-vdi.alliancecan.ca
.
Advantages:
- Direct and simple connection from your laptop with TigerVNC Viewer.
- Offer Nvidia GPUs for hardware-accelerated rendering of images
Drawbacks:
- Available only on Graham
No modules are loaded on VDI nodes by default. Before you can use central modules you need to load CcEnv and StdEnv modules:
module load CcEnv StdEnv/2023 vmd
If graphical window is off screen, you can reposition and resize it. The following commands should work for most of you:
display reposition 400 400
display resize 600 600
You can save your settings in the VMD initialization file. I’ll show you how to do it later.
Connecting graphically to a compute node (more challenging)
The VNC connection to a compute node is a little more complicated, but it is reliable. In addition, you’ll be able to copy/paste text into a remote desktop with VNC.
We will use Beluga as an example to illustrate connecting VNC to a compute node.
1. Connect to Beluga with SSH.
ssh user@beluga.computecanada.ca
2. Allocate some resources:
salloc -c2 --mem-per-cpu=1000 --time=3:0:0
...
salloc: Granted job allocation 35464975
salloc: Waiting for resource configuration
salloc: Nodes bg11308 are ready for job
[user@bg11308 ~]$
3. Start VNC server
vncserver
Enter your new VNC password when prompted. Answer ‘no’ on the question about view-only password.
Server will display a line like this in its output after it has started:
New 'bg11308.int.ets1.calculquebec.ca:1 (user)' desktop is bg11308.int.ets1.calculquebec.ca:1
Here bg11308 is the hostname of the node where the server is running and :1 is the number of VNC session.
TigerVNC sessions are listening on port 5900 plus the session number, so in this example port number is 5900 + 1 = 5901. You will need host name and port number to connect your computer to the remote VNC session.
4. Open SSH tunnel to the remote computer
Now you need to connect your local computer to the node where the VNC server is listening. In order to access compute nodes, you must go through a login node as they are located on an internal network.
We can use SSH client program to connect port 5901 of bg11308 directly to our local computer. This type of connection is called “SSH tunneling” or “SSH port forwarding”.
The following SSH command creates a tunnel between port 5901 on bg11308 and port 5901 on your local computer.
ssh user@beluga.computecanada.ca -L 5901:bg11308:5901
The format of the host:port specification is local_port:remote_host:remote_port
. You can use any free local port.
The tunnel is active only while the session is running. Do not close this window and do not logout, this will close the tunnel and disconnect your laptop.
5. Connect the local computer to the remote computer
Start VNC viewer on your local computer and connect it to localhost:5901
.
6. When you are done close VNC session on the remote:
vncserver -kill :1
If you don’t terminate VNC sessions old .log and .pid files will be accumulating in the directory ~/.vnc, but don’t worry, it is easy to clean them up:
rm ~/.vnc/*.log
rm ~/.vnc/*.pid
Challenge
What ssh command should user21 use to connect port 5999 of his laptop to VNC session :5 running on node2 of the cluster moledyn.ace-net.training?
Answers:
- ssh user21@moledyn.ace-net.training -L 5999:localhost:5905
- ssh user21@moledyn.ace-net.training -L 5905:localhost:5999
- ssh user21@moledyn.ace-net.training -L 5999:node2:5905
- ssh user21@node2.ace-net.training -L 5999:localhost:5905
Solution
ssh user21@moledyn.ace-net.training -L 5999:node2:5905
Key Points
Connect to a compute node using TigerVNC client and SSH tunnel