nwchem2molden: A tool for producing MOLDEN files from the NwChem results. A short how-to guide

A general idea

The data to be stored in a MOLDEN file is the reduced one-particle density matrix (1-RDM) or molecular orbital (MO) data. This implies that to produce MOLDEN file one should have:
a) molecular geometry,
b) basis set information,
c) coefficients of expansion of molecular orbitals over basis functions,
d) other properties of MOs (their energy and occupation numbers).

What NwChem can produce without its source code being ‘hacked’ is:

  • log file (typically with extension .out)
    A text file in a human-readable format which contains main results of calculations.
    With a default settings this file contains molecular geometry with acceptable accuracy and a basis set information. The latter, however, is printed in such a way that all contraction coefficients have only 7 significant digits, which might be not enough!

  • movecs file (typically with extension .movecs)

A binary file containing an information about molecular orbital expansion coefficients, their energies and occupation numbers. By default this file is being written to the permanent directory (permanent_dir) of NwChem.

To make this file readable, NwChem distribution has an utility called mov2asc; see root dir of NwChem source tar.gz file → contrib → mov2asc → mov2asc.F .
mov2asc utility has rather simple calling convention:

./mov2asc 999 file.movecs file.txt

where 999 stands for ‘Guess_NBF’ – a value, which ‘must be at least as large as the NBF (number of basis functions?) in the file to be translated.’ (see mov2asc.F) , file.movecs is a name of movecs file and the last argument, file.txt, is a name of a human-readable (ascii) representation of movecs file to be creared.

Clearly, what should the converter do in order to produce MOLDEN file, is to combine MO data from the acsii (text) version of movecs file with geometry and basis set information taken from the log file. And this is what nwchem2molden program actually does.

Some features

  • First of all, note that NwChem can use any of its basis set in two ways:
  • assuming that it uses 'Cartesian' spherical harmonics, or
  • assuming that it uses 'pure' spherical harmonics
    Therefore, additional used of molden2molden program with -cart2pure option might be necessary.

  • The next feature is that NwChem prints basis sets in its logfile in the same form as they appear in the basis set library of the program. The latter is just the same as on the Basis Set Exchange database. It should be noted however, that by no means all basis functions in this database are normalized by unity! At the same time, MO expansion coefficients are printed assuming that unity-normalized basis functions have been used. Therefore, nwchem2molden internally re-normalizes all basis functions to make them unity-normalized before printing a basis set into the MOLDEN file.

  • NwChem uses slightly different sign convention for pure spherical harmonics rather than MOLDEN does.

    ang(n,Af5) =-x*(cf(5)*z*z-cf(4)*(x*x+y*y)) v.s.  F(+1) = x*(2*z^2-0.5*y^2-0.5*x^2)/SQRT(10)
    ang(n,Ad4) =-cd(1)*x*z v.s. D(+1) = XZ

nwchem2molden accounts this for.

  • In addition to that MOLDEN file and NwChem use different normalization rules for printing basis sets:
    NwChem assumes that each primitive gaussian is taken to be unity-normalized (e.g., ), while
    MOLDEN assumes using exponent functions without any kind of pre-factor.
    Therefore, 11 P 8.06410000E-01 1.000000 line is OK for NwChem-style of writing basis sets, but not for MOLDEN-style.

  • It is also important that NwChem can use both ‘cartesian’ and ‘pure’ spherical harmonics in its basis sets. When using carterian ones, it might happen (especially for large systems) that several basis functions will be nearly linearly dependent. By default NwChem will try to eliminate linear (quasi-)dependency in this case, which will lead to different number of MOs and basis functions. nwchem2molden will warn user about this like

    WARNING: the number of orbitals is less than the number of basis functions

It might be helpful, however, to forbid NwChem eliminating linearly (quasi-)dependent basis functions by adding the following line to the job input file:

set lindep:n_dep 0

This will prevent any linear dependent basis functions from being projected out.

  • It should be noted that nwchem produces movecs files for SCF-type (i.e., Hartree-Fock and DFT) calculations only. In this case it contains true orbital energies, and occupations numbers can be equal to 2.0 (for occupied orbitals) or 0.0 (for virtual orbitals) only.
    Natural orbitals information can be extracted from NwChem results for non-SCF-type calculations in the case of using MP2 method by requesting gradient calculation

    task mp2 gradient

or geometry optimization (which also requires calculating gradients)

    task mp2 optimize

In both cases, NwChem will create a .mp2nos file which can be used for its mov2asc utility
as in the scf case. Clearly, no orbital energies (and hence no Fock matrix) can be available
in this case.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks