.. _sphx_glr_examples_dispersion:
Dispersion Interactions
=======================
Examples demonstrating GPU-accelerated computation of DFT-D3
dispersion corrections with environment-dependent C6 coefficients.
These examples show how to:
* Compute dispersion energies and forces for molecules
* Process batches of crystal structures
* Integrate with PyTorch for differentiable workflows
Examples 01 to 03 use the direct real-space ``dftd3``, which handles molecules and
open boundary conditions.
Examples 04 and 05 use ``fourier_dftd3``, which evaluates the correction on a
particle mesh with no pair cutoff on the dispersion sum. It is **periodic only**,
so both are crystal examples --- a CsCl cell built from the published DFT-D3
tables:
* ``04_fourier_dftd3_crystal.py`` --- the Torch API, and how to check mesh
sensitivity
* ``05_jax_fourier_dftd3_crystal.py`` --- the JAX API under ``jax.jit``
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /examples/dispersion/images/thumb/sphx_glr_01_dftd3_molecule_thumb.png
:alt:
:doc:`/examples/dispersion/01_dftd3_molecule`
.. raw:: html
DFT-D3 Dispersion Correction for a Molecule
.. raw:: html
.. only:: html
.. image:: /examples/dispersion/images/thumb/sphx_glr_02_dftd3_batch_crystals_thumb.png
:alt:
:doc:`/examples/dispersion/02_dftd3_batch_crystals`
.. raw:: html
DFT-D3 Dispersion Correction for Batched Crystals
.. raw:: html
.. only:: html
.. image:: /examples/dispersion/images/thumb/sphx_glr_03_jax_dftd3_molecule_thumb.png
:alt:
:doc:`/examples/dispersion/03_jax_dftd3_molecule`
.. raw:: html
JAX DFT-D3 Dispersion Correction for a Molecule
.. raw:: html
.. only:: html
.. image:: /examples/dispersion/images/thumb/sphx_glr_04_fourier_dftd3_crystal_thumb.png
:alt:
:doc:`/examples/dispersion/04_fourier_dftd3_crystal`
.. raw:: html
FourierD3: Periodic Particle-Mesh Dispersion
.. raw:: html
.. only:: html
.. image:: /examples/dispersion/images/thumb/sphx_glr_05_jax_fourier_dftd3_crystal_thumb.png
:alt:
:doc:`/examples/dispersion/05_jax_fourier_dftd3_crystal`
.. raw:: html
JAX FourierD3: Periodic Particle-Mesh Dispersion Under jax.jit
.. thumbnail-parent-div-close
.. raw:: html
.. toctree::
:hidden:
/examples/dispersion/01_dftd3_molecule
/examples/dispersion/02_dftd3_batch_crystals
/examples/dispersion/03_jax_dftd3_molecule
/examples/dispersion/04_fourier_dftd3_crystal
/examples/dispersion/05_jax_fourier_dftd3_crystal