From CAC Wiki
Revision as of 17:47, 14 June 2016 by Hasch (Talk | contribs) (Running NWChem from a command line)

Jump to: navigation, search


This is a quick introduction to the usage of the free but licensed code NAMD2 that is installed on our clusters. It is meant as an initial pointer to more detailed information and a Getting Started primer. It does not replace study of the manual.


NAMD is a parallel code for molecular dynamics simulation of large biomolecular systems, developed by the Theoretical Biophysics Group ("TBG") in the Beckman Institute of the University of Illinois . It is file-compatible with AMBER, CHARMM, and X-PLOR.

Location of the program and setup

The binary executable is in /opt/namd on the HPCVL Clusters. The present version of the program is 2.10, and it is available on the Linux platform in its 64 bit version. Therefore, all the relevant executables are in /opt/namd/2.10. Documentation can be found at the main NAMD site and a simple example (Alanin) is in /opt/namd/2.10/example.

The setup for NAMD is very simple. It is only necessary type :

use namd

This will enter the proper directory into your PATH and off you go.

Running NWChem from a command line

NAMD requires a number of input files to run. These include:

  • A so-called "configuration file" that declares the initial configuration for a molecular dynamics run, the force field files, number of steps in the simulation, etc.
  • A coordinate file that gives the coordinates of the participating atoms or molecules.
  • A parameter file declaring bond-lengths, angles, dihedrals, non-bonded parameters etc.
  • A force-field file declaring parameters associated with atomic and molecular interactions.

Details about the supported format of these input files can be found in the NAMD User's Guide.

NAMD supports several running modes. In the simplest case, it can be run in serial mode by typing:

namd2 config_file

where config_file is the configuration input file mentioned above. It is recommended to give the configuration file the file extension .namd to enable consistent naming of the output files. These will be generated automatically, and the progress of the program run will be tracked on the screen.

NAMD is also able to run in parallel mode. For our shared-memory systems, it is easiest to run it by specifying the number of threads through the +p option:

namd2 +pN config_file

if N threads are requested.

Parallel Runs

NWChem is inherently parallelized and designed to scale well on a multi-processor machine or a cluster. The underlying parallel system is MPI (Message Passing Interface) which is a commonly available standard that runs on many platforms. Consult our MPI help file and follow some of the links in there if you want to have more information about MPI. Even if you want to use only one processor for your NWChem run (which sometimes is the best solution, particularly for smaller computations), you have to submit the program to a parallel environment. On our clusters, the relevant command is mpirun:

mpirun -np 8 nwchem sample > sample.log

This will run your sample.nw input file on eight processors. Note that you are only allowed to run NWChem this way for small test systems! For any production jobs, you have to submit the task to the scheduler (see next section.).

Submitting (parallel) NWChem jobs

NWChem jobs are to be submitted on the SW (Linux) systems via the GridEngine, which is a load-balancing software. To obtain details, read our GridEngine FAQ . For an NWChem batch job, this means that rather than issuing the command in the previous section directly, you wrap it into a GridEngine batch script.

Here is an example for such a batch script:

#$ -S /bin/bash
#$ -q abaqus.q
#$ -l qname=abaqus.q
#$ -o sample.out
#$ -e STD.err
#$ -M hpcXXXX@localhost
#$ -m be
#$ -V
#$ -cwd
#$ -pe 4
mpirun -np $NSLOTS nwchem sample

This script needs to be altered by explicitly replacing the entries that differ in your case. We suggest you use it as a template for all your NWChem runs. For details, consult our Scheduler Help File.

Note that there is no need in this script to redirect the standard output via the > operator. Instead, you define where the output goes to the GridEngine via the "#$ -o" command. In our case, we send it to a file called sample.out.

Email notification is set up through the "#$ -M" line. In the above example you need to replace XXXX by the actual 4 digits in your username, and place a file ".forward" with your email address into your home directory.

In the example we are executing with 4 processes. To choose a different number, alter the "#$ -pe" line in the script. For this example script to work you need to have set up the calling shell through the "use nwchem" command because the above script inherits all the environment settings (due to the "#$ -V" option).

The script is submitted to the GridEngine by typing

qsub batch_file_name

The advantage to submit jobs via a load balancing software is that the software will automatically find the resources required and put the job onto a set of processors that have a low load. This will help executing the job faster. Production jobs on our cluster must be submitted using GridEngine from a login node (sflogin0 or swlogin1), and executed under GE's control on the Linux production nodes without any need for you to log in.


NWChem is obtainable free of charge from the Pacific Northwest National Laboratory. To obtain your own copy, go here. NWChem is ditributed under an Open Source Educational Community License. Like with other software, HPCVL requires users who want to use NWChem, to read this agreement, and sign a statement that they have done so and will abide by its terms. You can fax the signed statement to (613) 533-2015 or scan/email it to You will then be included in a Unix user group that has access to the NWChem executables.

More Information

NWChem is a very complex software package, and requires practice to be used efficiently. We cannot explain it use in any detail here.