Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
adding two-electron docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhelal committed Apr 22, 2024
1 parent 5b646af commit 09ee488
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mess/hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class TwoElectron(eqx.Module):
eri: Array

def __init__(self, basis: Basis, backend: str = "mess"):
"""
Args:
basis (Basis): the basis set used to build the electron repulsion integrals
backend (str, optional): Integral backend used. Defaults to "mess".
"""
super().__init__()
if backend == "mess":
self.eri = eri_basis(basis)
Expand All @@ -35,9 +41,25 @@ def __init__(self, basis: Basis, backend: str = "mess"):
self.eri = jnp.array(mol.intor("int2e_cart", aosym="s1"))

def coloumb(self, P: FloatNxN) -> FloatNxN:
"""Build the Coloumb matrix (classical electrostatic) from the density matrix.
Args:
P (FloatNxN): the density matrix
Returns:
FloatNxN: Coloumb matrix
"""
return jnp.einsum("kl,ijkl->ij", P, self.eri)

def exchange(self, P: FloatNxN) -> FloatNxN:
"""Build the quantum-mechanical exchange matrix from the density matrix
Args:
P (FloatNxN): the density matrix
Returns:
FloatNxN: Exchange matrix
"""
return jnp.einsum("ij,ikjl->kl", P, self.eri)


Expand Down

0 comments on commit 09ee488

Please sign in to comment.