Skip to content

Commit

Permalink
QCSchemaWriter: creator and version are from QC program, routine is f…
Browse files Browse the repository at this point in the history
…rom us
  • Loading branch information
berquist committed Feb 8, 2023
1 parent 65dca47 commit 7ec3f59
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cclib/io/qcschemawriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

import json

from cclib.io.cjsonwriter import CJSON as CJSONWriter, JSONIndentEncoder, NumpyAwareJSONEncoder
from cclib.io.cjsonwriter import (
CJSON as CJSONWriter,
JSONIndentEncoder,
NumpyAwareJSONEncoder,
)
from cclib.parser.utils import convertor, find_package

_found_qcschema = find_package("qcschema")
Expand Down Expand Up @@ -42,9 +46,12 @@ def as_dict(self, validate=True):
"provenance": {
"creator": metadata["package"],
"version": metadata["package_version"],
# FIXME
"routine": "",
"routine": f"{self.__module__}.{self.__class__.__qualname__}",
},
"success": metadata["success"],
"error": None,
"stdout": None,
"stderr": None,
}

# TODO This should be derived from a parsed job type. It's also not
Expand All @@ -59,8 +66,6 @@ def as_dict(self, validate=True):
# TODO what is "properties" for?
qcschema_dict["driver"] = driver

qcschema_dict["success"] = metadata["success"]

# FIXME
# if "keywords" in metadata:
# qcschema_dict["keywords"] = set(metadata["keywords"])
Expand All @@ -76,7 +81,10 @@ def as_dict(self, validate=True):
# FIXME
method = "HF"

qcschema_dict["model"] = {"method": method, "basis": metadata["basis_set"]}
qcschema_dict["model"] = {
"method": method.lower(),
"basis": metadata["basis_set"].lower(),
}

scf_total_energy = convertor(self.ccdata.scfenergies[-1], "eV", "hartree")
mp2_correlation_energy = None
Expand Down Expand Up @@ -196,4 +204,6 @@ def generate_repr(self):
if self.terse:
return json.dumps(qcschema_dict, cls=NumpyAwareJSONEncoder)
else:
return json.dumps(qcschema_dict, cls=JSONIndentEncoder, sort_keys=True, indent=4)
return json.dumps(
qcschema_dict, cls=JSONIndentEncoder, sort_keys=True, indent=4
)

0 comments on commit 7ec3f59

Please sign in to comment.