# Spectroscopic Constants for Diatomics

Code author: Andrew C. Simmonett

`psi4.driver.diatomic.``anharmonicity`(rvals, energies, plot_fit)

  Generates spectroscopic constants for a diatomic molecules. Fits a diatomic potential energy curve using a weighted least squares approach (c.f. http://dx.doi.org/10.1063/1.4862157, particularly eqn. 7), locates the minimum energy point, and then applies second order vibrational perturbation theory to obtain spectroscopic constants. Any number of points greater than 4 may be provided, and they should bracket the minimum. The data need not be evenly spaced, and can be provided in any order. The data are weighted such that those closest to the minimum have highest impact.

  A dictionary with the following keys, which correspond to spectroscopic constants, is returned:

  Parameters:

  - rvals (list) – The bond lengths (in Angstrom) for which energies are provided, of length at least 5 and equal to the length of the energies array
  - energies (list) – The energies (Eh) computed at the bond lengths in the rvals list
  - plot_fit (string) – A string describing where to save a plot of the harmonic and anharmonic fits, the inputted data points, re, r0 and the first few energy levels, if matplotlib is available. Set to ‘screen’ to generate an interactive plot on the screen instead. If a filename is provided, the image type is determined by the extension; see matplotlib for supported file types.

  Returns: | (dict) Keys: “re”, “r0”, “we”, “wexe”, “nu”, “ZPVE(harmonic)”, “ZPVE(anharmonic)”, “Be”, “B0”, “ae”, “De” corresponding to the spectroscopic constants in cm-1