{"action":"created","issue":{"url":"https://api.github.com/repos/lammps/lammps/issues/1158","repository_url":"https://api.github.com/repos/lammps/lammps","labels_url":"https://api.github.com/repos/lammps/lammps/issues/1158/labels{/name}","comments_url":"https://api.github.com/repos/lammps/lammps/issues/1158/comments","events_url":"https://api.github.com/repos/lammps/lammps/issues/1158/events","html_url":"https://github.com/lammps/lammps/issues/1158","id":369388714,"node_id":"MDU6SXNzdWUzNjkzODg3MTQ=","number":1158,"title":"'create_atoms remap yes' can't handle atoms on/near the unit cell corner","user":{"login":"ExpHP","id":1411280,"node_id":"MDQ6VXNlcjE0MTEyODA=","avatar_url":"https://avatars0.githubusercontent.com/u/1411280?v=4","gravatar_id":"","url":"https://api.github.com/users/ExpHP","html_url":"https://github.com/ExpHP","followers_url":"https://api.github.com/users/ExpHP/followers","following_url":"https://api.github.com/users/ExpHP/following{/other_user}","gists_url":"https://api.github.com/users/ExpHP/gists{/gist_id}","starred_url":"https://api.github.com/users/ExpHP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExpHP/subscriptions","organizations_url":"https://api.github.com/users/ExpHP/orgs","repos_url":"https://api.github.com/users/ExpHP/repos","events_url":"https://api.github.com/users/ExpHP/events{/privacy}","received_events_url":"https://api.github.com/users/ExpHP/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"athomps","id":10839840,"node_id":"MDQ6VXNlcjEwODM5ODQw","avatar_url":"https://avatars0.githubusercontent.com/u/10839840?v=4","gravatar_id":"","url":"https://api.github.com/users/athomps","html_url":"https://github.com/athomps","followers_url":"https://api.github.com/users/athomps/followers","following_url":"https://api.github.com/users/athomps/following{/other_user}","gists_url":"https://api.github.com/users/athomps/gists{/gist_id}","starred_url":"https://api.github.com/users/athomps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/athomps/subscriptions","organizations_url":"https://api.github.com/users/athomps/orgs","repos_url":"https://api.github.com/users/athomps/repos","events_url":"https://api.github.com/users/athomps/events{/privacy}","received_events_url":"https://api.github.com/users/athomps/received_events","type":"User","site_admin":false},"assignees":[{"login":"athomps","id":10839840,"node_id":"MDQ6VXNlcjEwODM5ODQw","avatar_url":"https://avatars0.githubusercontent.com/u/10839840?v=4","gravatar_id":"","url":"https://api.github.com/users/athomps","html_url":"https://github.com/athomps","followers_url":"https://api.github.com/users/athomps/followers","following_url":"https://api.github.com/users/athomps/following{/other_user}","gists_url":"https://api.github.com/users/athomps/gists{/gist_id}","starred_url":"https://api.github.com/users/athomps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/athomps/subscriptions","organizations_url":"https://api.github.com/users/athomps/orgs","repos_url":"https://api.github.com/users/athomps/repos","events_url":"https://api.github.com/users/athomps/events{/privacy}","received_events_url":"https://api.github.com/users/athomps/received_events","type":"User","site_admin":false},{"login":"sjplimp","id":21087682,"node_id":"MDQ6VXNlcjIxMDg3Njgy","avatar_url":"https://avatars1.githubusercontent.com/u/21087682?v=4","gravatar_id":"","url":"https://api.github.com/users/sjplimp","html_url":"https://github.com/sjplimp","followers_url":"https://api.github.com/users/sjplimp/followers","following_url":"https://api.github.com/users/sjplimp/following{/other_user}","gists_url":"https://api.github.com/users/sjplimp/gists{/gist_id}","starred_url":"https://api.github.com/users/sjplimp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjplimp/subscriptions","organizations_url":"https://api.github.com/users/sjplimp/orgs","repos_url":"https://api.github.com/users/sjplimp/repos","events_url":"https://api.github.com/users/sjplimp/events{/privacy}","received_events_url":"https://api.github.com/users/sjplimp/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2018-10-12T03:48:12Z","updated_at":"2018-10-18T17:19:32Z","closed_at":null,"author_association":"NONE","body":"## Bug report\r\n\r\nVery specific inputs to `create_atoms` will cause it to skip an atom even when `remap yes` is specified.\r\n\r\n## Steps to Reproduce\r\n\r\n**Run the following script and observe the output.**\r\n```\r\nprocessors * * 1\r\nunits metal\r\nneigh_modify delay 0\r\natom_style atomic\r\nthermo_modify lost error\r\natom_modify map array\r\natom_modify sort 0 0.0\r\nboundary p p p\r\nbox tilt small\r\nregion sim prism 0 2 0 2 0 2 0 0 0\r\ncreate_box 2 sim\r\nmass 1 12.0107\r\nmass 2 12.0107\r\npair_style none\r\nchange_box all x final 0 92.76975077446671 y final 0 80.34096087343929 z final 0 14\r\nchange_box all xy final -46.38487538723336 xz final 0 yz final 0\r\n\r\n# Try to create atoms at -46.384875387233315 80.34096087343922\r\n# and all 8 points around it with a grid spacing of 0.1\r\n\r\ncreate_atoms 1 single -46.484875387233315 80.24096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.384875387233315 80.24096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.284875387233315 80.24096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.484875387233315 80.34096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.384875387233315 80.34096087343922 7 remap yes  # Created 0 atoms (!!!)\r\ncreate_atoms 1 single -46.284875387233315 80.34096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.484875387233315 80.44096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.384875387233315 80.44096087343922 7 remap yes  # Created 1 atoms\r\ncreate_atoms 1 single -46.284875387233315 80.44096087343922 7 remap yes  # Created 1 atoms\r\n```\r\n\r\n#### Actual behavior\r\n\r\nThe script attempts to produce an atom at `(-46.384875387233315, 80.34096087343922)` as well as 8 points around it.  As indicated from the program output in the comments, the eight surrounding points are created, but **the centermost is _not._**\r\n\r\nNotably, this atom is practically sitting on the cell corner at (0, 1) in fractional space.\r\n\r\n#### Expected behavior\r\n\r\nSince all eight positions around it can be created, I would expect that the centermost one can be created as well.\r\n\r\n## Digging deeper/Additional tidbits\r\n\r\nI tried searching the closest nearby representable floating point numbers.  There are indeed other points *very close* to this point that `remap yes` similarly fails on.\r\n\r\n<details>\r\n<summary>Figure of nearby points that can't be created</summary>\r\n\r\n**Legend**\r\n* **Purple pixels:** `create_atoms remap yes` cannot produce an atom here\r\n* **Yellow pixels:** `create_atoms remap yes` successfully created an atom here\r\n\r\nUnits are ULPs (nearest representable floats) and therefore not necessarily constant.\r\n\r\n![bad_points](https://user-images.githubusercontent.com/1411280/46845827-22198680-cdab-11e8-87e6-8d11283a322b.png)\r\n\r\n</details>\r\n\r\n<details>\r\n<summary>Fractional coords of those bad points in the image</summary>\r\n\r\nThis is what I see when I multiply the bad coords by the inverse of the lattice matrix **(not necessarily the same as the values seen by lammps during the remap process!).**  You may notice that there is a variety of values for `a2` coordinate, but not so many for the `a1` coordinate.\r\n\r\n```\r\n              a1                          a2\r\n                       0.0         0.9999999999999946\r\n     5.551115123125783e-17         0.9999999999999948\r\n                       0.0         0.9999999999999949\r\n    1.1102230246251565e-16         0.9999999999999949\r\n    1.6653345369377348e-16         0.9999999999999949\r\n                       0.0         0.9999999999999951\r\n     5.551115123125783e-17         0.9999999999999951\r\n    1.1102230246251565e-16         0.9999999999999953\r\n                       0.0         0.9999999999999954\r\n     5.551115123125783e-17         0.9999999999999954\r\n     5.551115123125783e-17         0.9999999999999957\r\n                       0.0         0.9999999999999958\r\n     5.551115123125783e-17          0.999999999999996\r\n                       0.0         0.9999999999999963\r\n     5.551115123125783e-17         0.9999999999999963\r\n    1.1102230246251565e-16         0.9999999999999966\r\n                       0.0         0.9999999999999967\r\n     5.551115123125783e-17         0.9999999999999967\r\n     5.551115123125783e-17         0.9999999999999969\r\n     5.551115123125783e-17         0.9999999999999972\r\n   -1.6653345369377348e-16         0.9999999999999974\r\n    -5.551115123125783e-17         0.9999999999999974\r\n                       0.0         0.9999999999999974\r\n                       0.0         0.9999999999999976\r\n     5.551115123125783e-17         0.9999999999999976\r\n                       0.0         0.9999999999999978\r\n    1.1102230246251565e-16         0.9999999999999978\r\n    1.6653345369377348e-16         0.9999999999999978\r\n                       0.0         0.9999999999999979\r\n     5.551115123125783e-17         0.9999999999999979\r\n                       0.0         0.9999999999999981\r\n    1.1102230246251565e-16         0.9999999999999981\r\n    1.6653345369377348e-16         0.9999999999999981\r\n     5.551115123125783e-17         0.9999999999999984\r\n                       0.0         0.9999999999999987\r\n     5.551115123125783e-17         0.9999999999999987\r\n                       0.0         0.9999999999999988\r\n     5.551115123125783e-17         0.9999999999999988\r\n                       0.0          0.999999999999999\r\n     5.551115123125783e-17         0.9999999999999992\r\n    1.1102230246251565e-16         0.9999999999999992\r\n                       0.0         0.9999999999999993\r\n    1.1102230246251565e-16         0.9999999999999993\r\n    1.6653345369377348e-16         0.9999999999999993\r\n                       0.0         0.9999999999999996\r\n     5.551115123125783e-17         0.9999999999999996\r\n     5.551115123125783e-17         0.9999999999999997\r\n                       0.0         0.9999999999999999\r\n     5.551115123125783e-17         0.9999999999999999\r\n    1.1102230246251565e-16         1.0000000000000002\r\n   -1.1102230246251565e-16         1.0000000000000004\r\n                       0.0         1.0000000000000004\r\n                       0.0         1.0000000000000004\r\n    1.1102230246251565e-16         1.0000000000000004\r\n                       0.0         1.0000000000000009\r\n                       0.0         1.0000000000000009\r\n    1.1102230246251565e-16          1.000000000000001\r\n    1.1102230246251565e-16          1.000000000000001\r\n   -1.1102230246251565e-16         1.0000000000000013\r\n                       0.0         1.0000000000000013\r\n                       0.0         1.0000000000000013\r\n                       0.0         1.0000000000000018\r\n    1.1102230246251565e-16          1.000000000000002\r\n    1.1102230246251565e-16         1.0000000000000022\r\n    1.1102230246251565e-16         1.0000000000000022\r\n    1.1102230246251565e-16         1.0000000000000024\r\n                       0.0         1.0000000000000024\r\n                       0.0         1.0000000000000024\r\n   -1.1102230246251565e-16         1.0000000000000029\r\n                       0.0         1.0000000000000029\r\n                       0.0         1.0000000000000029\r\n    1.1102230246251565e-16         1.0000000000000029\r\n    1.1102230246251565e-16         1.0000000000000033\r\n                       0.0         1.0000000000000033\r\n                       0.0         1.0000000000000033\r\n                       0.0         1.0000000000000036\r\n                       0.0         1.0000000000000038\r\n    1.1102230246251565e-16          1.000000000000004\r\n```\r\n\r\nThe actual range of `a1` on the image goes from `-5e-15` to `5e-15` (much greater than the few values seen here!) while `a2` goes from `0.9999999999999939` to `1.0000000000000044`.\r\n\r\nFor this reason, I suspect that the issue lies specifically in the value of `a1` witnessed by lammps during the remap process. Perhaps it is something troublesome like `-1e-17`? (negative values smaller than epsilon are a pretty big troublemaker for code that tries to map numbers into `[0, 1)`)\r\n</details>\r\n\r\n---\r\n\r\n## LAMMPS Version\r\n\r\nTested on latest master. 7faa48b4c38da81f47a541eaa163f8c74e6f3b6a (Oct 10 2018)"},"comment":{"url":"https://api.github.com/repos/lammps/lammps/issues/comments/431091851","html_url":"https://github.com/lammps/lammps/issues/1158#issuecomment-431091851","issue_url":"https://api.github.com/repos/lammps/lammps/issues/1158","id":431091851,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTA5MTg1MQ==","user":{"login":"sjplimp","id":21087682,"node_id":"MDQ6VXNlcjIxMDg3Njgy","avatar_url":"https://avatars1.githubusercontent.com/u/21087682?v=4","gravatar_id":"","url":"https://api.github.com/users/sjplimp","html_url":"https://github.com/sjplimp","followers_url":"https://api.github.com/users/sjplimp/followers","following_url":"https://api.github.com/users/sjplimp/following{/other_user}","gists_url":"https://api.github.com/users/sjplimp/gists{/gist_id}","starred_url":"https://api.github.com/users/sjplimp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjplimp/subscriptions","organizations_url":"https://api.github.com/users/sjplimp/orgs","repos_url":"https://api.github.com/users/sjplimp/repos","events_url":"https://api.github.com/users/sjplimp/events{/privacy}","received_events_url":"https://api.github.com/users/sjplimp/received_events","type":"User","site_admin":false},"created_at":"2018-10-18T17:19:32Z","updated_at":"2018-10-18T17:19:32Z","author_association":"CONTRIBUTOR","body":"Should have added this also is only an issue when the create atoms remap option is set."}}
{"actor":{"display_login":"sjplimp"}}