Skip to content

Commit

Permalink
another check
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Jul 21, 2024
1 parent ed2a9bd commit 40b9e2a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-->


## v0.3.0 / 2024-07-19
## v0.3.0 / 2024-07-21

#### Breaking Changes

Expand Down
8 changes: 8 additions & 0 deletions qcmanybody/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def __init__(
assert self.mc_levels == set(self.nbodies_per_mc_level.keys()) # remove after some downstream testing
self.mc_levels = self.nbodies_per_mc_level.keys()

for mc, nbs in self.nbodies_per_mc_level.items():
if nbs and ((nbs[-1] - nbs[0]) != len(nbs) - 1):
raise ValueError(
f"QCManyBody: N-Body levels must be contiguous within a model chemistry spec ({mc}: {nbs}). Use an alternate spec name to accomplish this input."
)
# TODO - test and reenable if appropriate. my guess is that noncontig nb is fine on the core computing side,
# but trouble for computer and nbodies_per_mc_level inverting and indexing. Safer to deflect for now since input tweak allows the calc.

# Supersystem is always at the end
if "supersystem" in levels:
ss_mc = levels["supersystem"]
Expand Down
7 changes: 7 additions & 0 deletions qcmanybody/tests/test_core_auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def test_noncontiguous_fragments_evaded():
assert "QCManyBody: non-contiguous fragments could be implemented but aren't at present" in str(e.value)


def test_noncontiguous_nbody_levels_same_mc(he_tetramer):
with pytest.raises(ValueError) as e:
ManyBodyCalculator(he_tetramer, ["cp"], {2: "mp2", 1: "mp2", 4: "mp2", 3: "ccsd"}, True, False, None)

assert "QCManyBody: N-Body levels must be contiguous within a model chemistry spec" in str(e.value)


@pytest.mark.parametrize("mbe_keywords,ref_count,ref_text", [
pytest.param(
{"bsse_type": ["nocp", "cp", "vmfc"]},
Expand Down

0 comments on commit 40b9e2a

Please sign in to comment.