Using VMD and NAMD on MOGON

We, the ZDV HPC group, have setup and compiled VMD and NAMD for you – and we will continue to do so for new versions upon request. You will find the installed modules as


Here, the <version_string> may deviate between the clusters. If you are missing a particular version, please inform us.

Both, VMD and NAMD, come with a license, which prohibits us to “just install and everyone can use it”. We, therefore, need individual users to print and sign the linked licenses (VMD license and NAMD license) on that paper. Subsequently, send it via internal mail (“Hauspost”) to “ZDV HPC Group”. We will then set the permissions accordingly.

When doing so, please include:

  • your name
  • your username
  • your email address (in case we need to approach you)
  • Software (if not already stated on the license agreement)
  • Software Version (if not already stated on the license agreement)

Multiple users may sign a single license agreement if the agreement in question permits this.

We generally do not provide support in using a particular software with all its flags (or in the case of a GUI, all its clicks). In this particular case we refer to the VMD tutorial.

That being written, we are aware that starting the VMD-GUI can be tricky and the relevant information hard to find.

Here, we give some brief snippets, covering the essentials:

  • First, we need to load the module and instruct VMD to start in its graphical, non-MPI mode:
$ module load vis/VMD # this will load the most current version, which is installed
$ export VMDNOMPI=1
  • Next, we start an interactive session, e.g. with salloc. Here is a little more information on interactive jobs. With respect to the number of cpus: Not everything in VMD is parallelized. If you want to start an VMD-MPI job, you better write a VMD script and start VMD like a conventional MPI-application.
$ salloc -A <your_account> -p smp -c <number_of_cpus> -t <sufficient_time>
<snipping wainting for the session>
$ srun vmd <arguments>
  • When ending the session, do not forget to type exit to relinquish the allocation.
Molecular Dynamics (MD) simulations can be tricky to be set up correctly. It is not unusual to make mistakes, which may consume lots of CPU time. The purpose of these snippets is not to teach running MD simulations in all detail or to cover all aspects of NAMD-configuration files1), but to descript how to generate the most basic setup.

Generating ''.psf'' files

A .psf (protein structure file) ist needed to feed NAMD. Beginners frequently have troubles generating one.

The following section refers to the VMD tutorial section on generating a PSF file:

  1. load a new molecule
  2. run the autopsf utility (Extensions → Modeling → Automatic PSF Builder)

This will create the following files: <molecule_prefix>_autopsf_formatted.pdb, molecule_prefix>_autopsf.log, <molecule_prefix>_autopsf.pdb, <molecule_prefix>_autopsf.psf.

Of course, VMD offers many more options, most are more sophisticated than this description.

Periodic boundaries: Estimating Unit Cell Size

To run a simulation with periodic boundaries, we assume that you have loaded the desired .pdb file into VMD and will set to calculate the unit cell:

Within VMDs Tk Console2) you can run:

set everyone [atomselect top all]
measure minmax $everyone 

This will yield two vectors, e.g.: {-38.473999 -24.975999 -35.2630} {36.910999 29.686 35.957}. To obtain the values for the initial(!) cellBasisVector-entries you need to add together the absolute values, e.g. abs(-38.473999) + 36.910999 = 75.384998. Subsequently set the cellBasisVector-entries to sensible (slightly rounded) values, such that the result vector of your addition becomes the diagonal:

cellBasisVector1     75.385 0.0 0.0
cellBasisVector2     0.0 54.662 0.0
cellBasisVector3     0.0 0.0 71.22
cellOrigin           0.0 0.0 0.0

Finally, turn on PME-settings and set the box size, such that the initial conformation will surely fit, e.g.:

PME                  on
PMEGridSizeX         80
PMEGridSizeY         60
PMEGridSizeZ         75

With a given configuration file, you can start NAMD like this:

#SBATCH -t <time>
#SBATCH -p <partition> # e.g. parallel
#SBATCH -A <account>
#SBATCH -N <rather start with a low number to test>
#SBATCH -n <N * cores / node>
module purge
module load chem/NAMD
# the suffix 'namd_conf' is arbitrary
srun namd2  <prefix>.namd_conf

The configuration file content depends on the simulation to be carried out, however, the coordinates and structure parameters could simply refer to the auto-generated .pdf and .psf files produced by VMD as described, respectively.

The NAMD tutorial indicates this download site for CHARMM force fields and topology files3)

When using these force field files, be sure not to forget to amend the force field type to the configuration file, e.g.:

parameters           <path to desired prm>.prm
paraTypeCharmm       on

For this, refer to the NAMD-tutorial, please.
Info on how to estimate this for many simulations in a script will be appreciated.
We indicate this as searching can be tedious.
  • start/software/topical/lifesciences/molecular_dynamics.txt
  • Last modified: 2021/09/15 14:26
  • by jrutte02