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

Commit

Permalink
allow optional two electron integral in xcfunctional factory
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhelal committed Apr 26, 2024
1 parent fcd63b3 commit de2f014
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions mess/hamiltonian.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) 2024 Graphcore Ltd. All rights reserved.
from typing import Tuple, Literal, get_args
from typing import Literal, Optional, Tuple, get_args

import equinox as eqx
import jax
import jax.numpy as jnp
Expand All @@ -15,15 +16,14 @@
from mess.structure import nuclear_energy
from mess.types import FloatNxN, OrthNormTransform
from mess.xcfunctional import (
lda_correlation_vwn,
lda_exchange,
gga_correlation_lyp,
gga_correlation_pbe,
gga_exchange_pbe,
gga_exchange_b88,
gga_correlation_lyp,
gga_exchange_pbe,
lda_correlation_vwn,
lda_exchange,
)


xcstr = Literal["lda", "pbe", "pbe0", "b3lyp", "hfx"]


Expand Down Expand Up @@ -146,8 +146,13 @@ def __call__(self, P: FloatNxN) -> ScalarLike:


def build_xcfunc(
xc_method: xcstr, basis: Basis, two_electron: TwoElectron
xc_method: xcstr, basis: Basis, two_electron: Optional[TwoElectron] = None
) -> eqx.Module:
if two_electron is None and xc_method in ("pbe0", "b3lyp"):
raise ValueError(
f"Hybrid functional {xc_method} requires providing TwoElectron integrals"
)

match xc_method:
case "lda":
return LDA(basis)
Expand Down

0 comments on commit de2f014

Please sign in to comment.