In this exercise, we will learn the basics of running NAMD molecular dynamics simulations. If you haven’t done so already, you will install the program, familiarize yourself with the required files, and run a test case.
FileSet3.tar.gz
Download and install
If you haven’t done so already, download and install the newest version of NAMD (currently 2.13). Follow the install directions enclosed in the download (README.txt), or look here (NAMD wiki).
There is a NAMD tutorial for OS X/linux/Unix HERE. Files are HERE. You need to run NAMD from a terminal window, or you can run it directly from VMD. This is probably the best way to run it in order to minimize tkcon-like issues. Files for the alanine test case are HERE. If you choose to run through this NAMD tutorial, you only need to go through the “Basics of NAMD” sections. You may STOP at “Analysis”
Required files for a simulation
- Aside from your NAMD program folder/files, you need:
- A configuration file (.namd suffix)
- A PSF/PDB pair from VMD
- A topology file (contained in both the VMD and NAMD packages)
Configuration
A description of the NAMD configuration file is HERE. Basically, the configuration file tells the namd program how to run the simulation, what parameters to use, and the location of the other required files (input and output). There is a VMD extension (Extensions..Simulation..NAMD Graphical Interface) which can help you generate a working NAMD configuration file. Here is a sample from the Alanine test case. I’ve added comments to describe what each line does (when it isn’t obvious). Note that NAMD ignores everything after a hash “#” sign.
# This is a test namd configuration file
timestep 0.5 # 0.5 fs
numsteps 10000 # total number of above steps
structure alanin.psf # absolute path (this means alanin.psf is in the working directory)
parameters alanin.params # this is normally the standard topology (top_all27...).
coordinates alanin.pdb # absolute path
exclude scaled1-4 # what forces to exclude
1-4scaling 0.4 # a parameter for above
outputname output # what is the output base name
margin 1.0 # parameter
stepspercycle 3 # a cycle is how many steps before some thermo checking is done
temperature 0 # this is K (kelvin)
switching on # switching potential
switchdist 7.0 # first cutoff (angstrom)
cutoff 8.0 # second cutoff (A)
pairlistdist 9.0 # neighborlist (A)
dcdfile alanin.dcd # what the output DCD is called
dcdfreq 20 # how often to print out DCD (20 steps)
#restartname alanin.restart # restart file name
#restartfreq 10 # how often to save a restart file
#langevin on # Langevin is a temperature bath method
#langevinTemp 300.0
#langevincol O
#constraints on # we can apply constraints to all or some or none of the atoms
#fma on # ...also forces
#seed 791064881 # random number seed
IMDon on # IMD is interactive MD... running MD through VMD
IMDport 1050 # network port is not normally changed
IMDfreq 20 # how often to send output to VMD
IMDwait yes # wait for VMD before starting simulation?
#-----------------------------------------------------------------------------
A more complete discussion of these entries is HERE.
Running a test case
It is a good idea to look at the NAMD User Guide; This is a link to the best starting point. We are going to run this test case through VMD.
Download the files alanin.params, alanin.psf, alanin.pdb and alanin.nam (or the whole set of files, alanin.tar.gz) to a directory on your computer. Load ‘alanin.psf’ and ‘alanin.pdb’ from the directory. You can make any graphical representation you want, as this is a small molecule. (For larger systems we will see later, minimal graphics will be required.) Open up “Extensions...Simulation..IMD Connect” from the main VMD menu. Type in “localhost” for the hostname, and “1050” for the port. DON’T click “connect” yet.
In a terminal/tkcon, make sure you are in the alanin directory, and then type the full pathname to the ‘namd2’ executable, followed by the name of the control file. It will be ‘/Applications/NAMD_2.6_MacOSX-i686/namd2 alanin.nam’ for OS X; ‘/usr/local/bin/namd2 alanin.nam’ for linux and ‘C:\pathtoNAMD\namd2 alanin.nam’ for Windows.
Once you do this, some information will scroll by, then stop with the message:
Info: INTERACTIVE MD AWAITING CONNECTION
Now you can click ‘connect’ in the ‘IMD connect’ window. You should now see the alanin molecule wiggling, and you will also see information scrolling in the IMD Connect window. This should essentially look like a trajectory loaded from a DCD file. However, since this is happening as the simulation runs, it provides valuable insight and information on a running simulation. If something looks to be amiss, or the system has attained a desired final state, it can be stopped and the configuration file can be adjusted as needed.