{"action":"created","comment":{"url":"https://api.github.com/repos/choderalab/protons/pulls/comments/90961307","pull_request_review_id":11474487,"id":90961307,"diff_hunk":"@@ -754,6 +755,110 @@ def _cache_force(self, titration_group_index, titration_state_index):\n \n         self.titrationGroups[titration_group_index]['titration_states'][titration_state_index]['forces'] = f_params\n \n+    def _ncmc_ghmc(self, context, titration_group_indices, initial_titration_states, final_titration_states):\n+        \"\"\"\n+        Non equilibrium candidate Monte Carlo (NCMC) with a generalized Hamiltonian Monte Carlo (GHMC) propagator.\n+\n+        Notes\n+        -----\n+        The GHMC integrator is an simtk.openmm.CustomIntegrator object that calculates the protocol work internally.\n+        Although it appears to only take one propagation step per perturbation step (i.e. ghmc.step(1)), multiple\n+        propagation steps can be made depending on how the GHMC integrator was initialized.\n+\n+        To ensure the NCMC protocol is time symmetric, it has the form\n+            propagation --> perturbation --> propagation\n+\n+        Parameters\n+        ----------\n+        context : simtk.openmm.Context\n+            The context in which NCMC will be performed.\n+\n+        titration_group_indices :\n+            The indices of the titratable groups that will be perturbed\n+\n+        initial_titration_states :\n+            The initial protonation state of the titration groups\n+\n+        final_titration_states :\n+            The final protonation state of the titration groups\n+\n+        Returns\n+        -------\n+        work : float\n+          the protocol work of the NCMC procedure in multiples of kT.\n+        \"\"\"\n+        # Turn the barostat and center of mass remover off, otherwise they contribute to the work\n+        if self.barostat is not None:\n+            self.barostat.setFrequency(0)\n+        if self.cm_remover is not None:\n+            self.cm_remover.setFrequency(0)\n+\n+        #TODO: remove explicit calculation of work with `getEnergy`\n+        ghmc = self.compound_integrator.getIntegrator(1)\n+        ghmc.setGlobalVariableByName(\"ntrials\", 0)  # Reset the internally accumulated work\n+        ghmc.setGlobalVariableByName(\"naccept\", 0)  # Reset the GHMC acceptance rate counter\n+\n+        # The \"work\" in the acceptance test has a contribution from the titratable group weights.\n+        g_initial = 0\n+        for titration_group_index, (titration_group, titration_state_index) in enumerate(zip(self.titrationGroups, self.titrationStates)):\n+            titration_state = titration_group['titration_states'][titration_state_index]\n+            g_initial += titration_state['g_k']\n+\n+        # PROPAGATION\n+        ghmc.step(1)\n+\n+        # The slow way to calculate the work","path":"protons/driver.py","position":86,"original_position":86,"commit_id":"257ff557a8b989749bd33629764336bc3691259d","original_commit_id":"257ff557a8b989749bd33629764336bc3691259d","user":{"login":"bas-rustenburg","id":3977731,"avatar_url":"https://avatars.githubusercontent.com/u/3977731?v=3","gravatar_id":"","url":"https://api.github.com/users/bas-rustenburg","html_url":"https://github.com/bas-rustenburg","followers_url":"https://api.github.com/users/bas-rustenburg/followers","following_url":"https://api.github.com/users/bas-rustenburg/following{/other_user}","gists_url":"https://api.github.com/users/bas-rustenburg/gists{/gist_id}","starred_url":"https://api.github.com/users/bas-rustenburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bas-rustenburg/subscriptions","organizations_url":"https://api.github.com/users/bas-rustenburg/orgs","repos_url":"https://api.github.com/users/bas-rustenburg/repos","events_url":"https://api.github.com/users/bas-rustenburg/events{/privacy}","received_events_url":"https://api.github.com/users/bas-rustenburg/received_events","type":"User","site_admin":false},"body":"Should this be removed?","created_at":"2016-12-05T21:39:19Z","updated_at":"2016-12-05T21:39:19Z","html_url":"https://github.com/choderalab/protons/pull/63#discussion_r90961307","pull_request_url":"https://api.github.com/repos/choderalab/protons/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/choderalab/protons/pulls/comments/90961307"},"html":{"href":"https://github.com/choderalab/protons/pull/63#discussion_r90961307"},"pull_request":{"href":"https://api.github.com/repos/choderalab/protons/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/choderalab/protons/pulls/63","id":93189883,"html_url":"https://github.com/choderalab/protons/pull/63","diff_url":"https://github.com/choderalab/protons/pull/63.diff","patch_url":"https://github.com/choderalab/protons/pull/63.patch","issue_url":"https://api.github.com/repos/choderalab/protons/issues/63","number":63,"state":"open","locked":false,"title":"Added NCMC functionality with a specially written generalized Hamilto…","user":{"login":"gregoryross","id":17692797,"avatar_url":"https://avatars.githubusercontent.com/u/17692797?v=3","gravatar_id":"","url":"https://api.github.com/users/gregoryross","html_url":"https://github.com/gregoryross","followers_url":"https://api.github.com/users/gregoryross/followers","following_url":"https://api.github.com/users/gregoryross/following{/other_user}","gists_url":"https://api.github.com/users/gregoryross/gists{/gist_id}","starred_url":"https://api.github.com/users/gregoryross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregoryross/subscriptions","organizations_url":"https://api.github.com/users/gregoryross/orgs","repos_url":"https://api.github.com/users/gregoryross/repos","events_url":"https://api.github.com/users/gregoryross/events{/privacy}","received_events_url":"https://api.github.com/users/gregoryross/received_events","type":"User","site_admin":false},"body":"Added NCMC functionality with a specially written generalized Hamiltonian Monte Carlo propagator (taken from `saltswap`). This is needed for the transition to explicit solvent simulations. Unit tests for the NCMC functionality, these should hopefully emerge naturally as I start to apply `protons` to Abl.","created_at":"2016-11-10T16:59:31Z","updated_at":"2016-12-05T21:56:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab6751596778b83443633a6e4e013250965b8bdb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/choderalab/protons/pulls/63/commits","review_comments_url":"https://api.github.com/repos/choderalab/protons/pulls/63/comments","review_comment_url":"https://api.github.com/repos/choderalab/protons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/choderalab/protons/issues/63/comments","statuses_url":"https://api.github.com/repos/choderalab/protons/statuses/257ff557a8b989749bd33629764336bc3691259d","head":{"label":"choderalab:ncmc_update","ref":"ncmc_update","sha":"257ff557a8b989749bd33629764336bc3691259d","user":{"login":"choderalab","id":4217481,"avatar_url":"https://avatars.githubusercontent.com/u/4217481?v=3","gravatar_id":"","url":"https://api.github.com/users/choderalab","html_url":"https://github.com/choderalab","followers_url":"https://api.github.com/users/choderalab/followers","following_url":"https://api.github.com/users/choderalab/following{/other_user}","gists_url":"https://api.github.com/users/choderalab/gists{/gist_id}","starred_url":"https://api.github.com/users/choderalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choderalab/subscriptions","organizations_url":"https://api.github.com/users/choderalab/orgs","repos_url":"https://api.github.com/users/choderalab/repos","events_url":"https://api.github.com/users/choderalab/events{/privacy}","received_events_url":"https://api.github.com/users/choderalab/received_events","type":"Organization","site_admin":false},"repo":{"id":14162161,"name":"protons","full_name":"choderalab/protons","owner":{"login":"choderalab","id":4217481,"avatar_url":"https://avatars.githubusercontent.com/u/4217481?v=3","gravatar_id":"","url":"https://api.github.com/users/choderalab","html_url":"https://github.com/choderalab","followers_url":"https://api.github.com/users/choderalab/followers","following_url":"https://api.github.com/users/choderalab/following{/other_user}","gists_url":"https://api.github.com/users/choderalab/gists{/gist_id}","starred_url":"https://api.github.com/users/choderalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choderalab/subscriptions","organizations_url":"https://api.github.com/users/choderalab/orgs","repos_url":"https://api.github.com/users/choderalab/repos","events_url":"https://api.github.com/users/choderalab/events{/privacy}","received_events_url":"https://api.github.com/users/choderalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/choderalab/protons","description":"OpenMM testbed for constant-pH methodologies.","fork":false,"url":"https://api.github.com/repos/choderalab/protons","forks_url":"https://api.github.com/repos/choderalab/protons/forks","keys_url":"https://api.github.com/repos/choderalab/protons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choderalab/protons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choderalab/protons/teams","hooks_url":"https://api.github.com/repos/choderalab/protons/hooks","issue_events_url":"https://api.github.com/repos/choderalab/protons/issues/events{/number}","events_url":"https://api.github.com/repos/choderalab/protons/events","assignees_url":"https://api.github.com/repos/choderalab/protons/assignees{/user}","branches_url":"https://api.github.com/repos/choderalab/protons/branches{/branch}","tags_url":"https://api.github.com/repos/choderalab/protons/tags","blobs_url":"https://api.github.com/repos/choderalab/protons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choderalab/protons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choderalab/protons/git/refs{/sha}","trees_url":"https://api.github.com/repos/choderalab/protons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choderalab/protons/statuses/{sha}","languages_url":"https://api.github.com/repos/choderalab/protons/languages","stargazers_url":"https://api.github.com/repos/choderalab/protons/stargazers","contributors_url":"https://api.github.com/repos/choderalab/protons/contributors","subscribers_url":"https://api.github.com/repos/choderalab/protons/subscribers","subscription_url":"https://api.github.com/repos/choderalab/protons/subscription","commits_url":"https://api.github.com/repos/choderalab/protons/commits{/sha}","git_commits_url":"https://api.github.com/repos/choderalab/protons/git/commits{/sha}","comments_url":"https://api.github.com/repos/choderalab/protons/comments{/number}","issue_comment_url":"https://api.github.com/repos/choderalab/protons/issues/comments{/number}","contents_url":"https://api.github.com/repos/choderalab/protons/contents/{+path}","compare_url":"https://api.github.com/repos/choderalab/protons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choderalab/protons/merges","archive_url":"https://api.github.com/repos/choderalab/protons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choderalab/protons/downloads","issues_url":"https://api.github.com/repos/choderalab/protons/issues{/number}","pulls_url":"https://api.github.com/repos/choderalab/protons/pulls{/number}","milestones_url":"https://api.github.com/repos/choderalab/protons/milestones{/number}","notifications_url":"https://api.github.com/repos/choderalab/protons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choderalab/protons/labels{/name}","releases_url":"https://api.github.com/repos/choderalab/protons/releases{/id}","deployments_url":"https://api.github.com/repos/choderalab/protons/deployments","created_at":"2013-11-06T03:38:09Z","updated_at":"2016-10-31T21:00:36Z","pushed_at":"2016-12-05T21:16:57Z","git_url":"git://github.com/choderalab/protons.git","ssh_url":"git@github.com:choderalab/protons.git","clone_url":"https://github.com/choderalab/protons.git","svn_url":"https://github.com/choderalab/protons","homepage":"http://protons.readthedocs.io/","size":43127,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":13,"forks":10,"open_issues":13,"watchers":3,"default_branch":"master"}},"base":{"label":"choderalab:master","ref":"master","sha":"e3a47cb8a15f4274ce950bd4ae1e9b0ddea621af","user":{"login":"choderalab","id":4217481,"avatar_url":"https://avatars.githubusercontent.com/u/4217481?v=3","gravatar_id":"","url":"https://api.github.com/users/choderalab","html_url":"https://github.com/choderalab","followers_url":"https://api.github.com/users/choderalab/followers","following_url":"https://api.github.com/users/choderalab/following{/other_user}","gists_url":"https://api.github.com/users/choderalab/gists{/gist_id}","starred_url":"https://api.github.com/users/choderalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choderalab/subscriptions","organizations_url":"https://api.github.com/users/choderalab/orgs","repos_url":"https://api.github.com/users/choderalab/repos","events_url":"https://api.github.com/users/choderalab/events{/privacy}","received_events_url":"https://api.github.com/users/choderalab/received_events","type":"Organization","site_admin":false},"repo":{"id":14162161,"name":"protons","full_name":"choderalab/protons","owner":{"login":"choderalab","id":4217481,"avatar_url":"https://avatars.githubusercontent.com/u/4217481?v=3","gravatar_id":"","url":"https://api.github.com/users/choderalab","html_url":"https://github.com/choderalab","followers_url":"https://api.github.com/users/choderalab/followers","following_url":"https://api.github.com/users/choderalab/following{/other_user}","gists_url":"https://api.github.com/users/choderalab/gists{/gist_id}","starred_url":"https://api.github.com/users/choderalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choderalab/subscriptions","organizations_url":"https://api.github.com/users/choderalab/orgs","repos_url":"https://api.github.com/users/choderalab/repos","events_url":"https://api.github.com/users/choderalab/events{/privacy}","received_events_url":"https://api.github.com/users/choderalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/choderalab/protons","description":"OpenMM testbed for constant-pH methodologies.","fork":false,"url":"https://api.github.com/repos/choderalab/protons","forks_url":"https://api.github.com/repos/choderalab/protons/forks","keys_url":"https://api.github.com/repos/choderalab/protons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choderalab/protons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choderalab/protons/teams","hooks_url":"https://api.github.com/repos/choderalab/protons/hooks","issue_events_url":"https://api.github.com/repos/choderalab/protons/issues/events{/number}","events_url":"https://api.github.com/repos/choderalab/protons/events","assignees_url":"https://api.github.com/repos/choderalab/protons/assignees{/user}","branches_url":"https://api.github.com/repos/choderalab/protons/branches{/branch}","tags_url":"https://api.github.com/repos/choderalab/protons/tags","blobs_url":"https://api.github.com/repos/choderalab/protons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choderalab/protons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choderalab/protons/git/refs{/sha}","trees_url":"https://api.github.com/repos/choderalab/protons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choderalab/protons/statuses/{sha}","languages_url":"https://api.github.com/repos/choderalab/protons/languages","stargazers_url":"https://api.github.com/repos/choderalab/protons/stargazers","contributors_url":"https://api.github.com/repos/choderalab/protons/contributors","subscribers_url":"https://api.github.com/repos/choderalab/protons/subscribers","subscription_url":"https://api.github.com/repos/choderalab/protons/subscription","commits_url":"https://api.github.com/repos/choderalab/protons/commits{/sha}","git_commits_url":"https://api.github.com/repos/choderalab/protons/git/commits{/sha}","comments_url":"https://api.github.com/repos/choderalab/protons/comments{/number}","issue_comment_url":"https://api.github.com/repos/choderalab/protons/issues/comments{/number}","contents_url":"https://api.github.com/repos/choderalab/protons/contents/{+path}","compare_url":"https://api.github.com/repos/choderalab/protons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choderalab/protons/merges","archive_url":"https://api.github.com/repos/choderalab/protons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choderalab/protons/downloads","issues_url":"https://api.github.com/repos/choderalab/protons/issues{/number}","pulls_url":"https://api.github.com/repos/choderalab/protons/pulls{/number}","milestones_url":"https://api.github.com/repos/choderalab/protons/milestones{/number}","notifications_url":"https://api.github.com/repos/choderalab/protons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choderalab/protons/labels{/name}","releases_url":"https://api.github.com/repos/choderalab/protons/releases{/id}","deployments_url":"https://api.github.com/repos/choderalab/protons/deployments","created_at":"2013-11-06T03:38:09Z","updated_at":"2016-10-31T21:00:36Z","pushed_at":"2016-12-05T21:16:57Z","git_url":"git://github.com/choderalab/protons.git","ssh_url":"git@github.com:choderalab/protons.git","clone_url":"https://github.com/choderalab/protons.git","svn_url":"https://github.com/choderalab/protons","homepage":"http://protons.readthedocs.io/","size":43127,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":13,"forks":10,"open_issues":13,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/choderalab/protons/pulls/63"},"html":{"href":"https://github.com/choderalab/protons/pull/63"},"issue":{"href":"https://api.github.com/repos/choderalab/protons/issues/63"},"comments":{"href":"https://api.github.com/repos/choderalab/protons/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/choderalab/protons/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/choderalab/protons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/choderalab/protons/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/choderalab/protons/statuses/257ff557a8b989749bd33629764336bc3691259d"}}}}
{"actor":{"display_login":"bas-rustenburg"}}