Running the QM calculation (Constrained optimization in Gaussian)
1. Get an xyz file, in angstroms, with added hydrogens - you can do this in ATOMS.
File -> Export
File format: XMOL XYZ (.xyz)
Uncheck Strip non-alphabetic characters from label
Click OK and save file
Open .xyz file in notepad
2. Use molden to convert to z-matrix form
Create a text file with the atomic coordinates with this format:
[# atoms] Atomic Symbol x y z
For example, the 1,4-diaminobutane molecule looks like:
20 C 8.80400 0.86782 -0.25344 C 9.03731 2.32893 -0.60590 C 9.72756 3.91395 -2.40286 C 9.49424 2.45284 -2.05040 N 8.72585 0.68120 1.22307 N 9.80570 4.10056 -3.87937 H 8.81739 2.08695 -2.64090 H 8.20813 2.82176 -0.47808 H 9.53833 0.32475 -0.60116 H 7.97078 0.58451 -0.65377 H 9.54027 0.96655 1.62138 H 8.00707 1.19682 1.56850 H 8.58093 -0.23622 1.42031 H 8.99128 3.81521 -4.27768 H 10.52449 3.58495 -4.22480 H 9.95062 5.01799 -4.07661 H 8.99322 4.45702 -2.05514 H 10.56078 4.19726 -2.00253 H 10.32342 1.96001 -2.17822 H 9.71416 2.69482 -0.01540
Open the xyz file with molden (molden [filename])
Click ZMAT Editor
Change Format to Gaussian.
Type in the file name and click Write Z-Matrix
3. To fix atoms in Gaussian optimation (note: blank lines are important)
#p B3LYP/6-31G* opt(ModRedundant) ---comment line here, e.g., "optimize molecule geometry" +2 1 ---z-matrix here 1 B 2 B 3 B 4 B 5 B * F
(this will fix atoms 1,2,3,4,5 specified in your z-matrix)
4. Run Gaussian (e.g. on ws* machines) to optimize your molecule
tcsh setenv g03root /packages/gaussian source $g03root/g03/bsd/g03.login g03 my_gaussian_file.com
5. Using the final otpimized geometry, follow these steps to generate a suitable wavefunction file (.wfn). Essentially all you add is after the list of coordinates, type [filename.wfn]. Your G03 input file should look something like this:
#p B3LYP/6-311+G(d,p) output=WFN SP --comment line here, e.g. "output wavefunction for ELF analysis with TopMod or 13dapH2" +2 1 ---previously optimized coordinates here myoutput.wfn
By adding myoutput.wfn, running this through Gaussian will automatically make the .wfn file.
You can find the optimized coordinates at the end of the Gaussian output file. You no longer need to use the Z-Matrix; you can use the Cartesian coordinates. Be sure to use the coordinates in Standard Orientation or else when you try to view the calculated ELF in gopenmol, the ELF will not be oriented with you molecule.
Compiling the ELF-generation package (only needs to be done once)
5. Download/install the TopMod package, following the directions in the README file. For the wsx machines, just copy the Makefile.linux file to Makefile and "make all". Works fine with g77, gcc.
6. You will also need to compile the sbf_to_cube.f program. This converts the sbf output from top_grid into a Gaussian-format CUBE file (which we know how to visualize. Compile it by:
f77 -o sbf_to_cube sbf_to_cube.f
Generating the ELF from the Gaussian output
7. Generate the ELF by following the "Hard way" directions in this document. Unfortunately, I can't find the elf.pl file online anywhere, as it does look like it makes life easier.
Run top_grid - this is an interactive program
First it asks for the .wfn file - type in the file created in step 5.
Enter y when it asks to output density
The next two steps you may have to fiddle around with to produce a figure to your satisfaction.
It asks for the origin - you can use the origin values that it gives you.
Then it asks for the lengths of the edge of a box enclosing your molecule in which to calculate ELF values - you may need to try varying lengths, but a good starting point might be to take the lengths it gives you and multiply by ~1.5
The last step, it asks for the grid size. For a rough calculation, you can do one point per Angstrom. For a finer grid, you can try 5 points per Angstrom.
8. Convert the sbf output (output_elf.sbf) to CUBE format, by running "sbf_to_cube". The program will ask for the name of the .wfn and .sbf file. Just type these in.
Converting the ELF output into a more usable format
9. You will need to convert from CUBE to the PLT format used by gOpenMol. Start by running "gopenmol" (installed on all the wsx machines). Then select the "Run>gCube2plt/g94cub2pl(cube)" menu item. This will bring up a new window. Use the "Browse" button to select the file names. Select "output_elf.cube" for the input and a name ending in ".plt" for the output file name. Be sure that "Gaussian98" is sellected and "gcube2plt" is selected. Then hit "Apply". It should tell you about the maximum and minimum values. For ELF, these should be in [0,1]. You can now close this window, if you like.
How to Visualize the Results
10. To visualize the data, go back to the gOpenMol window, and select the "File>Import>Coords…" menu item. Select the the cartesian coordinate (XYZ) file, corresponding to your structure. It should now be on screen as a stick figure. One important thing to note: This must be in the "Standard Orientation" listed in your Gaussian output file, in order for the atoms to match up to the WFN/CUBE orientation.
11. To load the contour, select "Plot>Contour" menu item. Use the "Browse" button to select the "plt" file you generated in step 10. Then hit the "Import" button. To draw a contour, go to the section of the "Contour Control" window that says "Contour levels". Enter a value for the contour isosurface, and select a color for this contour by clicking on the "Colour" button. When you are ready to visualize, click the "Apply" button at the bottom of the "Countour Control" window.
12. Finally, you can drag this around to change your view. When you are ready to export a picture, go to "File>Hardcopy…" to output in JPG or PS format. You can also change the background color by "View>Background Colour>Colour…"