NMR shielding tensors and chemical shifts

In this tutorial

You compute GIAO NMR shielding tensors of water and read the output. Then you turn shieldings into \(^{13}\)C and \(^1\)H chemical shifts against TMS for nine small molecules and compare three functionals with experiment. Time: 0.1 s for water; the nine PBE0 optimizations with NMR take 17 min in total (32 cores, most of it TMS and cyclohexane); the PBE and r\(^2\)SCAN single points take 1.5 min. Files: h2o_nmr.yaml, h2o_nmr.out (reference output), opt_nmr.yaml, nmr_pbe.yaml, shifts_exp.txt, the starting geometries files/*.xyz, run.sh.

The input

One key in the analysis section switches NMR on (files/h2o_nmr.yaml, PBE0/def2-TZVP, the water geometry of tutorial 1):

functional:
  backend: libxc
  exchange: HYB_GGA_XC_PBEH
  correlation: none

basis:
  name: def2-TZVP
  file: basis/def2-TZVP.nw

scf:
  conv_tol: 1.0e-9

analysis:
  nmr: true

After the SCF, run_dft computes the shielding tensor \(\sigma_N\) of every nucleus. The induced field at nucleus \(N\) is \(\mathbf B_{\rm ind}=-\sigma_N\mathbf B\), so a positive shielding means the electrons screen the nucleus. The basis functions are gauge-including atomic orbitals (GIAOs). Each basis function carries its own magnetic phase factor, so the result does not depend on the origin of the vector potential.

What is supported:

  • LDA, GGA and meta-GGA functionals, and global and range-separated hybrids.

  • Closed and open shells.

  • All-electron, non-relativistic, collinear references.

ECP, ZORA/X2C and noncollinear runs are skipped with a message. For LDA and GGA the first-order orbitals follow from the unperturbed orbital energies (no iterations). Hybrids need coupled-perturbed (CPHF) iterations, because the exchange responds to the field.

Every run_dft build has NMR. A build with libcint (build_run_dft_libcint.sh) computes the two-electron GIAO terms faster.

The output

   nmr:   one-electron GIAO integrals at     0.00 s
   nmr:   J/K (ig) at     0.03 s
   nmr: first-order Fock matrices built in     0.05 s
   nmr: MO transformation done at     0.05 s
   nmr: CPHF iteration   1   max change   2.38E-02
   ...
   nmr: CPHF iteration   7   max change   3.04E-09
   nmr: first-order orbitals done at     0.11 s

  NMR shielding tensors (GIAO, ppm)
 ================================================================
  atom 1   Z = 8
    isotropic =     332.9517   dia =     386.1424   para =     -53.1908
          309.4316       -0.0000        0.0000
            0.0000      360.7396        0.0000
           -0.0000        0.0000      328.6838
    principal values (symmetric part):     309.4316    328.6838    360.7396   anisotropy =      41.6819
  atom 2   Z = 1
    isotropic =      31.6508   dia =      29.9221   para =       1.7286
           24.5141       -0.0000        0.0000
           -0.0000       39.2576       -7.3123
            0.0000       -9.0891       31.1806
    principal values (symmetric part):      24.5141     26.0779     44.3603   anisotropy =      19.0643
isotropic

\(\sigma_{\rm iso}=\tfrac13{\rm tr}\,\sigma\). A fast-tumbling molecule in solution or in the gas phase shows only this value.

dia and para

The diamagnetic part is the response of the unperturbed density (Lamb’s term for an atom). The paramagnetic part comes from the field mixing occupied and virtual orbitals. Only the sum is physical: the split depends on the gauge, so compare the parts only with GIAO results of other codes.

The 3 × 3 block

The full tensor in the input frame (rows: direction of the applied field, columns: direction of the nuclear magnetic moment). It need not be symmetric; the H tensors here are not (\(-7.31\) vs \(-9.09\)).

principal values, anisotropy

The eigenvalues of the symmetric part, \(\sigma_{11}\le\sigma_{22}\le\sigma_{33}\), and \(\Delta\sigma=\sigma_{33}-\tfrac12(\sigma_{11}+\sigma_{22})\). Solid-state NMR and liquid-crystal NMR measure these.

The CPHF lines appear only for hybrids. max change is the largest change of the first-order orbital coefficients; the iterations stop at \(10^{-9}\).

From shieldings to chemical shifts

Spectra report the chemical shift relative to a reference compound,

\[\delta = \sigma_{\rm ref}-\sigma ,\]

and for \(^1\)H and \(^{13}\)C the reference is tetramethylsilane (TMS). We compute TMS and nine molecules (methane, ethane, cyclohexane, acetonitrile, acetone, methanol, ethylene, benzene) with the same method. Errors of the method then partly cancel in the difference.

Shieldings are sensitive to bond lengths, so each molecule is first optimized and then the NMR is computed in the same run (files/opt_nmr.yaml):

job:
  task: optimize

system:
  charge: 0
  unpaired_electrons: 0
  geometry_file: tms.xyz

functional:
  backend: libxc
  exchange: HYB_GGA_XC_PBEH
  correlation: none

basis:
  name: def2-TZVP
  file: basis/def2-TZVP.nw

scf:
  conv_tol: 1.0e-9

analysis:
  nmr: true

With job: task: optimize, the analysis runs once, at the optimized geometry. run.sh uses this input for every molecule (it replaces tms.xyz; the starting geometries are in files/*.xyz). TMS gives the two reference values:

  atom 1   Z = 14
    isotropic =     332.9108   dia =     882.6697   para =    -549.7589
  ...
    isotropic =     188.0359  (each of the four C)
    isotropic =      31.74    (the twelve H, 31.7408 to 31.7442)

The twelve H of TMS differ by 0.003 ppm, because a static structure has no free methyl rotation. In the spectrum all equivalent nuclei give one line, so we average them, both in TMS and in the other molecules (the three H of a methyl group, the axial and equatorial H of cyclohexane, which exchange by ring flipping).

shifts_exp.txt lists the groups (the atoms to average) and the experimental shifts in CDCl\(_3\) from Fulmer et al., Organometallics 29, 2176 (2010). dftsw27plot.py shifts reads the outputs and the table:

$ python3 tutorials/tools/dftsw27plot.py shifts files/shifts_exp.txt \
      --set PBE    pbe/tms.out    'pbe/{m}.out' \
      --set r2SCAN r2scan/tms.out 'r2scan/{m}.out' \
      --set PBE0   pbe0/tms.out   'pbe0/{m}.out' -o shifts.png
molecule   group    el       PBE    r2SCAN      PBE0       exp
ch4        CH4      C      -8.47     -6.66     -5.89     -4.63
c2h6       C2H6     C       8.40     11.10      8.98      6.89
c6h12      C6H12    C      31.71     34.42     30.44     26.94
ch3cn      CH3CN    C      -0.45      2.27      0.76      1.89
acetone    (CH3)2CO C      30.18     31.16     30.95     30.92
ch3oh      CH3OH    C      53.22     55.70     52.04     50.41
ch3cn      CH3CN    C     116.43    117.42    121.01    116.43
c2h4       C2H4     C     127.94    126.56    130.57    123.13
c6h6       C6H6     C     130.83    129.93    134.02    128.37
acetone    (CH3)2CO C     208.59    205.82    211.55    207.07
ch4        CH4      H       0.09      0.16      0.18      0.22
c2h6       C2H6     H       0.91      1.03      0.90      0.87
c6h12      C6H12    H       1.59      1.76      1.48      1.43
ch3cn      CH3CN    H       1.72      1.94      1.72      2.10
acetone    (CH3)2CO H       2.10      2.25      2.06      2.17
ch3oh      CH3OH    H       3.74      3.91      3.54      3.49
c2h4       C2H4     H       5.81      6.13      5.82      5.40
c6h6       C6H6     H       7.66      8.06      7.73      7.36
C PBE: mean absolute error 2.48 ppm, max 4.81 ppm
C r2SCAN: mean absolute error 2.69 ppm, max 7.48 ppm
C PBE0: mean absolute error 3.18 ppm, max 7.44 ppm
H PBE: mean absolute error 0.22 ppm, max 0.41 ppm
H r2SCAN: mean absolute error 0.33 ppm, max 0.73 ppm
H PBE0: mean absolute error 0.18 ppm, max 0.42 ppm

The PBE and r\(^2\)SCAN runs (files/nmr_pbe.yaml) are single points at the PBE0 geometries, so only the functional changes.

../../_images/shifts.png

Fig. 45 Calculated vs experimental chemical shifts (def2-TZVP, PBE0 geometries). The line is \(y=x\).

What the numbers show:

  • The trends are right. The calculation spans the 212 ppm range of \(^{13}\)C, from methane at −5 ppm to the carbonyl carbon at 207 ppm, and the 7 ppm range of \(^1\)H. It also gets the ordering right. The aromatic protons of benzene (7.4 ppm) appear 2 ppm downfield of those of ethylene (5.4 ppm), because the ring current of the \(\pi\) electrons deshields them.

  • The sp² carbons come out too high, by 4–7 ppm with PBE0. The paramagnetic term depends on the gap between occupied and virtual orbitals, and all three functionals underestimate the \(\pi\to\pi^*\) and \(n\to\pi^*\) gaps somewhat. A larger basis and solvent effects move the numbers by a few ppm as well.

  • A hybrid is not automatically better for shifts of small organic molecules. Here PBE has the smallest \(^{13}\)C error and PBE0 the smallest \(^1\)H error. For production work, linear scaling against a set of experimental shifts (fit \(\delta_{\rm exp}=a\,\sigma+b\)) and a shielding-optimized basis remove most of the systematic error.

The paramagnetic part dominates for a carbonyl carbon. In acetone (atom 1), \(\sigma_{\rm dia}=246.4\) and \(\sigma_{\rm para}=-269.9\) ppm, and the total is \(-23.5\) ppm. A low-lying \(n\to\pi^*\) excitation mixes into the ground state in the field, and the tensor is strongly anisotropic (principal values \(-107.3\), \(-65.4\) and \(102.2\) ppm).

Validation

The shieldings agree with PySCF (prop.nmr) to about \(10^{-3}\) ppm, the difference of the two integration grids. examples/nmr/ has the inputs and the reference table. For example, LDA water in 6-31G** gives O 349.6617 ppm (PySCF 349.6625) and H 31.7853 ppm (PySCF 31.7853).

Things to try

run.sh --exercises runs these.

1. The gauge origin does not matter

Shift the water molecule by (1.3, −0.7, 2.1) bohr. Without GIAOs this would change the shielding by many ppm. Here O goes from 332.9517 to 332.9560 ppm and H from 31.6508 to 31.6507 ppm. The remaining 0.004 ppm comes from the numerical integration of the exchange-correlation terms.

2. Basis-set convergence

Oxygen in water, PBE0, at the same geometry:

basis

\(\sigma_{\rm iso}\)(O)

\(\sigma_{\rm iso}\)(H)

def2-SVP

344.63

31.60

def2-TZVP

332.95

31.65

aug-pc-2

330.71

31.13

Heavy-atom shieldings converge slowly, because the paramagnetic term needs tight polarization functions near the nucleus. Absolute shieldings need at least triple-zeta quality; shifts converge faster, because the errors cancel against the reference.

3. Other functionals

Replace the functional block of files/nmr_pbe.yaml, for example with the range-separated hybrid \(\omega\)B97X (backend: libxc, exchange: HYB_GGA_XC_WB97X, correlation: none). The CPHF iterations then include the long-range exchange.

Summary

  • analysis: nmr: true prints the GIAO shielding tensor, its isotropic value, its principal values and its anisotropy for every atom.

  • Shifts are differences of shieldings: compute the reference (TMS) with the same method and average equivalent nuclei.

  • Optimize the geometry with the same method. job: task: optimize with nmr: true computes the shieldings at the optimized geometry.

  • Expect a few ppm for \(^{13}\)C and a few tenths of a ppm for \(^1\)H with DFT and a triple-zeta basis.