NAMD is a parallel, molecular dynamics simulation program used to model large biomolecular systems using high performance computing clusters which is freely available for academic work. If you are interested in running NAMD simulations you should also install a local copy of VMD on your own computer. VMD is a molecular viewer program that can be used to help set up NAMD simulation and to help analyze and visualize NAMD output.
VMD can be freely obtained from: http://www.ks.uiuc.edu/Research/vmd/
Additional information and case studies about NAMD are available at:
Further tutorial are available at:
We have an example of Ubiquitin protein, in a vacuum, ready to download and run. (Normally we would do this with water and salt ions, but we need the simulation to run quickly for demonstration purposes).
After logging on to one of the clusters, copy the entire example directory to your home directory.
cp -r /common/examples/NAMD_training_course_example .
Change into this directory and launch the job with the command "qsub" and the pbs script.
Check the job is running with the "showq" command.
Too much information? Try:
showq -u username
This particular job is VERY short compared to a regular NAMD simulation and should be finished in about 2 minutes.
As the job runs, various output files are produced but the main one you will be interested in is the trajectory file with the .dcd suffix.
While we wait, let's take a look at the pbs example script to understand what is going on. Type
See the lines:
# how many cpus?
#PBS -l nodes=4
This tells us how many CPUs we are going to use. (in this case, 4) When you run bigger jobs you'll want to use more CPUs to speed up the calculations!
Another important line is the walltime:
# How long to run the job? (hours:minutes:seconds)
#PBS -l walltime=0:15:0
This tells us how long to run the simulation. (in this example, 15 minutes.)
The job will end when this time expires, whether the job has finished or not!
Make sure to have a good estimate of walltime for your real jobs! Typically you might run a NAMD job for days, if not weeks.
The business end of the script is in the last line:
mpiexec namd2 Ubiquitin_example.conf
This is saying use the program "mpiexec" to launch the parallel program "namd2" passing the configuration file "Ubiquitin_example.conf"
So far so good! Press "q" to quit viewing the pbs script.
Now lets have a look at the NAMD configuration script:
There is quite a bit of information here, don't worry though. Most of the parameters stay the same for each simulation. Let me just point out the important bits.
See the lines near the top:
These are simply defining the input files, (the protein structure file .psf, and the coordinate file, .pdb) and also the name of the output files.
Further down you will see:
set temp 310
Which is setting the temperature to 310 K ( 37 C) while below that we have:
## Parameter file:
which tells NAMD which parameter file to use. (you'll see a copy of the parameter file in the NAMD_example directory). Depending on what molecules you have in you simulation, you may need to use a more detailed parameter file.
Somewhere in the middle you will see these lines:
## Periodic Boundary Conditions
cellBasisVector1 42. 0. 0.
cellBasisVector2 0. 42. 0.
cellBasisVector3 0. 0. 42.
cellOrigin 0 0 0
This defines the boundary conditions, ( a cheats way to simulate an infinite system), where a molecule coming off one side of the boundary will reappear on the other.
Near the bottom we have the lines:
## Output files:
These lines tell us how often to write out to the output files. The most important is the dcdfreq, (here set to 50), or how often to save a frame of the dynamics trajectory. (Usually this is set around 5,000 to 10,000). The dcd output file can become ridiculously HUGE if this is too small. 50 is OK for this short example!
The last few line in the configuration file:
## Minimize, reinitialize velocities, run dynamics:
- tell us that the simulation is first minimized for 100 steps, (a good idea to iron out bad contacts and steric clashes, but usually set to 1000 steps or more), followed by resetting the velocities to $temp, (310 K, remember?), and then told to run only a mere 1000 steps. (This is a very short example!). Typically you might set "run" to 10000000 or more.
Press "q" to quit viewing the configuration file.
Check again on the status of your job:
showq | grep [your account name]
If you don't see anything it probably means the job has finished.
List your directory and you should see something like:
-rw-r--r-- 1 joe vpac 798545 2007-03-06 09:27 1ubq_example.psf
drwxr-xr-x 2 joe vpac 4096 2007-03-06 09:27 BUILD_DIR
-rw-r--r-- 1 joe vpac 509521 2007-03-06 09:27 1ubq_example.pdb
-rw-r--r-- 1 joe vpac 199275 2007-03-06 09:27 par_all27_prot_na.inp
-rw-r--r-- 1 joe vpac 509546 2007-03-06 09:44 1ubq_example_fix.pdb
-rw-r--r-- 1 joe vpac 743 2007-03-06 15:39 pbs_example_script
-rw------- 1 joe vpac 221 2007-03-07 14:26 1ubq_example_output_01.xsc.BAK
-rw------- 1 joe vpac 154780 2007-03-07 14:26 1ubq_example_output_01.coor.BAK
-rw------- 1 joe vpac 3951144 2007-03-07 14:26 1ubq_example_output_01.dcd.BAK
-rw------- 1 joe vpac 154780 2007-03-07 14:26 1ubq_example_output_01.vel.BAK
-rw-r--r-- 1 joe vpac 3096 2007-03-07 14:27 Ubiquitin_example.conf
-rw------- 1 joe vpac 224 2007-03-07 14:37 1ubq_example_output_01.xsc
-rw------- 1 joe vpac 154780 2007-03-07 14:37 1ubq_example_output_01.coor
-rw------- 1 joe vpac 4028612 2007-03-07 14:37 1ubq_example_output_01.dcd
-rw------- 1 joe vpac 154780 2007-03-07 14:37 1ubq_example_output_01.vel
-rw------- 1 joe vpac 67372 2007-03-07 14:37 Namd_1ubq_example_output.txt
-rw------- 1 joe vpac 0 2007-03-07 14:37 namd_example_job_01.e156354
The highlighted file is the main output file while the .xsc, .coor, .vel files all have to do with being able to restart the simulation at a later date. The .BAK are backup files while the .txt file contains the text output from the simulation.
You have just run a short molecular dynamics simulation on the cluster.
Next, we'll copy that information back to your local computer and use VMD to visualize the results.
Welcome to part 2 of the NAMD tutorial, where you will be using the molecular visualization program, VMD to look at the trajectory data of the ubiquitin protein you generated in part I of the tutorial. If you haven't already done so, download and install VMD to your local computer (make sure to pick the right flavour, Windows, Mac, or Linux).
Download the entire NAMD example directory back to your local computer. For example, in Linux you can use:
scp -r [your account name]@trifid.vpac.org:NAMD_training_course_example .
You can now start VMD and load up the trajectory data. In a new terminal type:
Three windows should pop up:
The first file you need to read into VMD is the protein structure file, (1ubq_example.psf in this case). The .psf file contains important information about the system such as which atoms are bonded together, what charge they are, and the mass of each atom type, but does not contain any spacial information.From the Main panel:
File - New molecule - (browse: 1ubq_example.psf) - load
You should see nothing in the display, but an entry in the Main panel.
Next load the coordinates from the pdb file:
File - Load data onto molecule - (browse: 1ubq_example.pdb) - load
Now you should have the model in the display that can be moved around with the mouse.
This is the initial starting position of the simulation. Next load in the trajectory data into VMD:
File - Load data onto molecule - (browse: 1ubq_example_output_01.dcd) - load
This data is shows how the atoms in the model moved around during the course of the NAMD simulation. You can play the trajectory by pressing the bottom right arrow of the Main panel. (Use the speed scroll bar to the left of that button to slow it down).
What you are seeing is supposed to represent is the molecular motion of the protein on an extremely small time scale. The NAMD program calculates how the molecule moves over time given certain parameters such as temperature. These models and simulations can give insight into how proteins behave and their role in biological function and certain diseases.
From the main panel you can bring up the Representations dialog to play with more rendering types:
Graphics - Representations
Playing with the pbs_script
The example you just ran had a default request of using 4 CPUs. If you look at the last few lines of the output file you can see how long the job took to run. (Use the command tail to peek at the end of the file )
You should see lines like:
WRITING COORDINATES TO DCD FILE AT STEP 5100
WRITING EXTENDED SYSTEM TO OUTPUT FILE AT STEP 5100
CLOSING EXTENDED SYSTEM TRAJECTORY FILE
WRITING COORDINATES TO OUTPUT FILE AT STEP 5100
CLOSING COORDINATE DCD FILE
WRITING VELOCITIES TO OUTPUT FILE AT STEP 5100
WallClock: 73.114372 CPUTime: 73.114365 Memory: 8728 kB
End of program
From the above output we can see the job took 73 seconds to run.