{"action":"closed","issue":{"url":"https://api.github.com/repos/libAtoms/pymatnest/issues/1","repository_url":"https://api.github.com/repos/libAtoms/pymatnest","labels_url":"https://api.github.com/repos/libAtoms/pymatnest/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/libAtoms/pymatnest/issues/1/comments","events_url":"https://api.github.com/repos/libAtoms/pymatnest/issues/1/events","html_url":"https://github.com/libAtoms/pymatnest/issues/1","id":155981351,"number":1,"title":"Possible bug in example_LJ_model.F90","user":{"login":"erlendd","id":6125396,"avatar_url":"https://avatars.githubusercontent.com/u/6125396?v=3","gravatar_id":"","url":"https://api.github.com/users/erlendd","html_url":"https://github.com/erlendd","followers_url":"https://api.github.com/users/erlendd/followers","following_url":"https://api.github.com/users/erlendd/following{/other_user}","gists_url":"https://api.github.com/users/erlendd/gists{/gist_id}","starred_url":"https://api.github.com/users/erlendd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erlendd/subscriptions","organizations_url":"https://api.github.com/users/erlendd/orgs","repos_url":"https://api.github.com/users/erlendd/repos","events_url":"https://api.github.com/users/erlendd/events{/privacy}","received_events_url":"https://api.github.com/users/erlendd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-05-20T14:53:24Z","updated_at":"2016-12-16T18:18:19Z","closed_at":"2016-12-16T18:18:19Z","body":"I think there's a bug in the pymatnest fortran example model: example_LJ_model.f90. \n\nIn ll_eval_energy there is a term:\n`\nif (i==j) E_term = E_term * 0.5\n`\nIt looks like this is to prevent double-counting, however I think the double-counting actually happens then the indices i and j are different (not the same, as would be implied by the if(i==j) line above).\n\nFor example if I've got two atoms then the i and j loops give me:\ni=0, j=0\ni=0, j=1\ni=1, j=0\ni=1, j=1\n\nAs far as I can see the only potential for a double-count of the energy in the i == j cases is when the 0th images are considered (i.e. dj1, dj2, dj3 all equal 0) and that is correctly prevented by the line:\n`\nif (i == j .and. dj1 == 0 .and. dj2 == 0 .and. dj3 == 0) cycle\n`\nThe double-counting actually happens for the two cases (i=0, j=1) and (i=1, j=0) when the 0th image of each is being computed.\n\nI.e. in the two-atom case given above there is a double-count between:\n i=0, j=1 and dj1 = dj2 = dj3 = 0\nand\n i=1, j=0 and dj1 = dj2 = dj3 = 0\n\nApologies if there's a mistake in my logic here.\n"}}
{"actor":{"display_login":"erlendd"}}