.. _17_reduced_density_gradient: .. include:: ../../examples/17_reduced_density_gradient/README.rst ---- .. code-block:: python import matplotlib.pyplot as plt from eminus import Atoms, SCF from eminus.tools import get_reduced_gradient from eminus.units import ang2bohr Do an RKS calculation for hydrogen with the given bond distance .. code-block:: python atoms = Atoms("H2", [[0.0, 0.0, 0.0], [0.0, 0.0, ang2bohr(0.75)]], center=True) scf = SCF(atoms) scf.run() One can even use thermal exchange-correlation functionals using Libxc One example would be the following, where the temperature parameter of the functional gets modified (in Hartree) .. code-block:: python # scf = SCF(atoms, xc=":LDA_XC_GDSMFB") # print(scf.xc_params_defaults) # scf.xc_params = {"T": 0.1} # scf.run() Calculate the truncated reduced density gradient .. code-block:: python s = get_reduced_gradient(scf, eps=1e-5) Write n and s to CUBE files One can view them, e.g., with the :code:`eminus.extras.view` function in a notebook .. code-block:: python # scf.write("density.cube", scf.n) # scf.write("reduced_density_gradient.cube", s) Plot s over n Compare with figure 2 of the supplemental material Find the plot named :code:`density_finger.png` .. image:: density_finger.png :align: center .. code-block:: python plt.style.use("../eminus.mplstyle") plt.figure() plt.scatter(scf.n, s, c=s) plt.xlabel("$n$") plt.ylabel("$s$[$n$]") plt.savefig("density_finger.png") Download :download:`17_reduced_density_gradient.py <../../examples/17_reduced_density_gradient/17_reduced_density_gradient.py>` :download:`density_finger.png <../../examples/17_reduced_density_gradient/density_finger.png>`