Author: Judith M. Leson
Repository: jmleson:multipole_interactions
Related Work: Dissertation: A Quantum-Chemical Analysis of Long-Range Dimer Interactions Arising From Triplet Excited States of Monocyclic Aromatics (Judith M. Leson, University of Duisburg-Essen, 2026)
Data DOI: 10.71955/DUEDATA-2026-MR4YY63J
Reference: Stone, A. (2013). The Theory of Intermolecular Forces, 2nd ed., Oxford University Press.
This repository provides automated Python code to symbolically derive Cartesian multipole interaction terms for two molecules in a stacked geometry along the Z-axis. The focus is on generating traceable, step-by-step derivations of interaction formulas up to high multipole orders.
The code is intended for computational and theoretical chemists who need to work with multipole expansions of different orders and want to trace, verify or adapt the underlying equations.
- Symbolic derivation of Cartesian multipole tensors from $ \nabla_\alpha \nabla_\beta \cdots (1/R) $
- Stepwise simplification for stacked systems (intermolecular distance along Z)
- Support for arbitrary multipole orders (dipole, quadrupole, octopole, hexadecapole, etc.)
- Automated LaTeX File generation for tensor definitions and interaction terms
- Human-readable derivations in compiled PDFs showing the intermediate steps
The derivation is based on the general definition of Cartesian multipole tensors:
with
These tensors
Notation:
$\mathbf{T}_{\alpha\beta\cdots}$ : Cartesian multipole tensor$\mu$ : dipole moment$\Theta$ : quadrupole moment$\Omega$ : octopole moment$\Phi$ : hexadecapole moment- Superscripts
$A$ ,$B$ : molecule labels
Each term in the expansion corresponds to specific multipoles order. The code derives these terms systematically using symbolic differentiation and by enforcing the traceless conditions of the respective multipole components.
In this work, we consider stacked systems (e.g., the "sandwich" benzene dimer), where the intermolecular distance is aligned along the
Additionally, we assume that certain multipole components vanish due to symmetry in systems such as the benzene, chlorobenzene, and pyrazine dimer:
For systems satisfying these geometric and symmetry constraints, the code performs stepwise derivations and simplifications to yield final interaction equations for specific multipole combinations. We note that while these constraints apply only to certain symmetric systems, the code remains useful for general use: it generates derivations step-by-step, enabling full traceability and verification of used simplifications.
For instance, the interaction between two dipoles (rank 1) in a stacked benzene dimer ("sandwich" structure) can be calculated as follows:
run.py: Main script that generates tensor definitions and interaction examplesexample.ipynb: Introduction how to use this libraryrequirements.txt: Needed python librariessrc: Folder for source filesrun_latex.sh: Compiles.texfiles into PDFs (output inbuild/)build: Folder for LaTeX compilation files
This project requires:
sympyitertoolscollections
Install with:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtExemplary use of the code is given in run.py. For a more interactive example we give the jupyter notebook example.ipynb.
In general, the results of a different order for a tensor can be gained by running:
save_lines_as_latex_file(filename="tensor_definitions.tex", importable_tex=False, content=[Tensor(order=order).to_tex(importable_tex=True)])or for multiple cases as:
latex_doc = []
for order in range(3):
t = Tensor(order=order)
latex_doc.append( t.to_tex(importable_tex=True) )
save_lines_as_latex_file(filename="tensor_definitions.tex", importable_tex=False, content=latex_doc)The interaction between two multipoles in a stacked system can be calculated by giving their rank. For instance, the function call for the interaction between two dipoles is:
s = MultipoleInteraction(multipole_order_1 = 1, multipole_order_2 = 1)
s.simplify_in_latex_steps(importable_tex=False)The parameter importable_tex determines whether the generated LaTeX file includes a document header (e.g., \documentclass, \begin{document}).
- True: Full LaTeX document (ready to compile).
- False: Only the content (e.g., for inclusion in another LaTeX document).