NWChem

When in doubt, check the Documentation, and test!

Running NWChem
First, login to a system (e.g. circe) with nwchem installed.

Next, load the NWChem module and set up a working dir.

Then create a molecule (you can download an sdf file from the PDB ligand structure database listed in the course reference material (Search by molecule name -> Download Links (on left panel) -> Ideal Molfile).

Next, paste the molecule into a file, e.g.

You'll also need to paste one of the templates below (they work without changes) into an NWChem control file called en_scf.nw. Use the 'cat' command to paste into the file as above.

Finally, convert start.sdf to an xyz format for NWChem and run nwchem.

All your output will be in en_scf.log (scp/download it to your local system). In the future, use the batch queue system with

This runs on 4 cpus in parallel, so it will be faster than running (as before) directly on the login node. Of course, you'll also want to change some options in the run file eventually (especially the basis set). You can also manually edit the xyz file and scan the energy vs some coordinate. See the templates below for more ideas.

Note that you can also edit the files on your system and transfer, or edit locally on circe using your favorite linux editor. Nano is easy to use.

Energy Calculation
A simple SCF energy calculation on the input file start.xyz can be done with:

start en_scf title "Pople SCF energy" geometry units angstrom load start.xyz end basis * library 3-21G end task scf energy
 * 1)   * library cc-pvdz
 * 2)   * library 6-31G*

Geometry Optimization
Running a geometry optimization just requires replacing the task directive. Here, we've also added a block of parameters controlling the minimization algorithm.

start opt_scf title "Pople SCF geometry optimization" geometry units angstrom load start.xyz end basis * library 3-21G end driver loose maxiter 150 xyz opt end task scf optimize
 * 1)   * library cc-pvdz
 * 2)   * library 6-31G*

DFT
You can also use DFT rather than HF (SCF) by changing the appropriate keywords and adding a DFT block to specify its functional:

start opt_dft title "Pople DFT geometry optimization" geometry units angstrom load start.xyz end basis * library 3-21G end dft xc xpbe96 1.0 \ pw91lda local 1.0 \ cpbe96 nonlocal 1.0 direct iterations 150 grid fine disp vdw 2 end driver loose maxiter 150 xyz opt end task dft optimize
 * 1)  * library cc-pvdz
 * 2)  * library 6-31G*

The "xyz opt" causes NWChem to write out coordinate files, e.g. opt-001.xyz, ... as the optimization is proceeding.

Specifying Charge and Spin
Of course, we need to be able to specify the charge and total spin for most systems as well. Here's an input example appropriate for Fe3+ (5 spin-up electrons making up a half-filled d-shell):

start en_scf title "Pople SCF energy" geometry start units angstrom load start.xyz end basis * library 3-21G end set geometry start charge 3 scf sextet end task scf energy
 * 1)   Fe  library "Ahlrichs pVDZ" # better basis

Vibrational Frequencies
At a minimum, the second derivatives of the potential energy surface with respect to the nuclear coordinates make up a 3Nx3N matrix. The eigenvectors represent vibrational 'modes,' and the eigenvalues represent their force constants. Analyzing each mode as a harmonic oscillator leads to a set of vibrational frequencies, which give thermochemical information on the molecule as well as IR spectroscopic information.

From a minimized set of coordinates, all you should require is to add the appropriate task (and optionally a block of parameters)

task scf frequencies

Orbital Analysis
Molecular orbital analysis is relatively easy once the HF equations have been solved, since the linear combinations of atomic orbitals that make up each of the molecular orbitals are stored in a file (jobname).movecs. To plot the total density and the contents of orbitals numbered 54 and 55 (from checking through the HF output), use:

dplot title dens vectors en_scf.movecs LimitXYZ -5.0 5.0 30  -5.0 5.0 30   -5.0 5.0 30   spin total gaussian output dens.cube end task dplot dplot title homo vectors en_scf.movecs LimitXYZ -5.0 5.0 30  -5.0 5.0 30   -5.0 5.0 30   spin total orbitals view; 1; 54 gaussian output homo.cube end task dplot dplot Title lumo vectors en_scf.movecs LimitXYZ -5.0 5.0 30  -5.0 5.0 30   -5.0 5.0 30   spin total orbitals view; 1; 55 gaussian output lumo.cube end task dplot

The Gaussian-format cube files can be opened with pymol and visualized by typing, e.g.

isomesh mesh1, dens, 0.1, all, carve=1.6 isomesh mesh2, lumo, 0.01, all, carve=1.6 isomesh mesh3, lumo, -0.01, all, carve=1.6

to create isosurfaces at the values 0.1 for the density and $$\pm 0.01$$ for the LUMO's wavefunction.

Adam Hogan noted that (according to ) these orbitals are still associated with HF theory. To compute MP2-level quantities (natural orbitals), you instead use a matrix of derivatives of the orbitals to calculate matrix elements of an operator $$\langle \psi | O | \psi \rangle$$. To get those, you have to run task mp2 gradient, which creates (jobname).mp2nos. You then replace vectors en_scf.movecs with vectors en_scf.mp2nos inside the dens blocks above to get the high-level densities. Here's an example of using mo2nos values to get the electrostatic potential:

mp2 tight freeze atomic end task MP2 gradient set "esp:input vectors" en_scf.mp2nos esp recalculate probe  0.07 range  0.3 factor 1 spacing 0.02 end task esp