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

add vmfc tests. fix the psi4 vmfc g/h bug #8

Merged
merged 3 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 36 additions & 13 deletions qcmanybody/manybody.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
if len(self.bsse_type) == 0:
raise ValueError("No BSSE correction specified")

if BsseEnum.vmfc in self.bsse_type and len(set(self.levels.values())) == 1:

Check warning on line 60 in qcmanybody/manybody.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/manybody.py#L60

Added line #L60 was not covered by tests
# For single-modelchem VMFC, NOCP & sometimes CP are produced for free
if BsseEnum.nocp not in self.bsse_type:
self.bsse_type.append(BsseEnum.nocp)
if BsseEnum.cp not in self.bsse_type and self.max_nbody == self.nfragments:
self.bsse_type.append(BsseEnum.cp)

Check warning on line 65 in qcmanybody/manybody.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/manybody.py#L62-L65

Added lines #L62 - L65 were not covered by tests

self.return_bsse_type = self.bsse_type[0]

###############################
Expand Down Expand Up @@ -276,18 +283,8 @@
# Compute vmfc
if BsseEnum.vmfc in bsse_type:
for nb in nbodies:
# TODO I think this is correct for all properties...
# for k in range(1, nb + 1):
# vmfc_body_dict[nb] += vmfc_by_level[k]

# TODO - but below was used for gradient/hessian in psi4?
if property_label == "energy":
for k in range(1, nb + 1):
vmfc_body_dict[nb] += vmfc_by_level[k]
else:
if nb > 1:
vmfc_body_dict[nb] = vmfc_by_level[nb - 1]
vmfc_body_dict[nb] += vmfc_by_level[nb]
for k in range(1, nb + 1):
vmfc_body_dict[nb] += vmfc_by_level[k]

Check warning on line 287 in qcmanybody/manybody.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/manybody.py#L286-L287

Added lines #L286 - L287 were not covered by tests

# Collect specific and generalized returns
results = {
Expand Down Expand Up @@ -408,8 +405,34 @@

def analyze(
self,
component_results: Dict[str, Dict[str, Union[float, np.ndarray]]], # component_results[label][property] = 1.23
component_results: Dict[str, Dict[str, Union[float, np.ndarray]]],
):
"""

Parameters
----------
component_results
Nested dictionary with results from all individual molecular system
calculations, including all subsystem/basis combinations, all model
chemistries, and all properties (e.g., e/g/h).

For example, the below is the format for a nocp gradient run on a
helium dimer with 1-body at CCSD and 2-body at MP2. The outer string
key can be generated with the ``qcmanybody.utils.labeler`` function.
The inner string key is any property; QCManyBody presently knows how
to process energy/gradient/Hessian.

{'["ccsd", [1], [1]]': {'energy': -2.87, 'gradient': array([[0., 0., 0.]])},
'["ccsd", [2], [2]]': {'energy': -2.87, 'gradient': array([[0., 0., 0.]])},
'["mp2", [1], [1]]': {'energy': -2.86, 'gradient': array([[0., 0., 0.]])},
'["mp2", [2], [2]]': {'energy': -2.86, 'gradient': array([[0., 0., 0.]])},
'["mp2", [1, 2], [1, 2]]': {'energy': -5.73, 'gradient': array([[ 0., 0., 0.0053], [ 0., 0., -0.0053]])},
}

Return
------

"""

# All properties that were passed to us
available_properties = set()
Expand Down
10 changes: 8 additions & 2 deletions qcmanybody/models/manybody_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,17 @@
))


class ProtoModelSkipDefaults(ProtoModel):

Check warning on line 478 in qcmanybody/models/manybody_v1.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/models/manybody_v1.py#L478

Added line #L478 was not covered by tests

class Config(ProtoModel.Config):
serialize_skip_defaults = True
force_skip_defaults = True

Check warning on line 482 in qcmanybody/models/manybody_v1.py

View check run for this annotation

Codecov / codecov/patch

qcmanybody/models/manybody_v1.py#L480-L482

Added lines #L480 - L482 were not covered by tests


ManyBodyResultProperties = create_model(
"ManyBodyResultProperties",
#__config__=ConfigDict(title='abc'),
#__doc__=manybodyresultproperties_doc, # needs later pydantic
__base__=ProtoModel,
__base__=ProtoModelSkipDefaults,
**mbprop,
)

Expand Down
209 changes: 124 additions & 85 deletions qcmanybody/models/test_mbe_he4_multilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from qcmanybody.models.qcng_computer import ManyBodyComputerQCNG, qcvars_to_manybodyproperties

import qcengine as qcng
from .addons import using
from addons import using
from test_mbe_he4_singlelevel import sumdict

def skprop(qcvar):
# qcng: return qcng.procedures.manybody.qcvars_to_manybodyproperties[qcvar]
Expand Down Expand Up @@ -185,6 +186,18 @@ def mbe_data_multilevel_631g():
"CP-CORRECTED 2-BODY CONTRIBUTION TO ENERGY": 0.009589981022,
"CP-CORRECTED 3-BODY CONTRIBUTION TO ENERGY": -0.000266034234,
"CP-CORRECTED 4-BODY CONTRIBUTION TO ENERGY": 0.000052364064,

"VMFC-CORRECTED TOTAL ENERGY THROUGH 1-BODY": -11.480648555603,
"VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY": -11.471163557706,
"VMFC-CORRECTED TOTAL ENERGY THROUGH 3-BODY": -11.471402496106,
"VMFC-CORRECTED TOTAL ENERGY THROUGH 4-BODY": -11.471350132042,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 1-BODY": 0.0,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY": 0.009484997897,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 3-BODY": 0.009246059497,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 4-BODY": 0.009298423561,
"VMFC-CORRECTED 2-BODY CONTRIBUTION TO ENERGY": 0.009484997897,
"VMFC-CORRECTED 3-BODY CONTRIBUTION TO ENERGY": -0.000238938400,
"VMFC-CORRECTED 4-BODY CONTRIBUTION TO ENERGY": 0.000052364064,
},
# 1,2: ccsd; 3,4: mp2, all 6-31G
"22": {
Expand All @@ -211,6 +224,18 @@ def mbe_data_multilevel_631g():
"CP-CORRECTED 2-BODY CONTRIBUTION TO ENERGY": 0.009942616831,
"CP-CORRECTED 3-BODY CONTRIBUTION TO ENERGY": -0.000266034234,
"CP-CORRECTED 4-BODY CONTRIBUTION TO ENERGY": 0.000058523922,

"VMFC-CORRECTED TOTAL ENERGY THROUGH 1-BODY": -11.480648555603,
"VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY": -11.470821409457,
"VMFC-CORRECTED TOTAL ENERGY THROUGH 3-BODY": -11.471060347857,
"VMFC-CORRECTED TOTAL ENERGY THROUGH 4-BODY": -11.471001823935,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 1-BODY": 0.0,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY": 0.009827146147,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 3-BODY": 0.009588207746,
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 4-BODY": 0.009646731668,
"VMFC-CORRECTED 2-BODY CONTRIBUTION TO ENERGY": 0.009827146147,
"VMFC-CORRECTED 3-BODY CONTRIBUTION TO ENERGY": -0.000238938400,
"VMFC-CORRECTED 4-BODY CONTRIBUTION TO ENERGY": 0.000058523922,
},
}

Expand Down Expand Up @@ -253,97 +278,50 @@ def mbe_data_multilevel_631g():
"VMFC-CORRECTED 4-BODY CONTRIBUTION TO ENERGY": 6.299342870974556e-05,
}

sumdict = {
"4b_all": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",

sumdict_multi = {
"4b_vmfc_rtd": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_nocpcp": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_nocp_rtd_sio": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_nocp_sio": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_cp_rtd_sio": {
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_cp_sio": {
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_nocp_rtd": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_nocp": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_cp_rtd": {
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"4b_cp": {
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"3b_nocp_rtd": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 3-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
},
"3b_nocp": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 3-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
"4b_vmfc": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 4-BODY", # TODO remove?
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
},
"3b_cp_rtd": {
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 3-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
"3b_vmfc_rtd": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 3-BODY",
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
},
"3b_cp": {
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
"3b_vmfc": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 3-BODY", # TODO remove?
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
},
"2b_nocp_rtd": {
"2b_vmfc_rtd": {
"121": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
},
"22": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
},
},
"2b_nocp": {
"2b_vmfc": {
"121": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY", # TODO remove?
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
},
"22": {
"VMFC-CORRECTED TOTAL ENERGY": "VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
"VMFC-CORRECTED INTERACTION ENERGY": "VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
},
"2b_cp_rtd": {
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
},
"2b_cp": {
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
},
"1b_nocp_rtd": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 1-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 1-BODY",
},
"1b_nocp": {
"NOCP-CORRECTED TOTAL ENERGY": "NOCP-CORRECTED TOTAL ENERGY THROUGH 1-BODY",
"NOCP-CORRECTED INTERACTION ENERGY": "NOCP-CORRECTED INTERACTION ENERGY THROUGH 1-BODY",
},
"1b_cp_rtd": {
"CP-CORRECTED TOTAL ENERGY": "CP-CORRECTED TOTAL ENERGY THROUGH 1-BODY",
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 1-BODY",
},
"1b_cp": {
"CP-CORRECTED INTERACTION ENERGY": "CP-CORRECTED INTERACTION ENERGY THROUGH 1-BODY",
},
},
}
sumdict.update(sumdict_multi)


@pytest.fixture
Expand Down Expand Up @@ -412,7 +390,6 @@ def he_tetramer():
# {"121": 5,
# "22": 99}, #
# id="4b_cp_sio"),
### TODO add vmfc. 3b nmbe=50
pytest.param(
{"bsse_type": "nocp", "return_total_data": True},
"NOCP-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
Expand Down Expand Up @@ -441,6 +418,20 @@ def he_tetramer():
{"121": 29, # 14md + 15lo vs. 15 for single-level,
"22": 25}, # 10hi + 15lo
id="4b_cp"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": True},
"VMFC-CORRECTED TOTAL ENERGY THROUGH 4-BODY",
[k for k in he4_refs_conv if (k.startswith("VMFC-"))],
{"121": 65, # was 93 in p4 # 4hi + 18+28md + 15lo vs. 65 for single-level
"22": 65}, # was 83 in p4 # 4+18hi + 28+15lo
id="4b_vmfc_rtd"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": False},
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 4-BODY",
[k for k in he4_refs_conv if (k.startswith("VMFC-"))],
{"121": 65, # could be 61; was 93 in p4 # 18+28md + 15lo =61
"22": 65}, # could be 61; was 83 in p4 # 18hi + 28+15lo = 61
id="4b_vmfc"),
pytest.param(
{"bsse_type": "nocp", "return_total_data": True, "max_nbody": 3},
"NOCP-CORRECTED TOTAL ENERGY THROUGH 3-BODY",
Expand Down Expand Up @@ -469,6 +460,20 @@ def he_tetramer():
{"121": 14, # 14md vs. 14 for single-level
"22": 24}, # 10hi + 14lo
id="3b_cp"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": True, "max_nbody": 3},
"VMFC-CORRECTED TOTAL ENERGY THROUGH 3-BODY",
[k for k in he4_refs_conv if (k.startswith("VMFC-") and ("4-BODY" not in k))],
{"121": 50, # 4hi + 18+28md vs. 14? for single-level
"22": 50}, # was 68 in p4 # 4+18hi + 28lo
id="3b_vmfc_rtd"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": False, "max_nbody": 3},
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 3-BODY",
[k for k in he4_refs_conv if (k.startswith("VMFC-") and ("4-BODY" not in k))],
{"121": 50, # could be 46 # 18+28md =46
"22": 50}, # could be 46; was 68 in p4 # 18hi + 28lo = 46
id="3b_vmfc"),
pytest.param(
{"bsse_type": "nocp", "return_total_data": True, "max_nbody": 2},
"NOCP-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
Expand All @@ -491,12 +496,29 @@ def he_tetramer():
"22": 14}, # 10hi + 4hi(nocp)
id="2b_cp_rtd"),
pytest.param(
{"bsse_type": "cp", "return_total_data": False, "max_nbody": 2},
{"bsse_type": "ssfc", "return_total_data": False, "max_nbody": 2},
"CP-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
[k for k in he4_refs_conv if (k.startswith("CP-") and ("4-BODY" not in k) and ("3-BODY" not in k) and "TOTAL ENERGY" not in k)],
{"121": 10, # 10md vs. 10 for single-level,
"22": 10}, # 10hi
id="2b_cp"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": True, "max_nbody": 2},
"VMFC-CORRECTED TOTAL ENERGY THROUGH 2-BODY",
# "22" at 2-body is effectively single-level so nocp enabled ...
{"121": [k for k in he4_refs_conv if (k.startswith("VMFC-") and ("4-BODY" not in k) and ("3-BODY" not in k))],
"22": [k for k in he4_refs_conv if ((k.startswith("VMFC-") or k.startswith("NOCP-")) and ("4-BODY" not in k) and ("3-BODY" not in k))]},
{"121": 22, # 4hi + 18+28md + 15lo vs. 65 for single-level
"22": 22}, # 4+18hi + 28+15lo
id="2b_vmfc_rtd"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": False, "max_nbody": 2},
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 2-BODY",
{"121": [k for k in he4_refs_conv if (k.startswith("VMFC-") and ("4-BODY" not in k) and ("3-BODY" not in k))],
"22": [k for k in he4_refs_conv if ((k.startswith("VMFC-") or k.startswith("NOCP-")) and ("4-BODY" not in k) and ("3-BODY" not in k))]},
{"121": 22, # TODO could be 18 # 0+18hi = 18
"22": 22}, # TODO could be 18 # 18hi = 18
id="2b_vmfc"),
pytest.param(
{"bsse_type": "nocp", "return_total_data": True, "max_nbody": 1},
"NOCP-CORRECTED TOTAL ENERGY THROUGH 1-BODY",
Expand Down Expand Up @@ -525,6 +547,21 @@ def he_tetramer():
{"121": 0,
"22": 0},
id="1b_cp"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": True, "max_nbody": 1},
"VMFC-CORRECTED TOTAL ENERGY THROUGH 1-BODY",
# max_nbody=1 is effectively single-modelchem so NOCP available for free
[k for k in he4_refs_conv if ((k.startswith("VMFC-") or k.startswith("NOCP-")) and ("1-BODY" in k))],
{"121": 4, # 4hi
"22": 4},
id="1b_vmfc_rtd"),
pytest.param(
{"bsse_type": "vmfc", "return_total_data": False, "max_nbody": 1},
"VMFC-CORRECTED INTERACTION ENERGY THROUGH 1-BODY",
[k for k in he4_refs_conv if ((k.startswith("VMFC-") or k.startswith("NOCP-")) and ("1-BODY" in k))],
{"121": 4, # TODO could be 0
"22": 4}, # TODO could be 0
id="1b_vmfc"),
])
def test_nbody_he4_multi(levels, mbe_keywords, anskey, bodykeys, calcinfo_nmbe, he_tetramer, request, mbe_data_multilevel_631g):
_inner = request.node.name.split("[")[1].split("]")[0]
Expand Down Expand Up @@ -567,11 +604,13 @@ def test_nbody_he4_multi(levels, mbe_keywords, anskey, bodykeys, calcinfo_nmbe,
refs = he4_refs_conv_multilevel_631g[pattern]
ans = refs[anskey]
ref_nmbe = calcinfo_nmbe[pattern]
atol = 2.0e-8
ref_bodykeys = bodykeys[pattern] if pattern in bodykeys else bodykeys
ref_sumdict = sumdict[kwdsln][pattern] if pattern in sumdict[kwdsln] else sumdict[kwdsln]
atol = 2.5e-8

for qcv, ref in refs.items():
skp = skprop(qcv)
if qcv in bodykeys:
if qcv in ref_bodykeys:
assert compare_values(ref, ret.extras["qcvars"]["nbody"][qcv], atol=atol, label=f"[a] qcvars {qcv}")
assert compare_values(ref, getattr(ret.properties, skp), atol=atol, label=f"[b] skprop {skp}")
else:
Expand All @@ -580,8 +619,8 @@ def test_nbody_he4_multi(levels, mbe_keywords, anskey, bodykeys, calcinfo_nmbe,

for qcv in sumdict["4b_all"]:
skp = skprop(qcv)
if qcv in sumdict[kwdsln]:
ref = refs[sumdict[kwdsln][qcv]]
if qcv in ref_sumdict:
ref = refs[ref_sumdict[qcv]]
assert compare_values(ref, ret.extras["qcvars"]["nbody"][qcv], atol=atol, label=f"[c] qcvars {qcv}")
assert compare_values(ref, getattr(ret.properties, skp), atol=atol, label=f"[d] skprop {skp}")
else:
Expand Down
Loading
Loading