Skip to content

Commit

Permalink
cfour and torchani
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Nov 14, 2024
1 parent 21c77ad commit 207044f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
7 changes: 4 additions & 3 deletions qcengine/programs/cfour/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ def parse_output(
provenance["module"] = module

output_data = {
"schema_version": 1,
"schema_version": 2,
"input_data": input_model,
"molecule": c4mol, # overwrites with outfile Cartesians in case fix_*=F
"extras": {**input_model.extras},
"extras": {},
"native_files": {k: v for k, v in outfiles.items() if v is not None},
"properties": atprop,
"provenance": provenance,
Expand All @@ -224,4 +225,4 @@ def parse_output(
k.upper(): str(v) if isinstance(v, Decimal) else v for k, v in qcvars.items()
}

return AtomicResult(**{**input_model.dict(), **output_data})
return AtomicResult(**output_data)
6 changes: 4 additions & 2 deletions qcengine/programs/dftd3.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def parse_output(self, outfiles: Dict[str, str], input_model: "AtomicInput") ->
retres = retres.ravel().tolist()

output_data = {
"extras": input_model.extras,
"input_data": input_model,
"molecule": input_model.molecule,
"extras": {},
"native_files": {k: v for k, v in outfiles.items() if v is not None},
"properties": {
"return_energy": calcinfo[f"CURRENT ENERGY"],
Expand All @@ -301,7 +303,7 @@ def parse_output(self, outfiles: Dict[str, str], input_model: "AtomicInput") ->
output_data["extras"]["qcvars"]["2-BODY PAIRWISE DISPERSION CORRECTION ANALYSIS"] = D3pairs
output_data["success"] = True

return AtomicResult(**{**input_model.dict(), **output_data})
return AtomicResult(**output_data)


def dftd3_coeff_formatter(dashlvl: str, dashcoeff: Dict) -> str:
Expand Down
5 changes: 4 additions & 1 deletion qcengine/programs/tests/test_dftd3_mp2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def test_dftd3_task(method, schema_versions, request):
ret = qcng.compute(json_data, "dftd3", raise_error=True, return_dict=True, return_version=retver)
ret = checkver_and_convert(ret, request.node.name, "post")

assert ret["driver"] == "energy"
if "v2" in request.node.name:
assert ret["input_data"]["driver"] == "energy"
else:
assert ret["driver"] == "energy"
assert "provenance" in ret
assert "normal termination of dftd3" in ret["stdout"]

Expand Down
19 changes: 9 additions & 10 deletions qcengine/programs/torchani.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,14 @@ def compute(self, input_data: "AtomicInput", config: "TaskConfig") -> "AtomicRes
# the reliability of the models in an ensemble, and produce more data
# points in the regions where this quantity is below a certain
# threshold (inclusion criteria)
ret_data["extras"] = input_data.extras.copy()
ret_data["extras"].update(
{
"ensemble_energies": energy_array.cpu().detach().numpy(),
"ensemble_energy_avg": energy.item(),
"ensemble_energy_std": ensemble_std.item(),
"ensemble_per_root_atom_disagreement": ensemble_scaled_std.item(),
}
)
ret_data["input_data"] = input_data
ret_data["molecule"] = input_data.molecule
ret_data["extras"] = {
"ensemble_energies": energy_array.cpu().detach().numpy(),
"ensemble_energy_avg": energy.item(),
"ensemble_energy_std": ensemble_std.item(),
"ensemble_per_root_atom_disagreement": ensemble_scaled_std.item(),
}

ret_data["provenance"] = Provenance(
creator="torchani", version="unknown", routine="torchani.builtin.aev_computer"
Expand All @@ -186,4 +185,4 @@ def compute(self, input_data: "AtomicInput", config: "TaskConfig") -> "AtomicRes
ret_data["success"] = True

# Form up a dict first, then sent to BaseModel to avoid repeat kwargs which don't override each other
return AtomicResult(**{**input_data.dict(), **ret_data})
return AtomicResult(**ret_data)

0 comments on commit 207044f

Please sign in to comment.