Optional XML Output from psi4 invocation

Hello - I was wondering if there is any current capability (or planned capability) for psi4 output to be optionally formatted as XML.

Such will make systematic invocations by other platform/code bases much easier.

Any thoughts will be much appreciated.

XML, no. JSON, yes.

This is already possible with psi4 --json. Some test cases here. Part of a larger effort https://github.com/MolSSI/QCSchema and also accessible through https://github.com/MolSSI/QCEngine.

Any particular uses in mind?

The documentation says --json takes in input JSON.

I was more interested in an output JSON or XML.

I am trying to get one of the test cases to work with a manual invocation.

the JSON I am using is (straight from https://github.com/psi4/psi4/blob/master/tests/json/schema-1-energy/input.py)

the invocation is:
psi4 --json input.json

{
“schema_name”: “qc_schema_input”,
“schema_version”: 1,
“molecule”: {
“geometry”: [
0.0,
0.0,
-0.1294769411935893,
0.0,
-1.494187339479985,
1.0274465079245698,
0.0,
1.494187339479985,
1.0274465079245698
],
“symbols”: [
“O”,
“H”,
“H”
]
},
“driver”: “energy”,
“model”: {
“method”: “MP2”,
“basis”: “cc-pVDZ”
},
“keywords”: {“scf_type”: “df”,
“mp2_type”: “df”}
}

It provides a failure output (surprisingly overwrites the input file):

{“schema_name”: “qc_schema_input”, “schema_version”: 1, “molecule”: {“geometry”: [0.0, 0.0, -0.1294769411935893, 0.0, -1.494187339479985, 1.0274465079245698, 0.0, 1.494187339479985, 1.0274465079245698], “symbols”: [“O”, “H”, “H”]}, “driver”: “energy”, “model”: {“method”: “MP2”, “basis”: “cc-pVDZ”}, “keywords”: {“scf_type”: “df”, “mp2_type”: “df”}, “raw_output”: null, “success”: false}

Any insight into what I am doing wrong will be much appreciated.

That’s a bug (the JSON interface is quite new and only used for a very specific purpose at the moment). In the meantime, you can use the python function psi4.json_wrapper.run_json(json_data) which does work with your JSON blob.

Fixed in https://github.com/psi4/psi4/pull/1369

dgasmith: psi4.json_wrapper.run_json(json_data) runs on my end as well. thank you.

loriab: thank you for the fix as well. while I am not a python expert, it seems like the input JSON file is overwritten by the response JSON file in this change as well. while ok, it is a bit of an unorthodox behavior.

perhaps it is unorthodox. for the moment, if this behaviour troubles you, can edit in https://github.com/psi4/psi4/blob/master/psi4/run_psi4.py#L229-L232 (this file becomes bin/psi4) without recompiling. (I don’t know whether you’re compiling or conda installing, but the file from which psi4 is the one to edit.