{"action":"created","comment":{"url":"https://api.github.com/repos/psi4/psi4/pulls/comments/185791755","pull_request_review_id":117251845,"id":185791755,"diff_hunk":"@@ -32,27 +32,206 @@\n import os\n import copy\n import uuid\n+import json\n \n import psi4\n from psi4.driver import driver\n from psi4.driver import molutil\n+from psi4.driver import p4util\n from psi4 import core\n \n-\n-methods_dict = {\n+methods_dict_ = {\n     'energy': driver.energy,\n     'gradient': driver.gradient,\n-    'property': driver.properties,\n+    'properties': driver.properties,\n     'optimize': driver.optimize,\n     'hessian': driver.hessian,\n     'frequency': driver.frequency,\n }\n+can_do_properties_ = {\n+    \"dipole\", \"quadrupole\", \"mulliken_charges\", \"lowdin_charges\", \"wiberg_lowdin_indices\", \"mayer_indices\"\n+}\n+\n+def _clean_psi_environ(do_clean):\n+    if do_clean:\n+        psi4.core.clean_variables()\n+        psi4.core.clean_options()\n+        core.clean()\n+\n+def run_json(json_data, clean=True):\n+\n+    # Set scratch\n+    if \"scratch_location\" in json_data:\n+        psi4_io = core.IOManager.shared_object()\n+        psi4_io.set_default_path(json_data[\"scratch_location\"])\n+\n+    # Set memory\n+    if \"memory\" in json_data:\n+        psi4.set_memory(json_data[\"memory\"])\n \n+    # Do we return the output?\n+    return_output = json_data.pop(\"return_output\", False)\n+    if return_output:\n+        outfile = os.path.join(core.IOManager.shared_object().get_default_path(), str(uuid.uuid4()) + \".json_out\")\n+        core.set_output_file(outfile, False)\n+        json_data[\"raw_output\"] = \"Not yet run.\"\n+\n+    # Set a few flags\n+    json_data[\"raw_output\"] = None\n+    json_data[\"success\"] = False\n+\n+    # Attempt to run the computer\n+    try:\n+        if (\"schema_name\" in json_data) and (json_data[\"schema_name\"] == \"QC_JSON\"):\n+            run_json_qc_schema(json_data, clean)\n+        else:\n+            run_json_original_v1_1(json_data, clean)\n \n-def run_json(json_data):\n+    except Exception as error:\n+        json_data[\"error\"] = repr(error)\n+        json_data[\"success\"] = False\n+\n+    if return_output:\n+        with open(outfile, 'r') as f:\n+            json_data[\"raw_output\"] = f.read()\n+        os.unlink(outfile)\n+\n+    return json_data\n+\n+\n+def run_json_qc_schema(json_data, clean):\n+    \"\"\"\n+    An implementation of the QC JSON Schema (molssi-qc-schema.readthedocs.io/en/latest/index.html#) implementation in Psi4.\n+\n+\n+    Parameters\n+    ----------\n+    json_data : JSON\n+        Please see molssi-qc-schema.readthedocs.io/en/latest/spec_components.html for further details.\n+\n+    Notes\n+    -----\n+    !Warning! This function is experimental and likely to change in the future.\n+    Please report any suggestions or uses of this function on github.com/MolSSI/QC_JSON_Schema.\n+\n+    Examples\n+    --------\n+\n+    \"\"\"\n+\n+    # Clean a few things\n+    _clean_psi_environ(clean)\n+\n+    # This is currently a forced override\n+    json_data[\"schema_version\"] = \"0\"","path":"psi4/driver/json_wrapper.py","position":99,"original_position":99,"commit_id":"2916d486f918ad19545ef59fbc1aebd2939c9f8e","original_commit_id":"2916d486f918ad19545ef59fbc1aebd2939c9f8e","user":{"login":"dgasmith","id":1769841,"avatar_url":"https://avatars2.githubusercontent.com/u/1769841?v=4","gravatar_id":"","url":"https://api.github.com/users/dgasmith","html_url":"https://github.com/dgasmith","followers_url":"https://api.github.com/users/dgasmith/followers","following_url":"https://api.github.com/users/dgasmith/following{/other_user}","gists_url":"https://api.github.com/users/dgasmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dgasmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgasmith/subscriptions","organizations_url":"https://api.github.com/users/dgasmith/orgs","repos_url":"https://api.github.com/users/dgasmith/repos","events_url":"https://api.github.com/users/dgasmith/events{/privacy}","received_events_url":"https://api.github.com/users/dgasmith/received_events","type":"User","site_admin":false},"body":"`0` as an int I think. If we are going to make it easy to compare versions we should make it really easy, some ideas from [here](https://en.wikipedia.org/wiki/Magic_number_(programming)).","created_at":"2018-05-03T13:12:10Z","updated_at":"2018-05-03T13:12:10Z","html_url":"https://github.com/psi4/psi4/pull/979#discussion_r185791755","pull_request_url":"https://api.github.com/repos/psi4/psi4/pulls/979","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/psi4/psi4/pulls/comments/185791755"},"html":{"href":"https://github.com/psi4/psi4/pull/979#discussion_r185791755"},"pull_request":{"href":"https://api.github.com/repos/psi4/psi4/pulls/979"}},"in_reply_to_id":185685635},"pull_request":{"url":"https://api.github.com/repos/psi4/psi4/pulls/979","id":183879499,"html_url":"https://github.com/psi4/psi4/pull/979","diff_url":"https://github.com/psi4/psi4/pull/979.diff","patch_url":"https://github.com/psi4/psi4/pull/979.patch","issue_url":"https://api.github.com/repos/psi4/psi4/issues/979","number":979,"state":"open","locked":false,"title":"QC JSON Schema","user":{"login":"dgasmith","id":1769841,"avatar_url":"https://avatars2.githubusercontent.com/u/1769841?v=4","gravatar_id":"","url":"https://api.github.com/users/dgasmith","html_url":"https://github.com/dgasmith","followers_url":"https://api.github.com/users/dgasmith/followers","following_url":"https://api.github.com/users/dgasmith/following{/other_user}","gists_url":"https://api.github.com/users/dgasmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dgasmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgasmith/subscriptions","organizations_url":"https://api.github.com/users/dgasmith/orgs","repos_url":"https://api.github.com/users/dgasmith/repos","events_url":"https://api.github.com/users/dgasmith/events{/privacy}","received_events_url":"https://api.github.com/users/dgasmith/received_events","type":"User","site_admin":false},"body":"## Description\r\nAdds the ability to consume and produce MolSSI QC JSON Schema.\r\n\r\n## Todos\r\nNotable points that this PR has either accomplished or will accomplish.\r\n* **Developer Interest**\r\n  - [x] A prototype MolSSI QC Schema has been implemented (http://molssi-qc-schema.readthedocs.io/en/latest/index.html).\r\n\r\n## Questions\r\n- [ ] How much validation do we want?\r\n- [ ] A full test suite should like come from the schema itself?\r\n- [x] How we will we handle extra psi vars? Is the current setup sufficient.\r\n\r\n## Status\r\n- [x] Ready for review\r\n- [x] Ready for merge","created_at":"2018-04-24T22:16:21Z","updated_at":"2018-05-03T13:12:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd321028cfc6f331b58dd5f42a23e9866b068d94","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":34310633,"url":"https://api.github.com/repos/psi4/psi4/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":{"url":"https://api.github.com/repos/psi4/psi4/milestones/3","html_url":"https://github.com/psi4/psi4/milestone/3","labels_url":"https://api.github.com/repos/psi4/psi4/milestones/3/labels","id":2362493,"number":3,"title":"Psi4 1.2","description":"Milstones for the 1.2.0 release.","creator":{"login":"dgasmith","id":1769841,"avatar_url":"https://avatars2.githubusercontent.com/u/1769841?v=4","gravatar_id":"","url":"https://api.github.com/users/dgasmith","html_url":"https://github.com/dgasmith","followers_url":"https://api.github.com/users/dgasmith/followers","following_url":"https://api.github.com/users/dgasmith/following{/other_user}","gists_url":"https://api.github.com/users/dgasmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dgasmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgasmith/subscriptions","organizations_url":"https://api.github.com/users/dgasmith/orgs","repos_url":"https://api.github.com/users/dgasmith/repos","events_url":"https://api.github.com/users/dgasmith/events{/privacy}","received_events_url":"https://api.github.com/users/dgasmith/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":161,"state":"open","created_at":"2017-03-04T04:00:03Z","updated_at":"2018-05-03T00:03:33Z","due_on":"2018-06-30T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/psi4/psi4/pulls/979/commits","review_comments_url":"https://api.github.com/repos/psi4/psi4/pulls/979/comments","review_comment_url":"https://api.github.com/repos/psi4/psi4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/psi4/psi4/issues/979/comments","statuses_url":"https://api.github.com/repos/psi4/psi4/statuses/2916d486f918ad19545ef59fbc1aebd2939c9f8e","head":{"label":"psi4:qc_json","ref":"qc_json","sha":"2916d486f918ad19545ef59fbc1aebd2939c9f8e","user":{"login":"psi4","id":2636883,"avatar_url":"https://avatars1.githubusercontent.com/u/2636883?v=4","gravatar_id":"","url":"https://api.github.com/users/psi4","html_url":"https://github.com/psi4","followers_url":"https://api.github.com/users/psi4/followers","following_url":"https://api.github.com/users/psi4/following{/other_user}","gists_url":"https://api.github.com/users/psi4/gists{/gist_id}","starred_url":"https://api.github.com/users/psi4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psi4/subscriptions","organizations_url":"https://api.github.com/users/psi4/orgs","repos_url":"https://api.github.com/users/psi4/repos","events_url":"https://api.github.com/users/psi4/events{/privacy}","received_events_url":"https://api.github.com/users/psi4/received_events","type":"Organization","site_admin":false},"repo":{"id":9174469,"name":"psi4","full_name":"psi4/psi4","owner":{"login":"psi4","id":2636883,"avatar_url":"https://avatars1.githubusercontent.com/u/2636883?v=4","gravatar_id":"","url":"https://api.github.com/users/psi4","html_url":"https://github.com/psi4","followers_url":"https://api.github.com/users/psi4/followers","following_url":"https://api.github.com/users/psi4/following{/other_user}","gists_url":"https://api.github.com/users/psi4/gists{/gist_id}","starred_url":"https://api.github.com/users/psi4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psi4/subscriptions","organizations_url":"https://api.github.com/users/psi4/orgs","repos_url":"https://api.github.com/users/psi4/repos","events_url":"https://api.github.com/users/psi4/events{/privacy}","received_events_url":"https://api.github.com/users/psi4/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/psi4/psi4","description":"Open-Source Quantum Chemistry – an electronic structure package in C++ driven by Python","fork":false,"url":"https://api.github.com/repos/psi4/psi4","forks_url":"https://api.github.com/repos/psi4/psi4/forks","keys_url":"https://api.github.com/repos/psi4/psi4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/psi4/psi4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/psi4/psi4/teams","hooks_url":"https://api.github.com/repos/psi4/psi4/hooks","issue_events_url":"https://api.github.com/repos/psi4/psi4/issues/events{/number}","events_url":"https://api.github.com/repos/psi4/psi4/events","assignees_url":"https://api.github.com/repos/psi4/psi4/assignees{/user}","branches_url":"https://api.github.com/repos/psi4/psi4/branches{/branch}","tags_url":"https://api.github.com/repos/psi4/psi4/tags","blobs_url":"https://api.github.com/repos/psi4/psi4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/psi4/psi4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/psi4/psi4/git/refs{/sha}","trees_url":"https://api.github.com/repos/psi4/psi4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/psi4/psi4/statuses/{sha}","languages_url":"https://api.github.com/repos/psi4/psi4/languages","stargazers_url":"https://api.github.com/repos/psi4/psi4/stargazers","contributors_url":"https://api.github.com/repos/psi4/psi4/contributors","subscribers_url":"https://api.github.com/repos/psi4/psi4/subscribers","subscription_url":"https://api.github.com/repos/psi4/psi4/subscription","commits_url":"https://api.github.com/repos/psi4/psi4/commits{/sha}","git_commits_url":"https://api.github.com/repos/psi4/psi4/git/commits{/sha}","comments_url":"https://api.github.com/repos/psi4/psi4/comments{/number}","issue_comment_url":"https://api.github.com/repos/psi4/psi4/issues/comments{/number}","contents_url":"https://api.github.com/repos/psi4/psi4/contents/{+path}","compare_url":"https://api.github.com/repos/psi4/psi4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/psi4/psi4/merges","archive_url":"https://api.github.com/repos/psi4/psi4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/psi4/psi4/downloads","issues_url":"https://api.github.com/repos/psi4/psi4/issues{/number}","pulls_url":"https://api.github.com/repos/psi4/psi4/pulls{/number}","milestones_url":"https://api.github.com/repos/psi4/psi4/milestones{/number}","notifications_url":"https://api.github.com/repos/psi4/psi4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/psi4/psi4/labels{/name}","releases_url":"https://api.github.com/repos/psi4/psi4/releases{/id}","deployments_url":"https://api.github.com/repos/psi4/psi4/deployments","created_at":"2013-04-02T16:21:04Z","updated_at":"2018-05-03T10:12:46Z","pushed_at":"2018-05-03T10:14:39Z","git_url":"git://github.com/psi4/psi4.git","ssh_url":"git@github.com:psi4/psi4.git","clone_url":"https://github.com/psi4/psi4.git","svn_url":"https://github.com/psi4/psi4","homepage":"http://psicode.org","size":81172,"stargazers_count":203,"watchers_count":203,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"archived":false,"open_issues_count":66,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":169,"open_issues":66,"watchers":203,"default_branch":"master"}},"base":{"label":"psi4:master","ref":"master","sha":"a2eb599d9f08b976193a14c19b1a0cc9e643e9bf","user":{"login":"psi4","id":2636883,"avatar_url":"https://avatars1.githubusercontent.com/u/2636883?v=4","gravatar_id":"","url":"https://api.github.com/users/psi4","html_url":"https://github.com/psi4","followers_url":"https://api.github.com/users/psi4/followers","following_url":"https://api.github.com/users/psi4/following{/other_user}","gists_url":"https://api.github.com/users/psi4/gists{/gist_id}","starred_url":"https://api.github.com/users/psi4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psi4/subscriptions","organizations_url":"https://api.github.com/users/psi4/orgs","repos_url":"https://api.github.com/users/psi4/repos","events_url":"https://api.github.com/users/psi4/events{/privacy}","received_events_url":"https://api.github.com/users/psi4/received_events","type":"Organization","site_admin":false},"repo":{"id":9174469,"name":"psi4","full_name":"psi4/psi4","owner":{"login":"psi4","id":2636883,"avatar_url":"https://avatars1.githubusercontent.com/u/2636883?v=4","gravatar_id":"","url":"https://api.github.com/users/psi4","html_url":"https://github.com/psi4","followers_url":"https://api.github.com/users/psi4/followers","following_url":"https://api.github.com/users/psi4/following{/other_user}","gists_url":"https://api.github.com/users/psi4/gists{/gist_id}","starred_url":"https://api.github.com/users/psi4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psi4/subscriptions","organizations_url":"https://api.github.com/users/psi4/orgs","repos_url":"https://api.github.com/users/psi4/repos","events_url":"https://api.github.com/users/psi4/events{/privacy}","received_events_url":"https://api.github.com/users/psi4/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/psi4/psi4","description":"Open-Source Quantum Chemistry – an electronic structure package in C++ driven by Python","fork":false,"url":"https://api.github.com/repos/psi4/psi4","forks_url":"https://api.github.com/repos/psi4/psi4/forks","keys_url":"https://api.github.com/repos/psi4/psi4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/psi4/psi4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/psi4/psi4/teams","hooks_url":"https://api.github.com/repos/psi4/psi4/hooks","issue_events_url":"https://api.github.com/repos/psi4/psi4/issues/events{/number}","events_url":"https://api.github.com/repos/psi4/psi4/events","assignees_url":"https://api.github.com/repos/psi4/psi4/assignees{/user}","branches_url":"https://api.github.com/repos/psi4/psi4/branches{/branch}","tags_url":"https://api.github.com/repos/psi4/psi4/tags","blobs_url":"https://api.github.com/repos/psi4/psi4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/psi4/psi4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/psi4/psi4/git/refs{/sha}","trees_url":"https://api.github.com/repos/psi4/psi4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/psi4/psi4/statuses/{sha}","languages_url":"https://api.github.com/repos/psi4/psi4/languages","stargazers_url":"https://api.github.com/repos/psi4/psi4/stargazers","contributors_url":"https://api.github.com/repos/psi4/psi4/contributors","subscribers_url":"https://api.github.com/repos/psi4/psi4/subscribers","subscription_url":"https://api.github.com/repos/psi4/psi4/subscription","commits_url":"https://api.github.com/repos/psi4/psi4/commits{/sha}","git_commits_url":"https://api.github.com/repos/psi4/psi4/git/commits{/sha}","comments_url":"https://api.github.com/repos/psi4/psi4/comments{/number}","issue_comment_url":"https://api.github.com/repos/psi4/psi4/issues/comments{/number}","contents_url":"https://api.github.com/repos/psi4/psi4/contents/{+path}","compare_url":"https://api.github.com/repos/psi4/psi4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/psi4/psi4/merges","archive_url":"https://api.github.com/repos/psi4/psi4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/psi4/psi4/downloads","issues_url":"https://api.github.com/repos/psi4/psi4/issues{/number}","pulls_url":"https://api.github.com/repos/psi4/psi4/pulls{/number}","milestones_url":"https://api.github.com/repos/psi4/psi4/milestones{/number}","notifications_url":"https://api.github.com/repos/psi4/psi4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/psi4/psi4/labels{/name}","releases_url":"https://api.github.com/repos/psi4/psi4/releases{/id}","deployments_url":"https://api.github.com/repos/psi4/psi4/deployments","created_at":"2013-04-02T16:21:04Z","updated_at":"2018-05-03T10:12:46Z","pushed_at":"2018-05-03T10:14:39Z","git_url":"git://github.com/psi4/psi4.git","ssh_url":"git@github.com:psi4/psi4.git","clone_url":"https://github.com/psi4/psi4.git","svn_url":"https://github.com/psi4/psi4","homepage":"http://psicode.org","size":81172,"stargazers_count":203,"watchers_count":203,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"archived":false,"open_issues_count":66,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0"},"forks":169,"open_issues":66,"watchers":203,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/psi4/psi4/pulls/979"},"html":{"href":"https://github.com/psi4/psi4/pull/979"},"issue":{"href":"https://api.github.com/repos/psi4/psi4/issues/979"},"comments":{"href":"https://api.github.com/repos/psi4/psi4/issues/979/comments"},"review_comments":{"href":"https://api.github.com/repos/psi4/psi4/pulls/979/comments"},"review_comment":{"href":"https://api.github.com/repos/psi4/psi4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/psi4/psi4/pulls/979/commits"},"statuses":{"href":"https://api.github.com/repos/psi4/psi4/statuses/2916d486f918ad19545ef59fbc1aebd2939c9f8e"}},"author_association":"OWNER"}}
{"actor":{"display_login":"dgasmith"}}