Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for a bug inside of christiansen_integrals_dipole #6870

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions pennylane/labs/tests/vibrational/test_christiansen_ham.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ def test_christiansen_integrals_dipole():
assert np.allclose(abs(two), abs(D2), atol=1e-8)
assert np.allclose(abs(three), abs(D3), atol=1e-8)

def test_christiansen_integrals_dipole_conditional():
"""Test that christiansen_integrals_dipole works even when there is only two mode dipoles."""
coeffs = christiansen_integrals_dipole(pes=pes_object_2D, n_states=4)
assert np.allclose(abs(coeffs[0]), abs(D1), atol=1e-8)
assert np.allclose(abs(coeffs[1]), abs(D2), atol=1e-8)
assert len(coeffs) == 2


def test_cform_onemode():
"""Test that _cform_onemode produces the expected one-body integral."""
Expand Down
4 changes: 2 additions & 2 deletions pennylane/labs/vibrational/christiansen_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def christiansen_integrals_dipole(pes, n_states=16):
comm.Barrier()
dipole_cform_onebody = comm.bcast(dipole_cform_onebody, root=0)

if pes.localized is True or pes.dipole_level > 1:
if pes.dipole_level > 1:
austingmhuang marked this conversation as resolved.
Show resolved Hide resolved
local_dipole_cform_twobody = _cform_twomode_dipole(pes, n_states)
obliviateandsurrender marked this conversation as resolved.
Show resolved Hide resolved
comm.Barrier()

Expand All @@ -865,7 +865,7 @@ def christiansen_integrals_dipole(pes, n_states=16):
comm.Barrier()
dipole_cform_twobody = comm.bcast(dipole_cform_twobody, root=0)

if pes.localized is True or pes.dipole_level > 2:
if pes.dipole_level > 2:
local_dipole_cform_threebody = _cform_threemode_dipole(pes, n_states)
ddhawan11 marked this conversation as resolved.
Show resolved Hide resolved
comm.Barrier()

Expand Down
Loading