Topics Map > SCS Computing > HPC - Clusters
Topics Map > SCS Computing > How-To
Tutorial - Simulating Vibrationally-resolved Electronic Spectra Using Gaussian
Simulating Vibrationally-resolved Electronic Spectra Using Gaussian
Yun Xia, Ashley M. De Lio, & Taras V. Pogorelov
Department of Chemistry, School of Chemical Sciences
University of Illinois at Urbana-Champaign
Edition 1, June 07, 2020. Updated May 17, 2024.
This is a tutorial designed to introduce users to simulating vibrationally-resolved electronic spectra utilizing the Gaussian 16 software package (1). Specifically, the simulation of vibrationally-resolved UV-Vis absorption spectra is performed on an anisole molecule. Users are expected to have a foundation in Unix/Linux. See for example our Primer (http://pogorelov.scs.illinois.edu/tutorials/)
Note: If time is a constraint, you may use the previously generated output and checkpoint files that accompany this tutorial.
Outline: To generate the vibrationally-resolved UV-Vis abosrption spectra, three steps are generally needed:
- Geometry optimization and calculation of frequencies for the Initial state.
- Geometry optimization and calculation of the frequencies for the final state.
- Generation of the vibrationally-resolved UV-Vis absorption spectra.
In the first two steps, we calculate the frequencies and save the frequency information in the checkpoint files, which will be used in step 3 to generate the spectra.
1. Software. Available on the SCS cluster: Gaussian (1), GaussView (2), and Vim. Personal computer: xserver (Xming for a Windows) or Terminal and xQuartz (Mac), Origin (3) or other graphing software. This tutorial can be completed on iMacs in the SCS VizLab (151 Noyes Lab) or with personal computers with Windows or Mac OS. Small modifications might be needed when used on other computers. For full instructions on x-forwarding see SCS Clusters
2. Starting up. Open Putty (or Mac OS Terminal) window as well as your Xserver (xming or xquartz). Connect to the cluster with X-forwarding as described in the linked article above. If connecting outside of campus, connect to the VPN first.
Make a directory for this tutorial:
> mkdir uvvis-spectra-tutorial
Change your directory to the new directory you just made:
> cd uvvis-spectra-tutorial
Start up a session of Gaussian with the following command (subject to the Linux shell your account uses – check by typing
> module load gaussian/g16
Open GaussView with the following command:
> gv
Note: You may encounter the following error message:
Failed to locate Gaussian scratch directory
Ignore this error by simply hitting the "OK" button. GaussView should open.
3. Constructing a molecule. Construct your molecule of interest in the blue window (which should initially be blank):
Right click anywhere on the blue window and select "Builder." Click "Ring fragment." Right click, select "Builder" again, and then click "Fragment" and select benzene. Click anywhere in the blue window to place the benzene ring.
Now, right click again and select "Builder". Select "Element Fragment" which should pull up a periodic table. Select the oxygen fragment on the far right. Click on any hydrogen atom of the ring to substitute one of the hydrogens for a hydroxyl group. Then select the carbon fragment on the far right. Click on the hydrogen atom of the hydroxyl group to substitute this hydrogen atom for a methyl group.
Your anisole molecule should look like this:
Note: Anisole has a planar conformation of the methoxy group, for experimental evidence please refer to Phys. Chem. Chem. Phys. 2001, 3, 1407-1410. (4)
4. Optimization and Frequency Calculations of the initial state in the gas phase. Now save the structure you just constructed as the Gaussian input file File –> Save anisole_S0.com. Then quit GaussView and go back to the terminal window.
Type the following command to edit the input file:
> vim anisole_S0.com
Replace the route section (line 2) with the keywords below.
Vim/vi refresher: move cursor to the line 2, press "dd", to delete the line, press i to enter the Insert mode of vim/vi, copy and paste the line below. Now quit Vim/vi: press Esc to switch to the Command mode and press ":" then type wq (for write and quit) and press enter.
#p opt Freq=SaveNM B3LYP/6-31G(d) geom=connectivity
These keywords will start a Gaussian job which first optimizes the geometry for the initial state and then calculates the frequencies of the optimized geometry. By using the option freq=SaveNM, the frequency information will be saved in the checkpoint file anisole_S0.chk. For this job we choose B3LYP as the functional and 6-31G(d) as the basis set, which should be sufficient to give relatively accurate results. Save the input file and quit Vim.
Submit the calculation to Gaussian with the following command:
> submit-g16 -n # -q queuename anisole_S0.com
Replace the "#" in the command with the number of cores desired to be utilized for the calculation. Replace queuename with the name of the queue you wish to use. See the cluster document for a list of queues or type qstat -c . The number of cores should be consistent to what you specify in the Gaussian input file (#nprocshared=). Do not exceed 16.
After submission, check the progress of the calculation with
> qstat -u yournetid
Once your netid no longer appears, the calculation has completed. Hint: if the command tail *log shows a quote then your Gaussian job finished properly.
5. Optimization and Frequency Calculations of the final state in the gas phase. Open GaussView, type "Ctrl + O" and select the Gaussian output file anisole_S0.log. Click "Open" and you will see the optimized structure of the initial state. Type "Ctrl + S" and save this file as a new Gaussian input file anisole_S1.com. Quit GaussView and return to the terminal window.
Type the following command to edit the input file:
> vim anisole_S1.com
Replace the route section with the following keywords:
#p TD(nstates=6, root=1) B3LYP/6-31G(d) opt Freq=saveNM geom=connectivity
These keywords will start a Gaussian job which first optimizes the geometry for the final state (the first excited state) and then calculates the frequencies of the optimized geometry. This job is based on the time-dependent density functional theory, which is the keyword TD. The value of root is the excited state of interest. For example, in this job, root equals to 1, so the structure of molecule will be optimized for the first excited state. The value of nstates must be larger than the value of root. Generally, you can let nstates = root + 5. Again, the frequency information will be saved in the checkpoint file anisole_S1.chk. We choose B2LYP as the functional and 6-31(d) as the basis set, which is consistent to what we did for the initial state. Save the input file and quit Vim.
Submit the calculation to Gaussian with the following command:
> submit-g16 -n # -q queuename anisole_S1.com
Once that job is complete, open GaussView, type "Ctrl + O" and select the Gaussian output file anisole_S1.log. Click "Results" and select "UV-VIS", the UV-Vis absorption spectra generated by GaussView is as follows:
The excitation energy of the first excited state is 258.45 nm, and apparently it is not the maximum absorption peak.
6. Generation of the vibrationally-resolved UV-Vis absorption spectra. Quit GaussView and return to the terminal window. Create a Gaussian input file by typing the following command:
> vim spectra.com
The input file is as follows:
Link 0 Commands %chk=anisole_S0.chk #p geom=AllCheck Freq= (ReadFC, FC, SaveNM) NoSymm anisole_S1.chk
Copy this text into your spectra.com input file. Remember to leave a blank line at the end of the input file. The options geom=AllCheck and Freq=ReadFC are described in the Gaussian manual. Basically, they let us extract all necessary data from the checkpoint file given in the line starting by %chk= without doing the frequency calculation again. The option Freq= FC means we will utilize the Franck-Condon method to compute the amplitudes for electronic transitions between the initial and final states. Save the input file and quit Vim.
Submit the calculation to Gaussian with the following command:
> submit–g16 -n # -q queuename spectra.com
7. Description of the output and create the spectra. Open the output file spectra.log by typing the following command:
> vim spectra.log
Search for the words "Final Spectrum", and the spectrum generated by Gaussian is printed as follows:
The first column is the value of energy in cm-1. The second column is corresponding molar absorption coefficient in dm3 . mol-1 . cm-1. You can turn the energy (cm-1) into wavelength (nm) simply by
Then you can use Origin or any other graphing software to plot the spectra which is presented as a column in ASCII format. Take Origin for example, copy the two columns of data into Origin:
Type the "Long Name" and "Unites" for axis X and axis Y. Then type "Ctrl + A". Right click, select "Plot", "Line", "Line". The vibrationally-resolved UV-Vis absorption spectra of anisole is as follows:
There are two main absorption peaks at 253 nm and 259 nm. Note that this time there are more details of the S0 –> S1 absorption peak which cannot be found in the spectra we generated first because here we take different vibrational states of the initial and final states into account.
Summary. We covered the three steps needed to calculate vibrationally-resolved electronic spectra.
Contact. If you find errors/typos or have suggestions or comments on the material in this tutorial, please contact us at pogorelo@illinois.edu. See more tutorials at the Pogorelov Lab website: http://pogorelov.scs.illinois.edu/
References.
- Gaussian 09, Revision A.01, M. J. Frisch, G. W. Trucks, H. B. Schlegel, G. E. Scuseria, M. A. Robb, J. R. Cheeseman, G. Scalmani, V. Barone, G. A. Petersson, H. Nakatsuji, X. Li, M. Caricato, A. Marenich, J. Bloino, B. G. Janesko, R. Gomperts, B. Mennucci, H. P. Hratchian, J. V. Ortiz, A. F. Izmaylov, J. L. Sonnenberg, D. Williams-Young, F. Ding, F. Lipparini, F. Egidi, J. Goings, B. Peng, A. Petrone, T. Henderson, D. Ranasinghe, V. G. Zakrzewski, J. Gao, N. Rega, G. Zheng, W. Liang, M. Hada, M. Ehara, K. Toyota, R. Fukuda, J. Hasegawa, M. Ishida, T. Nakajima, Y. Honda, O. Kitao, H. Nakai, T. Vreven, K. Throssell, J. A. Montgomery, Jr., J. E. Peralta, F. Ogliaro, M. Bearpark, J. J. Heyd, E. Brothers, K. N. Kudin, V. N. Staroverov, T. Keith, R. Kobayashi, J. Normand, K. Raghavachari, A. Rendell, J. C. Burant, S. S. Iyengar, J. Tomasi, M. Cossi, J. M. Millam, M. Klene, C. Adamo, R. Cammi, J. W. Ochterski, R. L. Martin, K. Morokuma, O. Farkas, J. B. Foresman, and D. J. Fox, Gaussian, Inc., Wallingford, CT, 2016.
- GaussView, Version 5.0.9, Roy Dennington, Todd A. Keith, and John M. Millam, Semichem Inc., Shawnee Mission, KS, 2016.
- Origin, Origin 7.5, OriginLab Corp., Northampton, MA, 2003.
- . C. G. Eisenhardt, G. Pietraperzia, M. Becucci. The High-Resolution Spectrum of the S1 ß S0 Transition of Anisole. Phys. Chem. Chem. Phys. 2001, 3, 1407-1410.