Skip to content

Commit e56b647

Browse files
committed
uhf integrals in ghf mode
1 parent c6701f7 commit e56b647

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ jobs:
665665
cmake --version
666666
python -m pip install wheel delocate==0.10.7
667667
export _PYTHON_HOST_PLATFORM="macosx-14.0-arm64"
668-
export SDKROOT=/Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
668+
export SDKROOT=/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
669669
export PLAT="arm64"
670670
python -m pip wheel . -w ./dist --no-deps
671671
delocate-wheel --require-archs=arm64 -k dist/*.whl

docs/source/tutorial/qc-hamiltonians.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@
349349
"source": [
350350
"driver = DMRGDriver(scratch=\"./tmp\", symm_type=SymmetryTypes.SGF, n_threads=4)\n",
351351
"\n",
352-
"driver.n_sites = ncas\n",
353-
"g2e = driver.unpack_g2e(g2e)\n",
352+
"g2e = driver.unpack_g2e(g2e, n_sites=ncas)\n",
354353
"orb_sym = [orb_sym[i // 2] for i in range(len(orb_sym) * 2)]\n",
355354
"n_sites = ncas * 2\n",
356355
"\n",

pyblock2/driver/core.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3514,15 +3514,33 @@ def get_qc_mpo(
35143514
if g2e is not None and isinstance(g2e, np.ndarray) and g2e.ndim == 4:
35153515
g2e = (g2e, g2e, g2e)
35163516
elif SymmetryTypes.SGF in bw.symm_type or SymmetryTypes.SGB in bw.symm_type:
3517-
if (
3517+
if h1e is not None and (
3518+
(isinstance(h1e, np.ndarray) and h1e.ndim == 3) or
3519+
(isinstance(h1e, tuple) and len(h1e) == 2)
3520+
):
3521+
gh1e = np.zeros((len(h1e[0]) * 2,) * 2)
3522+
gh1e[0::2, 0::2] = h1e[0]
3523+
gh1e[1::2, 1::2] = h1e[1]
3524+
h1e = gh1e
3525+
elif (
35183526
h1e is not None
35193527
and hasattr(self, "n_sites")
35203528
and len(h1e) * 2 == self.n_sites
35213529
):
35223530
gh1e = np.zeros((len(h1e) * 2,) * 2)
35233531
gh1e[0::2, 0::2] = gh1e[1::2, 1::2] = h1e
35243532
h1e = gh1e
3525-
if (
3533+
if g2e is not None and (
3534+
(isinstance(g2e, np.ndarray) and h1e.ndim == 5) or
3535+
(isinstance(g2e, tuple) and len(g2e) == 3)
3536+
):
3537+
gg2e = np.zeros((len(g2e[0]) * 2,) * 4)
3538+
gg2e[0::2, 0::2, 0::2, 0::2] = g2e[0]
3539+
gg2e[0::2, 0::2, 1::2, 1::2] = g2e[1]
3540+
gg2e[1::2, 1::2, 0::2, 0::2] = g2e[1].transpose(2, 3, 0, 1)
3541+
gg2e[1::2, 1::2, 1::2, 1::2] = g2e[2]
3542+
g2e = gg2e
3543+
elif (
35263544
g2e is not None
35273545
and hasattr(self, "n_sites")
35283546
and len(g2e) * 2 == self.n_sites

0 commit comments

Comments
 (0)