Debian Codegraph @

doc/densities.rst

raw
1 QDO charge densities
2 ====================
3
4 libMBD can evaluate the charge density of the quantum Drude oscillators
5 (QDOs) that underlie the MBD model, both without the dipole coupling
6 (:meth:`~pymbd.fortran.MBDGeom.nonint_density`) and with it
7 (:meth:`~pymbd.fortran.MBDGeom.int_density`). Both take a set of points and
8 the QDO parameters and return the density at those points, so plotting is
9 just a matter of choosing a grid. The underlying derivation is given in
10 J. Hermann, *Towards unified density-functional model of van der Waals
11 interactions*, PhD thesis, Humboldt-Universität zu Berlin, 2018,
12 `doi:10.18452/18706 <https://doi.org/10.18452/18706>`_, Ch. 4, §4.3.1
13 (charge density) and §4.3.2 (first-order perturbation correction).
14
15 The QDO parameters follow from the vdW parameters via
16 :math:`\omega_A=\tfrac43 C_{6,A}/\alpha_{0,A}^2` and
17 :math:`\alpha_{0,A}=q_A^2/(m_A\omega_A^2)`. The MBD convention sets
18 :math:`m_A=1`, which gives :math:`q_A=\omega_A\sqrt{\alpha_{0,A}}`. The
19 interacting density additionally needs the coupled MBD normal modes,
20 obtained from a geometry constructed with ``get_spectrum=True``. Both
21 densities integrate to :math:`\sum_A q_A`.
22
23 The following minimal example evaluates both densities of an argon dimer
24 along the bond axis and plots the non-interacting density together with the
25 change induced by the coupling, using Matplotlib:
26
27 .. code-block:: python
28
29 import numpy as np
30 import matplotlib.pyplot as plt
31
32 from pymbd import ang, from_volumes
33 from pymbd.fortran import MBDGeom
34
35 # argon dimer along z, 4 Å apart
36 coords = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 4 * ang]])
37 alpha_0, C6, R_vdw = from_volumes(['Ar', 'Ar'], [1.0, 1.0])
38
39 # QDO parameters (mass = 1 convention)
40 omega = 4 / 3 * C6 / alpha_0**2
41 m = np.ones_like(alpha_0)
42 q = omega * np.sqrt(alpha_0 * m)
43
44 # line of points along the bond axis
45 z = np.linspace(-3, 7, 500) * ang
46 pts = np.stack([np.zeros_like(z), np.zeros_like(z), z], axis=1)
47
48 # non-interacting density
49 rho_0 = MBDGeom(coords).nonint_density(pts, q, m, omega)
50
51 # interacting density, needs the coupled MBD modes
52 geom = MBDGeom(coords, get_spectrum=True)
53 _, eigs, modes = geom.mbd_energy(alpha_0, C6, R_vdw, beta=0.83)
54 rho = geom.int_density(pts, q, m, np.sqrt(eigs), modes)
55
56 # the coupling effect is tiny, so plot it against the non-interacting
57 # density on a separate axis
58 fig, ax = plt.subplots()
59 l1, = ax.plot(z / ang, rho_0, color='C0', label='non-interacting')
60 ax.set_xlabel(r'$z$ (Å)')
61 ax.set_ylabel(r'$n_0(z)$ (a.u.)', color='C0')
62 ax.tick_params(axis='y', labelcolor='C0')
63
64 ax2 = ax.twinx()
65 l2, = ax2.plot(z / ang, rho - rho_0, color='C1',
66 label='interacting − non-interacting')
67 ax2.set_ylabel(r'$n(z) - n_0(z)$ (a.u.)', color='C1')
68 ax2.tick_params(axis='y', labelcolor='C1')
69
70 ax.legend(handles=[l1, l2], loc='lower center',
71 bbox_to_anchor=(0.5, 1.0), ncol=2, frameon=False)
72 fig.tight_layout()
73 plt.show()
74
75 which produces:
76
77 .. figure:: _static/qdo-density.png
78 :alt: Non-interacting QDO charge density of an argon dimer and the change
79 induced by the dipole coupling, along the bond axis
80 :width: 100%
81
82 Non-interacting QDO charge density of an argon dimer (left axis) and the
83 change induced by the dipole coupling (right axis), along the bond axis.
84
85 For a weakly bound system such as the argon dimer the coupling barely
86 perturbs the density — note the four-orders-of-magnitude difference between
87 the two axes. The coupling depletes density at the oscillator centers and
88 shifts it into the bond region; the effect grows for more polarizable,
89 strongly coupled systems.