Introduction+to+DGRID

The DGRID utility reads in wavefunction coefficients for an atomic system from the output files of several popular quantum chemistry programs including Gaussian, Gamess, and more (see manual at above site for complete list). The manual is unusually good for a DIY quantum program written by a single person.

At the time of this writing I'm using version 4.6.

Installation

 * 1) download the source from the site above
 * 2) extract and run //sudo make//
 * 3) in order to enable grid creation on multiple processors at once via the **grid_para**.sh script included in the installation, open and edit it to reflect the location of your **dgrid**executable.
 * 4) this makes creating huge (~1GB grid files) feasible in < 10 minutes if you use 6 processors

It then writes files containing the value of some property of that wavefunction, for example the electron density rho, for a user-specified set of spatial coordinates.

In this guide we will focus only on rho, the total electron density, since the topology of that property is all we're interested in when we produce charge displacement (CD) curves.

Generating a grid in parallel
TPP NOTE: dgrid has essentially linear scaling up to 40 processors (from user's manual), so don't be afraid to call for extra processors, you won't be wasting RU's at OSC.

dgrid my_dgrid_grid.prop_r <<! convert cube save ! code
 * 1) make a control file like the one below
 * 2) run //dgrid_para run.par// if you named the control file //run.par//
 * 3) then enter the number of processors you want to use and hit enter
 * 4) when complete combine them with **dgrid filenameofslicenumber1 complete**
 * 5) this will output a .rho_r file that is the complete grid file
 * 6) convert to cube format as follows:
 * 7) dgrid  op1
 * 8) type convert cube and wait
 * 9) then save and wait
 * 10) then exit
 * 11) just add format=cube to the KEYWORDS section, as shown in the code below
 * 12) Automate op1 operations... USE A "HERE" FILE
 * 13) code format="bash"
 * 14) !/bin/bash
 * 1) Will work, just won't echo the words in the output.
 * 2) You'll see this...
 * 3) ==>    : done

code CONTROL FILE START


 * TITLE
 * title
 * title


 * KEYWORDS

basis=ionwat.g09 output=. format=cube


 * CHOOSE THE DESIRED PROPERTIES

compute=rho

GRID_DEFINITION: vectors
 * X Y Z
 * X Y Z

origin: -8.0 -12.0 -8.0 INTERVALS:

i-vector: 16.0 0.0 0.0 320 j-vector: 0.0 24.0 0.0 480 k-vector: 0.0 0.0 16.0 320

END

CONTROL FILE END code

What if you want to script dgrid to make it run without bugging the user for input?
To perform this, open the dgrid_para script in your favorite text editor and make the following changes: code format="bash"
 * 1) Instructions last updated: 12/21/2011 by TPP

29 dginp=$1 30 nslices=$2
 * 1) VIM line numbers included for quicker location:
 * 1) Add the following line so that you can place the number of slices you want in the command line

145 if $caltype -eq 1 ; then 146 # if  $keyword2 != "" ; then 147 #   echo "Give No. of parallel procs to start:" 148 #   read nslices 149 150  if  $keyword1 != "" ; then 151    happy=0 152    while  $happy -ne 1 && $happy -ne 2 153    do 154       echo "Total No. of planes along z =" $nplanes 155      echo "Give  No. of slices along z :" 156 157 #     read nslices
 * 1) In the following lines take note where I commented out an
 * 2) if-then statement (146) and any echo/read lines (147-48, 157)

239      if  $variant2 -eq 10 ; 240 #       echo " Select Variant: 0(def)=other 1=variant1 " 241 #       read happy 242         happy=1 243      else 244 #       echo " Select Variant: 0(def)=other 1=variant1 2=variant2" 245 #       read happy 246         happy=1 247 #       if  happy -eq 2 ; then 248 #         nslices=$nslicesx 249 #       fi 250       fi
 * 1) The following changes will prevent dgrid from asking whether you are okay with the selection of the number of
 * 2) slices you placed in the command line and sets happy=1 for all cases

266 # Check for DGrid Version 267 #DGHOME= defined above 268 #DGEXE= defined above 269 echo 270 echo "Trying to find and identify DGRID executable ...." 271 echo 272 echo "REMIND: !!!requires DGRID version 4.6 BUILD Feb 17 2011 or later!!!" 273 echo 274 which $DGHOME/$DGEXE 275 $DGHOME/$DGEXE -v 276 echo 277 # removed command to hit enter before starting
 * 1) Here you just want to flat out remove the "hit enter" command

code

Co-authored, BEB 12/12/2011 TPP 08/27/2012