{"action":"created","comment":{"url":"https://api.github.com/repos/readdy/readdy/pulls/comments/192780487","pull_request_review_id":125620563,"id":192780487,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Mjc4MDQ4Nw==","diff_hunk":"@@ -364,6 +366,447 @@ void SCPUGillespie::perform(const util::PerformanceNode &node) {\n     // update data structure\n     data->update(std::move(particlesUpdate));\n }\n+\n+ParticleBackup::ParticleBackup(event_t event,\n+                               const readdy::model::actions::reactions::ReversibleReactionConfig *revReaction,\n+                               const readdy::model::reactions::Reaction *reaction, const scpu_data *data) {\n+    switch (revReaction->reversibleType) {\n+        case readdy::model::actions::reactions::FusionFission: {\n+            nParticles = event.nEducts;\n+            idx1 = event.idx1;\n+            t1 = event.t1;\n+            idx2 = event.idx2;\n+            t2 = event.t2;\n+            pos1 = data->entry_at(idx1).position();\n+            pos2 = data->entry_at(idx2).position();\n+            break;\n+        }\n+        case readdy::model::actions::reactions::ConversionConversion: {\n+            nParticles = 1;\n+            idx1 = event.idx1;\n+            t1 = event.t1;\n+            pos1 = data->entry_at(idx1).position();\n+            break;\n+        }\n+        case readdy::model::actions::reactions::EnzymaticEnzymatic:{\n+            nParticles = 1;\n+            // find out which particle is the catalyst in A + C -> B + C\n+            if (event.t1 == reaction->educts()[1]) {\n+                idx1 = event.idx2;\n+                t1 = event.t2;\n+                pos1 = data->entry_at(idx1).position();\n+            } else if (event.t2 == reaction->educts()[1]){\n+                idx1 = event.idx1;\n+                t1 = event.t1;\n+                pos1 = data->entry_at(idx1).position();\n+            } else {\n+                throw std::runtime_error(\"Should not get here\");\n+            }\n+            break;\n+        }\n+        default: throw std::runtime_error(\"Should not get here\");\n+    }\n+}\n+\n+void SCPUDetailedBalance::perform(const readdy::util::PerformanceNode &node) {\n+    auto t = node.timeit();\n+\n+    const auto &ctx = kernel->context();\n+    if(ctx.reactions().nOrder1() == 0 && ctx.reactions().nOrder2() == 0) {\n+        return;\n+    }\n+\n+    auto &stateModel = kernel->getSCPUKernelStateModel();\n+    if(ctx.recordReactionCounts()) {\n+        stateModel.resetReactionCounts();\n+    }\n+\n+    auto data = stateModel.getParticleData();\n+    const auto nl = stateModel.getNeighborList();\n+\n+    scalar alpha = 0.0;\n+    std::vector<event_t> events;\n+    gatherEvents(kernel, *nl, *data, alpha, events);\n+\n+    const auto filterEventsInAdvance = false;","path":"kernels/singlecpu/src/actions/SCPUReactionImpls.cpp","position":75,"original_position":75,"commit_id":"854cb9024e02f3c9c0cfe80898caef4085c660e5","original_commit_id":"854cb9024e02f3c9c0cfe80898caef4085c660e5","user":{"login":"clonker","id":1685266,"node_id":"MDQ6VXNlcjE2ODUyNjY=","avatar_url":"https://avatars0.githubusercontent.com/u/1685266?v=4","gravatar_id":"","url":"https://api.github.com/users/clonker","html_url":"https://github.com/clonker","followers_url":"https://api.github.com/users/clonker/followers","following_url":"https://api.github.com/users/clonker/following{/other_user}","gists_url":"https://api.github.com/users/clonker/gists{/gist_id}","starred_url":"https://api.github.com/users/clonker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clonker/subscriptions","organizations_url":"https://api.github.com/users/clonker/orgs","repos_url":"https://api.github.com/users/clonker/repos","events_url":"https://api.github.com/users/clonker/events{/privacy}","received_events_url":"https://api.github.com/users/clonker/received_events","type":"User","site_admin":false},"body":"i think this filterEventsInAdvance can be removed","created_at":"2018-06-04T15:22:54Z","updated_at":"2018-06-04T15:57:01Z","html_url":"https://github.com/readdy/readdy/pull/123#discussion_r192780487","pull_request_url":"https://api.github.com/repos/readdy/readdy/pulls/123","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/readdy/readdy/pulls/comments/192780487"},"html":{"href":"https://github.com/readdy/readdy/pull/123#discussion_r192780487"},"pull_request":{"href":"https://api.github.com/repos/readdy/readdy/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/readdy/readdy/pulls/123","id":192438279,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNDM4Mjc5","html_url":"https://github.com/readdy/readdy/pull/123","diff_url":"https://github.com/readdy/readdy/pull/123.diff","patch_url":"https://github.com/readdy/readdy/pull/123.patch","issue_url":"https://api.github.com/repos/readdy/readdy/issues/123","number":123,"state":"open","locked":false,"title":"Detailed balance reaction handler (SingleCPU)","user":{"login":"chrisfroe","id":5288581,"node_id":"MDQ6VXNlcjUyODg1ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/5288581?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisfroe","html_url":"https://github.com/chrisfroe","followers_url":"https://api.github.com/users/chrisfroe/followers","following_url":"https://api.github.com/users/chrisfroe/following{/other_user}","gists_url":"https://api.github.com/users/chrisfroe/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfroe/subscriptions","organizations_url":"https://api.github.com/users/chrisfroe/orgs","repos_url":"https://api.github.com/users/chrisfroe/repos","events_url":"https://api.github.com/users/chrisfroe/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfroe/received_events","type":"User","site_admin":false},"body":"A new reaction handler `DetailedBalance` for handling reversible reactions, i.e. two reactions where the educts of one reaction are the products of the other reaction and vice versa. Currently supported types of reversible reactions are\r\n- FusionFission `A + B <--> C`, the interaction potential of `A` and `B` is used to construct a non-uniform proposal density in the `Fission` step.\r\n- ConversionConversion `A <--> B`\r\n- EnzymaticEnzymatic `A + C <--> B + C`\r\n\r\nWhen the handler is constructed it searches for reversible reactions in the set of all registered reactions. Each type of reversible reaction is assumed to correspond to a macroscopic system with macro-rates and equilibrium constants (which are further described in the corresponding paper).\r\n\r\nDuring execution, each reaction event is handled individually. \r\n\r\nIf the reaction type of the event is in the subset of reversible reactions, a move will be proposed. Based on the change of energy and additional factors specific to the type of reversible reaction, an acceptance probability is calculated. Hence the move is either accepted or rejected. In the latter case a backward-move is applied to the data structure.\r\n\r\nIf the reaction type of the event is not reversible, the 'usual' execution of the reaction event is used (Doi model). \r\n\r\n## Usage\r\nSelect `DetailedBalance` as reaction handler\r\n```python\r\n...\r\nsimulation.reaction_handler = \"DetailedBalance\"\r\n```","created_at":"2018-06-04T15:04:34Z","updated_at":"2018-06-04T15:57:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"036b72cef9dd1cecc7291fe5942c17b21d6be0a5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/readdy/readdy/pulls/123/commits","review_comments_url":"https://api.github.com/repos/readdy/readdy/pulls/123/comments","review_comment_url":"https://api.github.com/repos/readdy/readdy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/readdy/readdy/issues/123/comments","statuses_url":"https://api.github.com/repos/readdy/readdy/statuses/854cb9024e02f3c9c0cfe80898caef4085c660e5","head":{"label":"chrisfroe:db_squash","ref":"db_squash","sha":"854cb9024e02f3c9c0cfe80898caef4085c660e5","user":{"login":"chrisfroe","id":5288581,"node_id":"MDQ6VXNlcjUyODg1ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/5288581?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisfroe","html_url":"https://github.com/chrisfroe","followers_url":"https://api.github.com/users/chrisfroe/followers","following_url":"https://api.github.com/users/chrisfroe/following{/other_user}","gists_url":"https://api.github.com/users/chrisfroe/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfroe/subscriptions","organizations_url":"https://api.github.com/users/chrisfroe/orgs","repos_url":"https://api.github.com/users/chrisfroe/repos","events_url":"https://api.github.com/users/chrisfroe/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfroe/received_events","type":"User","site_admin":false},"repo":{"id":60003544,"node_id":"MDEwOlJlcG9zaXRvcnk2MDAwMzU0NA==","name":"readdy","full_name":"chrisfroe/readdy","owner":{"login":"chrisfroe","id":5288581,"node_id":"MDQ6VXNlcjUyODg1ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/5288581?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisfroe","html_url":"https://github.com/chrisfroe","followers_url":"https://api.github.com/users/chrisfroe/followers","following_url":"https://api.github.com/users/chrisfroe/following{/other_user}","gists_url":"https://api.github.com/users/chrisfroe/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfroe/subscriptions","organizations_url":"https://api.github.com/users/chrisfroe/orgs","repos_url":"https://api.github.com/users/chrisfroe/repos","events_url":"https://api.github.com/users/chrisfroe/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfroe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrisfroe/readdy","description":"Python / C++ based particle reaction-diffusion simulator","fork":true,"url":"https://api.github.com/repos/chrisfroe/readdy","forks_url":"https://api.github.com/repos/chrisfroe/readdy/forks","keys_url":"https://api.github.com/repos/chrisfroe/readdy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrisfroe/readdy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrisfroe/readdy/teams","hooks_url":"https://api.github.com/repos/chrisfroe/readdy/hooks","issue_events_url":"https://api.github.com/repos/chrisfroe/readdy/issues/events{/number}","events_url":"https://api.github.com/repos/chrisfroe/readdy/events","assignees_url":"https://api.github.com/repos/chrisfroe/readdy/assignees{/user}","branches_url":"https://api.github.com/repos/chrisfroe/readdy/branches{/branch}","tags_url":"https://api.github.com/repos/chrisfroe/readdy/tags","blobs_url":"https://api.github.com/repos/chrisfroe/readdy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrisfroe/readdy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrisfroe/readdy/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrisfroe/readdy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrisfroe/readdy/statuses/{sha}","languages_url":"https://api.github.com/repos/chrisfroe/readdy/languages","stargazers_url":"https://api.github.com/repos/chrisfroe/readdy/stargazers","contributors_url":"https://api.github.com/repos/chrisfroe/readdy/contributors","subscribers_url":"https://api.github.com/repos/chrisfroe/readdy/subscribers","subscription_url":"https://api.github.com/repos/chrisfroe/readdy/subscription","commits_url":"https://api.github.com/repos/chrisfroe/readdy/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrisfroe/readdy/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrisfroe/readdy/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrisfroe/readdy/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrisfroe/readdy/contents/{+path}","compare_url":"https://api.github.com/repos/chrisfroe/readdy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrisfroe/readdy/merges","archive_url":"https://api.github.com/repos/chrisfroe/readdy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrisfroe/readdy/downloads","issues_url":"https://api.github.com/repos/chrisfroe/readdy/issues{/number}","pulls_url":"https://api.github.com/repos/chrisfroe/readdy/pulls{/number}","milestones_url":"https://api.github.com/repos/chrisfroe/readdy/milestones{/number}","notifications_url":"https://api.github.com/repos/chrisfroe/readdy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrisfroe/readdy/labels{/name}","releases_url":"https://api.github.com/repos/chrisfroe/readdy/releases{/id}","deployments_url":"https://api.github.com/repos/chrisfroe/readdy/deployments","created_at":"2016-05-30T11:02:47Z","updated_at":"2016-05-30T11:02:49Z","pushed_at":"2018-06-04T14:18:32Z","git_url":"git://github.com/chrisfroe/readdy.git","ssh_url":"git@github.com:chrisfroe/readdy.git","clone_url":"https://github.com/chrisfroe/readdy.git","svn_url":"https://github.com/chrisfroe/readdy","homepage":null,"size":5195,"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":"readdy:master","ref":"master","sha":"e445d952acf01148d062d494c1d7bdda21169a56","user":{"login":"readdy","id":6631730,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2MzE3MzA=","avatar_url":"https://avatars0.githubusercontent.com/u/6631730?v=4","gravatar_id":"","url":"https://api.github.com/users/readdy","html_url":"https://github.com/readdy","followers_url":"https://api.github.com/users/readdy/followers","following_url":"https://api.github.com/users/readdy/following{/other_user}","gists_url":"https://api.github.com/users/readdy/gists{/gist_id}","starred_url":"https://api.github.com/users/readdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readdy/subscriptions","organizations_url":"https://api.github.com/users/readdy/orgs","repos_url":"https://api.github.com/users/readdy/repos","events_url":"https://api.github.com/users/readdy/events{/privacy}","received_events_url":"https://api.github.com/users/readdy/received_events","type":"Organization","site_admin":false},"repo":{"id":59560469,"node_id":"MDEwOlJlcG9zaXRvcnk1OTU2MDQ2OQ==","name":"readdy","full_name":"readdy/readdy","owner":{"login":"readdy","id":6631730,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2MzE3MzA=","avatar_url":"https://avatars0.githubusercontent.com/u/6631730?v=4","gravatar_id":"","url":"https://api.github.com/users/readdy","html_url":"https://github.com/readdy","followers_url":"https://api.github.com/users/readdy/followers","following_url":"https://api.github.com/users/readdy/following{/other_user}","gists_url":"https://api.github.com/users/readdy/gists{/gist_id}","starred_url":"https://api.github.com/users/readdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/readdy/subscriptions","organizations_url":"https://api.github.com/users/readdy/orgs","repos_url":"https://api.github.com/users/readdy/repos","events_url":"https://api.github.com/users/readdy/events{/privacy}","received_events_url":"https://api.github.com/users/readdy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/readdy/readdy","description":"Python / C++ based particle reaction-diffusion simulator","fork":false,"url":"https://api.github.com/repos/readdy/readdy","forks_url":"https://api.github.com/repos/readdy/readdy/forks","keys_url":"https://api.github.com/repos/readdy/readdy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/readdy/readdy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/readdy/readdy/teams","hooks_url":"https://api.github.com/repos/readdy/readdy/hooks","issue_events_url":"https://api.github.com/repos/readdy/readdy/issues/events{/number}","events_url":"https://api.github.com/repos/readdy/readdy/events","assignees_url":"https://api.github.com/repos/readdy/readdy/assignees{/user}","branches_url":"https://api.github.com/repos/readdy/readdy/branches{/branch}","tags_url":"https://api.github.com/repos/readdy/readdy/tags","blobs_url":"https://api.github.com/repos/readdy/readdy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/readdy/readdy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/readdy/readdy/git/refs{/sha}","trees_url":"https://api.github.com/repos/readdy/readdy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/readdy/readdy/statuses/{sha}","languages_url":"https://api.github.com/repos/readdy/readdy/languages","stargazers_url":"https://api.github.com/repos/readdy/readdy/stargazers","contributors_url":"https://api.github.com/repos/readdy/readdy/contributors","subscribers_url":"https://api.github.com/repos/readdy/readdy/subscribers","subscription_url":"https://api.github.com/repos/readdy/readdy/subscription","commits_url":"https://api.github.com/repos/readdy/readdy/commits{/sha}","git_commits_url":"https://api.github.com/repos/readdy/readdy/git/commits{/sha}","comments_url":"https://api.github.com/repos/readdy/readdy/comments{/number}","issue_comment_url":"https://api.github.com/repos/readdy/readdy/issues/comments{/number}","contents_url":"https://api.github.com/repos/readdy/readdy/contents/{+path}","compare_url":"https://api.github.com/repos/readdy/readdy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/readdy/readdy/merges","archive_url":"https://api.github.com/repos/readdy/readdy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/readdy/readdy/downloads","issues_url":"https://api.github.com/repos/readdy/readdy/issues{/number}","pulls_url":"https://api.github.com/repos/readdy/readdy/pulls{/number}","milestones_url":"https://api.github.com/repos/readdy/readdy/milestones{/number}","notifications_url":"https://api.github.com/repos/readdy/readdy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/readdy/readdy/labels{/name}","releases_url":"https://api.github.com/repos/readdy/readdy/releases{/id}","deployments_url":"https://api.github.com/repos/readdy/readdy/deployments","created_at":"2016-05-24T09:41:44Z","updated_at":"2018-05-27T09:51:50Z","pushed_at":"2018-06-04T15:04:35Z","git_url":"git://github.com/readdy/readdy.git","ssh_url":"git@github.com:readdy/readdy.git","clone_url":"https://github.com/readdy/readdy.git","svn_url":"https://github.com/readdy/readdy","homepage":null,"size":4882,"stargazers_count":10,"watchers_count":10,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":10,"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":4,"open_issues":10,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/readdy/readdy/pulls/123"},"html":{"href":"https://github.com/readdy/readdy/pull/123"},"issue":{"href":"https://api.github.com/repos/readdy/readdy/issues/123"},"comments":{"href":"https://api.github.com/repos/readdy/readdy/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/readdy/readdy/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/readdy/readdy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/readdy/readdy/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/readdy/readdy/statuses/854cb9024e02f3c9c0cfe80898caef4085c660e5"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"clonker"}}