Skip to content

Commit

Permalink
dial back printing for v0.2.0 (#26)
Browse files Browse the repository at this point in the history
* extras on atspec

* suppress printing
  • Loading branch information
loriab authored May 13, 2024
1 parent 595f972 commit fedb968
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 123 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
QCManyBody
==========

<p align="center">
<p align="left">
<picture>
<img alt="QCManyBody Logo" src="https://github.com/MolSSI/QCManyBody/blob/main/docs/logo.png" height="150px">
</picture>
Expand Down
4 changes: 4 additions & 0 deletions qcmanybody/models/manybody_input_pydv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class AtomicSpecification(ProtoModel):
AtomicResultProtocols(),
description=AtomicResultProtocols.__doc__,
)
extras: Dict[str, Any] = Field(
{},
description="Additional information to bundle with the computation. Use for schema development and scratch space.",
)


class ResultBase(ProtoModel):
Expand Down
30 changes: 13 additions & 17 deletions qcmanybody/qcng_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,18 +292,15 @@ def nbodies_per_mc_level(self) -> List[List[Union[int, Literal["supersystem"]]]]
# * below, process values of `levels`, which are modelchem strings, into kwargs specs
nbodies_per_mc_level = []
prev_body = 0
print("\nAAA", self.levels)
for nb in self.levels:
nbodies = []
print("BBB bfore", nb, nbodies, prev_body)
if nb == "supersystem":
nbodies.append(nb)
elif nb != (prev_body + 1):
for m in range(prev_body + 1, nb + 1):
nbodies.append(m)
else:
nbodies.append(nb)
print("BBB after", nb, nbodies)
nbodies_per_mc_level.append(nbodies)
prev_body = nb # formerly buggy `+= 1`

Expand Down Expand Up @@ -382,10 +379,10 @@ def from_manybodyinput(cls, input_model: ManyBodyInput, build_tasks: bool = True
)
nb_per_mc = computer_model.nbodies_per_mc_level

print("\n<<< (ZZ 1) QCEngine harness ManyBodyComputerQCNG.from_qcschema_ben >>>")
# print("\n<<< (ZZ 1) QCEngine harness ManyBodyComputerQCNG.from_qcschema_ben >>>")
# v2: pprint.pprint(computer_model.model_dump(), width=200)
pprint.pprint(computer_model.dict(), width=200)
print(f"nbodies_per_mc_level={nb_per_mc}")
# pprint.pprint(computer_model.dict(), width=200)
# print(f"nbodies_per_mc_level={nb_per_mc}")

comp_levels = {}
for mc_level_idx, mtd in enumerate(computer_model.levels.values()):
Expand Down Expand Up @@ -450,14 +447,13 @@ def from_manybodyinput(cls, input_model: ManyBodyInput, build_tasks: bool = True
if v is not None:
component_properties[label][p] = v

print("\n<<< (ZZ 2) QCEngine harness ManyBodyComputerQCNG.from_qcschema_ben component_properties >>>")
pprint.pprint(component_properties, width=200)
# print("\n<<< (ZZ 2) QCEngine harness ManyBodyComputerQCNG.from_qcschema_ben component_properties >>>")
# pprint.pprint(component_properties, width=200)

print("start to analyze")
analyze_back = computer_model.qcmb_calculator.analyze(component_properties)
analyze_back["nbody_number"] = len(component_properties)
print("\n<<< (ZZ 3) QCEngine harness ManyBodyComputerQCNG.from_qcschema_ben analyze_back >>>")
pprint.pprint(analyze_back, width=200)
# print("\n<<< (ZZ 3) QCEngine harness ManyBodyComputerQCNG.from_qcschema_ben analyze_back >>>")
# pprint.pprint(analyze_back, width=200)

return computer_model.get_results(external_results=analyze_back, component_results=component_results)

Expand Down Expand Up @@ -515,9 +511,9 @@ def get_results(self, external_results: Dict, component_results: Dict, client: O

# build_out(qcvars)
atprop = build_manybodyproperties(qcvars["nbody"])
print("ATPROP")
# print("ATPROP")
# v2: pp.pprint(atprop.model_dump())
pp.pprint(atprop.dict())
# pp.pprint(atprop.dict())

# output_data = {
# "schema_version": 1,
Expand All @@ -534,8 +530,8 @@ def get_results(self, external_results: Dict, component_results: Dict, client: O
#
# # TODO all besides nbody may be better candidates for extras than qcvars. energy/gradient/hessian_body_dict in particular are too simple for qcvars (e.g., "2")

print("QCVARS PRESCREEN")
pp.pprint(qcvars)
# print("QCVARS PRESCREEN")
# pp.pprint(qcvars)

for qcv, val in qcvars.items():
if not isinstance(val, dict):
Expand All @@ -546,8 +542,8 @@ def get_results(self, external_results: Dict, component_results: Dict, client: O
# for k, val in component_results.items():
# val['molecule'] = val['molecule'].to_schema(dtype=2)

print("QCVARS")
pp.pprint(qcvars)
# print("QCVARS")
# pp.pprint(qcvars)

nbody_model = ManyBodyResult(
**{
Expand Down
103 changes: 0 additions & 103 deletions qcmanybody/test_nbody_compute_list.py

This file was deleted.

2 changes: 1 addition & 1 deletion qcmanybody/tests/test_mbe_he4_singlelevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def skprop(qcvar):
^\s+\[Eh\] \[Eh\] \[kcal/mol\] \[Eh\] \[kcal/mol\]
^\s+1\s+-11.5306687\d+ 0.0000000\d+ 0.00\d+ 0.0000000\d+ 0.00\d+
^\s+2\s+-11.5224489\d+ 0.0082197\d+ 5.15\d+ 0.0082197\d+ 5.15\d+
^\s+3\s+-11.5226845\d+ 0.0079841\d+ 5.01\d+ -0.0002356\d+ -0.14\d+
^\s+3\s+-11.5226845\d+ 0.0079841\d+ 5.01\d+ -0.000235\d+ -0.14\d+
^\s+FULL/RTN\s+4\s+-11.5226215\d+ 0.0080471\d+ 5.04\d+ 0.0000629\d+ 0.03\d+
""",
"cp3b_tot": r"""
Expand Down
2 changes: 1 addition & 1 deletion qcmanybody/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def print_nbody_energy(
info += f""" {lbl:>11} {nb:3} {"N/A":20} {"N/A":20} {"N/A":20} {"N/A":20} {"N/A":20}\n"""

info += "\n"
print(info)
# print(info)
return info


Expand Down

0 comments on commit fedb968

Please sign in to comment.