Tuesday 10 June 2014

4. Energy optimization of molecule geometry with nwchem

In this lesson I will introduce a great opensource suite for classical and quantic chemical computation, called nwchem. If you are not familiarized with this application, I recommend to check the Getting Started section of the documentation before continue reading this post. Here i will mention only the most basic concepts.

nwchem reads all the parameters needed for the computation from an input file with extension nw. In order to feed nwchem with the molecule geometry, we can write the coordinates in the input file, in simple xyz format, or load it from another file. As in out first post, Visualizing a 3D structure of a molecule with jmol, we will start geometry specification from a smiles file. Lets suppose we want to minimize the configuration of L-proline (smiles: [O-]C(=O)C1CCC[NH2+]1), so we save the smiles string into a file, and convert to xyz using babel:
linux$ babel l-proline.smi l-proline.xyz --gen3d
And the following is the nwchem input file for optimizing configuration:
geometry
  load format xyz l-proline.xyz
end
basis
  * library 6-31g
end
task scf optimize
Inside the geometry directive we instruct nwchem to load molecular geometry from our xyz file.

Inside the basis directive we specify the basis set to use for modeling the electronic orbitals of each atom class in the molecule. There are many different basis sets. You have yo choose in terms of compromise between speed and precision. The set cc-pvdz is an acronym for the correlation-consistent Double-zeta, and it is the minimal of the correlation-consistent group of basis sets, so it is the faster and less accurate of them, but still good quality for most serious applications that involves atoms up to the 3rd period. However, in many systems still can demand lot of time, specially if the input xyz file is very far from optimized configuration. So for this exercise we will choose a quite fast (but less accurate) model: 6-31g. We apply this model to all the atoms, using the wildcard *.

With the task directive we invoke the Hartree-Fock (SCF) method for optimizing the molecular geometry by energy minimization.

Save the file as l-proline.nw and then run
linux$ nwchem l-proline
The computations are very CPU intensive. They imply quantum mechanical numeric methods with several levels of iterations, and increases geometrically with the number of atoms involved, so they will take a time, which depends mainly on the CPU speed on your computer and the geometry of the input file.

If you get an error saying that optimization failed because computation didn't reach convergence criteria, don't worry. Just run the command again, until you achieve the default set convergence threshold. nwchem stores iteration vectors state so when you run the command again, you will not start from beginning, but from the point the previous run finished. Even more, the saved vector files will allow you to perform further calculations (see following lessons).

No comments:

Post a Comment