Skip to content

Commit

Permalink
test component
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Apr 16, 2024
1 parent bdaa1d6 commit 330a0b2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qcmanybody/models/manybody_pydv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ class ManyBodyResult(SuccessfulResultBase):
properties: ManyBodyResultProperties = Field(..., description=str(ManyBodyResultProperties.__doc__))
component_properties: Dict[str, AtomicResultProperties] = Field(
...,
description="The total e/g/H/property results for each species computed. Keys contain modelchem, real and ghost information (e.g., `'[\"(auto)\", [2], [1, 2, 3]]'`). Array values, if present, are sized and shaped for the full supersystem.",
description="The key results for each subsystem species computed. Keys contain modelchem, real and ghost information (e.g., `'[\"(auto)\", [2], [1, 2, 3]]'`). Values are total e/g/H/property results. Array values, if present, are sized and shaped for the full supersystem.",

)
return_result: Union[float, Array[float], Dict[str, Any]] = Field(
Expand Down
4 changes: 2 additions & 2 deletions qcmanybody/models/qcng_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ def get_results(self, client: Optional["qcportal.FractalClient"] = None, externa
ret_ptype = ret_energy if self.driver == "energy" else external_results.pop(f"ret_{self.driver.name}")
ret_gradient = external_results.pop("ret_gradient", None)
nbody_number = external_results.pop("nbody_number")
component_properties = external_results.pop("component_properties")

# load QCVariables
qcvars = {
Expand Down Expand Up @@ -845,11 +846,10 @@ def get_results(self, client: Optional["qcportal.FractalClient"] = None, externa
#'molecule': self.molecule,
# v2: 'properties': {**atprop.model_dump(), **properties},
'properties': {**atprop.dict(), **properties},
'component_data': {}, # TODO: fill this :-)
'component_properties': component_properties,
'provenance': provenance_stamp(__name__),
'extras': {
'qcvars': qcvars,
# 'component_results': component_results,
},
'return_result': ret_ptype,
'success': True,
Expand Down
10 changes: 10 additions & 0 deletions qcmanybody/models/test_mbe_he4_singlelevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ def skprop(qcvar):
return qcvars_to_manybodyproperties[qcvar]


he4_refs_species = {
"NO": ('[\"(auto)\", [1, 2, 4], [1, 2, 4]]', -8.644153798224503),
"CP": ('[\"(auto)\", [1, 2, 4], [1, 2, 3, 4]]', -8.64425850181438),
"VM": ('[\"(auto)\", [1, 4], [1, 2, 4]]', -5.765439283351071),
}

he4_refs_conv = {
"CP-CORRECTED TOTAL ENERGY THROUGH 1-BODY": -11.530668717083888,
"CP-CORRECTED TOTAL ENERGY THROUGH 2-BODY": -11.522467757090013,
Expand Down Expand Up @@ -490,6 +496,10 @@ def test_nbody_he4_single(program, basis, keywords, mbe_keywords, anskey, bodyke
assert qcv not in ret.extras["qcvars"]["nbody"], f"[y] {qcv=} wrongly present"
assert getattr(ret.properties, skp) is None

if "3b" in kwdsln and not progln.endswith("df"):
k, v = he4_refs_species[anskey[:2]]
assert compare_values(v, ret.component_properties[k].return_energy, atol=atol, label=f"[h] species {k}")

for qcv, ref in {
"CURRENT ENERGY": ans,
}.items():
Expand Down

0 comments on commit 330a0b2

Please sign in to comment.