import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Ellipse
plt.rcParams['text.usetex'] = True
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.size'] = 12
fig, ax = plt.subplots(figsize=(8, 4))
def draw_atom(ax, x, y, radius, label, color='lightblue'):
circle = Circle((x, y), radius, fill=True, color=color, alpha=0.3, ec='black', lw=2)
ax.add_patch(circle)
ax.text(x, y, label, ha='center', va='center', fontsize=16, fontweight='bold')
def draw_density(ax, x, y, width, height, color='blue', alpha=0.2):
ellipse = Ellipse((x, y), width, height, fill=True, color=color, alpha=alpha)
ax.add_patch(ellipse)
draw_density(ax, 4, 0, 3.5, 3, 'blue', 0.3)
draw_density(ax, 6, 0, 3.5, 3, 'blue', 0.3)
draw_atom(ax, 4, 0, 0.8, 'A', 'lightcoral')
draw_atom(ax, 6, 0, 0.8, 'B', 'lightcoral')
ax.annotate('', xy=(5.5, -1.5), xytext=(4.5, -1.5),
arrowprops=dict(arrowstyle='<->', color='red', lw=2))
ax.text(5, -1.8, 'Significant overlap', ha='center', fontsize=11, color='red')
ax.set_xlim(-1, 11)
ax.set_ylim(-2, 3)
ax.set_aspect('equal')
ax.axis('off')
ax.set_title('Covalent Bond - Orbital Overlap', fontsize=14, fontweight='bold')
plt.show()