Skip to content

Commit

Permalink
multi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Mar 21, 2024
1 parent 5b27939 commit 062f444
Show file tree
Hide file tree
Showing 5 changed files with 673 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- label: Py-max
python-version: "3.12"
runs-on: ubuntu-latest
pytest: "-k 'not (he4 and all)'"
pytest: "-k 'not (he4 and 4b)'"

name: "🐍 ${{ matrix.cfg.python-version }} • ${{ matrix.cfg.label }} • ${{ matrix.cfg.runs-on }}"
runs-on: ${{ matrix.cfg.runs-on }}
Expand Down
13 changes: 9 additions & 4 deletions qcmanybody/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def build_nbody_compute_list(

# Build up compute sets
if "cp" in bsse_type:
# Everything is in full n-mer basis
# Everything is in counterpoise/nfr-mer basis
basis_tuple = tuple(fragment_range)

if supersystem_ie_only:
Expand All @@ -90,13 +90,18 @@ def build_nbody_compute_list(
cp_compute_list[nfragments].add((x, basis_tuple))

Check warning on line 90 in qcmanybody/builder.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/builder.py#L88-L90

Added lines #L88 - L90 were not covered by tests
else:
for nb in nbodies:
# Note A.1: nb=1 is skipped because the nfr-mer-basis monomer
# contributions cancel at 1-body. These skipped tasks will be
# ordered anyways if higher bodies are requested. Monomers for
# the purpose of total energies use monomer basis, not these
# skipped tasks. See coordinating Note A.2 .
if nb > 1:
for sublevel in range(1, nb + 1):
for x in itertools.combinations(fragment_range, sublevel):
cp_compute_list[nb].add((x, basis_tuple))

if "nocp" in bsse_type:
# Everything in monomer basis
# Everything in natural/n-mer basis
if supersystem_ie_only:
for sublevel in [1, nfragments]:

Check warning on line 106 in qcmanybody/builder.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/builder.py#L106

Added line #L106 was not covered by tests
for x in itertools.combinations(fragment_range, sublevel):
Expand All @@ -121,8 +126,8 @@ def build_nbody_compute_list(
if return_total_data and 1 in nbodies:
# Monomers in monomer basis
nocp_compute_list.setdefault(1, set())
for frag in range(1, nfragments + 1):
nocp_compute_list[1].add(((frag,), (frag,)))
for ifr in fragment_range:
nocp_compute_list[1].add(((ifr,), (ifr,)))

if include_supersystem:
# Add supersystem info to the compute list (nocp only)
Expand Down
13 changes: 10 additions & 3 deletions qcmanybody/manybody.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ def _assemble_nbody_components(
"""

# which level are we assembling?
delabled = [delabeler(k) for k in component_results.keys()]
mc_level_labels = {x[0] for x in delabled}
delabeled = [delabeler(k) for k in component_results.keys()]
mc_level_labels = {x[0] for x in delabeled}

if len(mc_level_labels) != 1:
raise RuntimeError(f"Multiple model chemistries passed into _assemble_nbody_components: {mc_level_labels}")
Expand Down Expand Up @@ -326,7 +326,14 @@ def _analyze(
filtered_results = {k: v for k, v in property_results.items() if delabeler(k)[0] == mc_label}

if not filtered_results:
raise RuntimeError(f"No data found for model chemistry {mc_label}")
if nbody_list == [1]:

Check warning on line 329 in qcmanybody/manybody.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/manybody.py#L329

Added line #L329 was not covered by tests
# Note A.2: Note A.1 holds, but for the special case of CP-only
# and rtd=False and multilevel with a separate level for
# 1-body, the skipped tasks run afoul of sanity checks, so
# we'll add a dummy result.
filtered_results = {labeler(mc_label, [1000], [1000]): shaped_zero(property_shape)}

Check warning on line 334 in qcmanybody/manybody.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/manybody.py#L334

Added line #L334 was not covered by tests
else:
raise RuntimeError(f"No data found for model chemistry {mc_label}")

Check warning on line 336 in qcmanybody/manybody.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/manybody.py#L336

Added line #L336 was not covered by tests

nb_component_results = self._assemble_nbody_components(property_label, filtered_results)
mc_results[mc_label] = nb_component_results
Expand Down
Loading

0 comments on commit 062f444

Please sign in to comment.