Q-Chem: How to run Q-Chem without "$QC/bin/qchem" script

Q-Chem: How to run Q-Chem without "$QC/bin/qchem" script

A "qchem" script ($QC/bin/qchem) is usually used to execute Q-Chem program for serial and parallel calculations. It is possible to execute Q-Chem program by directly calling its executable, without touching a qchem script. This post would like to describe how to do this, which is useful for running Q-Chem job in parallel using MPI protocol on computing cluster.

Step 1: Setting up Q-Chem environment variable

There is a few environment variables you have to set up.

Edit your .bashrc file

vi $HOME/.bashrc

Suppose that Q-Chem is installed at /usr/local/qchem. Firstly, we do define the $QC environment variable in your .bashrc

export QC=/usr/local/qchem

Then add a full path of Q-Chem executable to $PATH. The Q-Chem executable should be located at $QC/exe/qcprog.exe

export PATH=$QC/exe/:$PATH

Add following command to set $QCAUX variable

export QCAUX=/opt/qchem/aux/4.0

Then activate .bashrc file using source command

source $HOME/.bashrc


Step 2: Run Q-Chem

  • Serial method

To run Q-Chem in serial method (1 processor), you can simply call Q-Chem without specifying any number of thread or processor core.

Here is syntax of command to run Q-Chem using its executable file.

$QC/exe/qcprog.exe input.inp SCRATCH_FOLDER

For example,

$QC/exe/qcprog.exe water_opt_b3lyp.inp /scratch/rangsiman/qchem/

Run in background and print the calculation results to output.log file.

$QC/exe/qcprog.exe water_opt_b3lyp.inp /scratch/rangsiman/qchem/ >& water_opt_b3lyp.log &


  • Parallel method

To run Q-Chem in parallel method using its built-in OpenMP, you have to set the number of thread that you want to run with.

Here is a command syntax to set the value of $QCTHREADS environment variable to the number before running.

export QCTHREADS=N

where N = integer number. Sensible values are like 2, 4, 6, 8, 12, ... (your might already know this). For example,

export QCTHREADS=4

Then run a calculation using the following command as you normally use Q-Chem

$QC/exe/qcprog.exe water_opt_b3lyp.inp /scratch/rangsiman/qchem/

When $QCTHREADS is set to integer number that greater than 1, Q-Chem will switch to use OpenMP method automatically.

To check if your calculation has been running in parallel with OpenMP, you can look at the beginning of output file.


Rangsiman Ketkaew