{"action":"created","comment":{"url":"https://api.github.com/repos/psi4/psi4/pulls/comments/227050464","pull_request_review_id":167004261,"id":227050464,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzA1MDQ2NA==","diff_hunk":"@@ -123,6 +123,120 @@ def pybuild_wavefunction(mol, basis=None):\n \n core.Wavefunction.build = pybuild_wavefunction\n \n+\n+@staticmethod\n+def pyread_wavefunction(filename):\n+    wfn_data = np.load(filename + '.npy').item()\n+    \n+    # variable type specific dictionaries to be passed into C++ constructor\n+    wfn_matrix = wfn_data['matrix']\n+    wfn_vector= wfn_data['vector']\n+    wfn_dimension = wfn_data['dimension']\n+    wfn_int = wfn_data['int']\n+    wfn_string = wfn_data['string']\n+    wfn_boolean = wfn_data['boolean']\n+    wfn_float = wfn_data['float']\n+\n+    # reconstruct molecule from dictionary representation\n+    wfn_molecule = wfn_data['molecule']\n+    molecule = core.Molecule.from_dict(wfn_molecule)\n+\n+    # get basis set name and spherical harmonics boolean\n+    basis_name = wfn_string['basisname']\n+    if \".gbs\" in basis_name:\n+        basis_name = basis_name.split('/')[-1].replace('.gbs', '')\n+\n+    basis_puream = wfn_boolean['basispuream']\n+    basisset = core.BasisSet.build(molecule, 'ORBITAL', basis_name, puream=basis_puream)\n+    core.print_out('printing type of basis set\\n')\n+    core.print_out(str(type(basisset)))\n+\n+    # change some variables to psi4 specific data types (Matrix, Vector, Dimension)\n+    # TODO: Make sure python's 'None' translates sensibly to C++","path":"psi4/driver/p4util/python_helpers.py","position":33,"original_position":33,"commit_id":"61c3e0c4184c9092c15a14fbd800428c02c16aee","original_commit_id":"61c3e0c4184c9092c15a14fbd800428c02c16aee","user":{"login":"dgasmith","id":1769841,"node_id":"MDQ6VXNlcjE3Njk4NDE=","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":"I think None should translate to `nullptr` always here? Worth checking.","created_at":"2018-10-22T16:47:33Z","updated_at":"2018-10-22T16:58:33Z","html_url":"https://github.com/psi4/psi4/pull/1304#discussion_r227050464","pull_request_url":"https://api.github.com/repos/psi4/psi4/pulls/1304","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/psi4/psi4/pulls/comments/227050464"},"html":{"href":"https://github.com/psi4/psi4/pull/1304#discussion_r227050464"},"pull_request":{"href":"https://api.github.com/repos/psi4/psi4/pulls/1304"}}},"pull_request":{"url":"https://api.github.com/repos/psi4/psi4/pulls/1304","id":224690943,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NjkwOTQz","html_url":"https://github.com/psi4/psi4/pull/1304","diff_url":"https://github.com/psi4/psi4/pull/1304.diff","patch_url":"https://github.com/psi4/psi4/pull/1304.patch","issue_url":"https://api.github.com/repos/psi4/psi4/issues/1304","number":1304,"state":"open","locked":false,"title":"Serialize Wavefunction ","user":{"login":"zachglick","id":16376046,"node_id":"MDQ6VXNlcjE2Mzc2MDQ2","avatar_url":"https://avatars3.githubusercontent.com/u/16376046?v=4","gravatar_id":"","url":"https://api.github.com/users/zachglick","html_url":"https://github.com/zachglick","followers_url":"https://api.github.com/users/zachglick/followers","following_url":"https://api.github.com/users/zachglick/following{/other_user}","gists_url":"https://api.github.com/users/zachglick/gists{/gist_id}","starred_url":"https://api.github.com/users/zachglick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachglick/subscriptions","organizations_url":"https://api.github.com/users/zachglick/orgs","repos_url":"https://api.github.com/users/zachglick/repos","events_url":"https://api.github.com/users/zachglick/events{/privacy}","received_events_url":"https://api.github.com/users/zachglick/received_events","type":"User","site_admin":false},"body":"## Description\r\nThis is a first pass at implementing serialization of the Wavefunction object as suggested by @dgasmith in #887 . This functionality allows a wavefunction to be read to or written from a file:\r\n```\r\n# get a wavefunction from some calculation\r\ne, wfn_old = energy('mp2', return_wfn=True)\r\n\r\n# write the wavefunction to file\r\nWavefunction.to_file(wfn_old, filename)\r\n\r\n# ...\r\n# other calculations may occur\r\n# ...\r\n\r\n# read the wavefunction from file\r\nwfn_new = Wavefunction.from_file(filename)\r\n```\r\nIn this code snippet, `wfn_new` and `wfn_old` should be identical (by value, not reference). A test case was added that corresponds to this example.\r\n\r\n## Todos\r\nNotable points (developer or user-interest) that this PR has or will accomplish.\r\n- [x] Read/Write Wavefunction object to file\r\n- [ ] Serialize a few more variables (PCM related stuff, etc.)\r\n- [ ] Deal with Wavefunction inheritance?\r\n\r\n## Questions\r\n- [ ] Does anyone have thoughts on the file naming scheme? Currently, the user specifies the filename in the call and a `.npy` file is generated in the working directory. This allows the user to have an arbitrary number of saved wavefunctions that persist between jobs. Alternatively, using a reserved filename (similar the `scf guess` procedure) might be better because users wouldn't have to work with filenames at all, but they would be limited to a single wavefunction.\r\n- [ ] How should classes that are derived from Wavefunction (like CIWavefunction) be dealt with?\r\n- [ ] Is everything implemented in a reasonable location? \r\n- [ ] Any inconsistencies in format/style?\r\n\r\n## Checklist\r\n- [x] Added Test `serial-wfn`\r\n- [ ] [All or relevant fraction of full tests run](http://psicode.org/psi4manual/master/build_planning.html#how-to-run-a-subset-of-tests)\r\n\r\n## Status\r\n- [ ] Ready for review\r\n- [ ] Ready for merge\r\n","created_at":"2018-10-22T14:01:57Z","updated_at":"2018-10-22T16:58:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4b104bea12a63d9a344f342f535010d0b48fd9e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/psi4/psi4/pulls/1304/commits","review_comments_url":"https://api.github.com/repos/psi4/psi4/pulls/1304/comments","review_comment_url":"https://api.github.com/repos/psi4/psi4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/psi4/psi4/issues/1304/comments","statuses_url":"https://api.github.com/repos/psi4/psi4/statuses/61c3e0c4184c9092c15a14fbd800428c02c16aee","head":{"label":"zachglick:serialize_wfn","ref":"serialize_wfn","sha":"61c3e0c4184c9092c15a14fbd800428c02c16aee","user":{"login":"zachglick","id":16376046,"node_id":"MDQ6VXNlcjE2Mzc2MDQ2","avatar_url":"https://avatars3.githubusercontent.com/u/16376046?v=4","gravatar_id":"","url":"https://api.github.com/users/zachglick","html_url":"https://github.com/zachglick","followers_url":"https://api.github.com/users/zachglick/followers","following_url":"https://api.github.com/users/zachglick/following{/other_user}","gists_url":"https://api.github.com/users/zachglick/gists{/gist_id}","starred_url":"https://api.github.com/users/zachglick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachglick/subscriptions","organizations_url":"https://api.github.com/users/zachglick/orgs","repos_url":"https://api.github.com/users/zachglick/repos","events_url":"https://api.github.com/users/zachglick/events{/privacy}","received_events_url":"https://api.github.com/users/zachglick/received_events","type":"User","site_admin":false},"repo":{"id":150128391,"node_id":"MDEwOlJlcG9zaXRvcnkxNTAxMjgzOTE=","name":"psi4","full_name":"zachglick/psi4","private":false,"owner":{"login":"zachglick","id":16376046,"node_id":"MDQ6VXNlcjE2Mzc2MDQ2","avatar_url":"https://avatars3.githubusercontent.com/u/16376046?v=4","gravatar_id":"","url":"https://api.github.com/users/zachglick","html_url":"https://github.com/zachglick","followers_url":"https://api.github.com/users/zachglick/followers","following_url":"https://api.github.com/users/zachglick/following{/other_user}","gists_url":"https://api.github.com/users/zachglick/gists{/gist_id}","starred_url":"https://api.github.com/users/zachglick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zachglick/subscriptions","organizations_url":"https://api.github.com/users/zachglick/orgs","repos_url":"https://api.github.com/users/zachglick/repos","events_url":"https://api.github.com/users/zachglick/events{/privacy}","received_events_url":"https://api.github.com/users/zachglick/received_events","type":"User","site_admin":false},"html_url":"https://github.com/zachglick/psi4","description":"Open-Source Quantum Chemistry – an electronic structure package in C++ driven by Python","fork":true,"url":"https://api.github.com/repos/zachglick/psi4","forks_url":"https://api.github.com/repos/zachglick/psi4/forks","keys_url":"https://api.github.com/repos/zachglick/psi4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zachglick/psi4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zachglick/psi4/teams","hooks_url":"https://api.github.com/repos/zachglick/psi4/hooks","issue_events_url":"https://api.github.com/repos/zachglick/psi4/issues/events{/number}","events_url":"https://api.github.com/repos/zachglick/psi4/events","assignees_url":"https://api.github.com/repos/zachglick/psi4/assignees{/user}","branches_url":"https://api.github.com/repos/zachglick/psi4/branches{/branch}","tags_url":"https://api.github.com/repos/zachglick/psi4/tags","blobs_url":"https://api.github.com/repos/zachglick/psi4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zachglick/psi4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zachglick/psi4/git/refs{/sha}","trees_url":"https://api.github.com/repos/zachglick/psi4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zachglick/psi4/statuses/{sha}","languages_url":"https://api.github.com/repos/zachglick/psi4/languages","stargazers_url":"https://api.github.com/repos/zachglick/psi4/stargazers","contributors_url":"https://api.github.com/repos/zachglick/psi4/contributors","subscribers_url":"https://api.github.com/repos/zachglick/psi4/subscribers","subscription_url":"https://api.github.com/repos/zachglick/psi4/subscription","commits_url":"https://api.github.com/repos/zachglick/psi4/commits{/sha}","git_commits_url":"https://api.github.com/repos/zachglick/psi4/git/commits{/sha}","comments_url":"https://api.github.com/repos/zachglick/psi4/comments{/number}","issue_comment_url":"https://api.github.com/repos/zachglick/psi4/issues/comments{/number}","contents_url":"https://api.github.com/repos/zachglick/psi4/contents/{+path}","compare_url":"https://api.github.com/repos/zachglick/psi4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zachglick/psi4/merges","archive_url":"https://api.github.com/repos/zachglick/psi4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zachglick/psi4/downloads","issues_url":"https://api.github.com/repos/zachglick/psi4/issues{/number}","pulls_url":"https://api.github.com/repos/zachglick/psi4/pulls{/number}","milestones_url":"https://api.github.com/repos/zachglick/psi4/milestones{/number}","notifications_url":"https://api.github.com/repos/zachglick/psi4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zachglick/psi4/labels{/name}","releases_url":"https://api.github.com/repos/zachglick/psi4/releases{/id}","deployments_url":"https://api.github.com/repos/zachglick/psi4/deployments","created_at":"2018-09-24T15:52:58Z","updated_at":"2018-09-24T15:53:20Z","pushed_at":"2018-10-22T13:47:42Z","git_url":"git://github.com/zachglick/psi4.git","ssh_url":"git@github.com:zachglick/psi4.git","clone_url":"https://github.com/zachglick/psi4.git","svn_url":"https://github.com/zachglick/psi4","homepage":"http://psicode.org","size":87285,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"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","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"psi4:master","ref":"master","sha":"45f2df29ebfffc5dbe796d78d69b2854f98c489a","user":{"login":"psi4","id":2636883,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MzY4ODM=","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,"node_id":"MDEwOlJlcG9zaXRvcnk5MTc0NDY5","name":"psi4","full_name":"psi4/psi4","private":false,"owner":{"login":"psi4","id":2636883,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MzY4ODM=","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},"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-10-21T16:18:40Z","pushed_at":"2018-10-22T14:08:10Z","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":87296,"stargazers_count":244,"watchers_count":244,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":197,"mirror_url":null,"archived":false,"open_issues_count":120,"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","node_id":"MDc6TGljZW5zZTEy"},"forks":197,"open_issues":120,"watchers":244,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/psi4/psi4/pulls/1304"},"html":{"href":"https://github.com/psi4/psi4/pull/1304"},"issue":{"href":"https://api.github.com/repos/psi4/psi4/issues/1304"},"comments":{"href":"https://api.github.com/repos/psi4/psi4/issues/1304/comments"},"review_comments":{"href":"https://api.github.com/repos/psi4/psi4/pulls/1304/comments"},"review_comment":{"href":"https://api.github.com/repos/psi4/psi4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/psi4/psi4/pulls/1304/commits"},"statuses":{"href":"https://api.github.com/repos/psi4/psi4/statuses/61c3e0c4184c9092c15a14fbd800428c02c16aee"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dgasmith"}}