{"action":"created","comment":{"url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/comments/173965418","pull_request_review_id":103239225,"id":173965418,"diff_hunk":"@@ -161,23 +165,37 @@ def write_lammpsdata(structure, filename):\n \n         # Atom data\n         data.write('\\nAtoms\\n\\n')\n-        for i,coords in enumerate(xyz):\n-            data.write('{:d}\\t{:d}\\t{:d}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\n'.format(i+1,0,unique_types.index(types[i])+1,charges[i],*coords))\n-\n-        # Bond data\n-        if bonds:\n-            data.write('\\nBonds\\n\\n')\n-            for i,bond in enumerate(bonds):\n-                data.write('{:d}\\t{:d}\\t{:d}\\t{:d}\\n'.format(i+1,bond_types[i],bond[0],bond[1]))\n-\n-        # Angle data\n-        if angles:\n-            data.write('\\nAngles\\n\\n')\n-            for i,angle in enumerate(angles):\n-                data.write('{:d}\\t{:d}\\t{:d}\\t{:d}\\t{:d}\\n'.format(i+1,angle_types[i],angle[0],angle[1],angle[2]))\n-\n-        # Dihedral data\n-        if dihedrals:\n-            data.write('\\nDihedrals\\n\\n')\n-            for i,dihedral in enumerate(dihedrals):\n-                data.write('{:d}\\t{:d}\\t{:d}\\t{:d}\\t{:d}\\t{:d}\\n'.format(i+1,dihedral_types[i],dihedral[0],dihedral[1],dihedral[2],dihedral[3]))\n+        if atom_style == 'atomic':\n+            for i,coords in enumerate(xyz):\n+                data.write('{:d}\\t{:d}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\n'.format(i+1,unique_types.index(types[i])+1,*coords))\n+\n+        elif atom_style == 'charge':\n+            for i,coords in enumerate(xyz):\n+                data.write('{:d}\\t{:d}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\n'.format(i+1,unique_types.index(types[i])+1,charges[i],*coords))\n+\n+        elif atom_style == 'molecular':\n+            for i,coords in enumerate(xyz):\n+                data.write('{:d}\\t{:d}\\t{:d}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\n'.format(i+1,0,unique_types.index(types[i])+1,*coords))\n+\n+        elif atom_style == 'full':\n+            for i,coords in enumerate(xyz):\n+                data.write('{:d}\\t{:d}\\t{:d}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\t{:.6f}\\n'.format(i+1,0,unique_types.index(types[i])+1,charges[i],*coords))","path":"mbuild/formats/lammpsdata.py","position":85,"original_position":85,"commit_id":"5e010865cdda8251b421d68761e7c8ddbf170e74","original_commit_id":"5e010865cdda8251b421d68761e7c8ddbf170e74","user":{"login":"ctk3b","id":3527431,"avatar_url":"https://avatars0.githubusercontent.com/u/3527431?v=4","gravatar_id":"","url":"https://api.github.com/users/ctk3b","html_url":"https://github.com/ctk3b","followers_url":"https://api.github.com/users/ctk3b/followers","following_url":"https://api.github.com/users/ctk3b/following{/other_user}","gists_url":"https://api.github.com/users/ctk3b/gists{/gist_id}","starred_url":"https://api.github.com/users/ctk3b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctk3b/subscriptions","organizations_url":"https://api.github.com/users/ctk3b/orgs","repos_url":"https://api.github.com/users/ctk3b/repos","events_url":"https://api.github.com/users/ctk3b/events{/privacy}","received_events_url":"https://api.github.com/users/ctk3b/received_events","type":"User","site_admin":false},"body":"Another way to reduce some code duplication here:\r\n```python\r\nif atom_style == 'atomic':\r\n    atom_line = '{index:d}\\t{type_index:d}\\t...{charge:.6f}'\r\nelif ...\r\n...\r\n\r\nfor i, coords in enumerate(xyz):\r\n    data.write(atom_line.format(index=i+1, type_index=unique_types..., charge=...))\r\n```\r\n\r\nWhen using this keyword style you can always over-specify named arguments, just not under-specify.","created_at":"2018-03-12T22:20:21Z","updated_at":"2018-03-12T22:28:06Z","html_url":"https://github.com/mosdef-hub/mbuild/pull/412#discussion_r173965418","pull_request_url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/comments/173965418"},"html":{"href":"https://github.com/mosdef-hub/mbuild/pull/412#discussion_r173965418"},"pull_request":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412"}},"in_reply_to_id":173961865},"pull_request":{"url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412","id":174503932,"html_url":"https://github.com/mosdef-hub/mbuild/pull/412","diff_url":"https://github.com/mosdef-hub/mbuild/pull/412.diff","patch_url":"https://github.com/mosdef-hub/mbuild/pull/412.patch","issue_url":"https://api.github.com/repos/mosdef-hub/mbuild/issues/412","number":412,"state":"open","locked":false,"title":"Lammps datafile","user":{"login":"rmatsum836","id":25011342,"avatar_url":"https://avatars3.githubusercontent.com/u/25011342?v=4","gravatar_id":"","url":"https://api.github.com/users/rmatsum836","html_url":"https://github.com/rmatsum836","followers_url":"https://api.github.com/users/rmatsum836/followers","following_url":"https://api.github.com/users/rmatsum836/following{/other_user}","gists_url":"https://api.github.com/users/rmatsum836/gists{/gist_id}","starred_url":"https://api.github.com/users/rmatsum836/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmatsum836/subscriptions","organizations_url":"https://api.github.com/users/rmatsum836/orgs","repos_url":"https://api.github.com/users/rmatsum836/repos","events_url":"https://api.github.com/users/rmatsum836/events{/privacy}","received_events_url":"https://api.github.com/users/rmatsum836/received_events","type":"User","site_admin":false},"body":"In response to #411:\r\nAn `atom_style` argument was added to the `write_lammpsdata` function.  Functionality has been added to support `atomic`, `charge`, and `molecular` atom styles.  Additionally tests were added in test_lammpsdata.py to check for the correct format of 'Atoms' in Lammps data files.  ","created_at":"2018-03-12T21:46:31Z","updated_at":"2018-03-12T22:28:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f5608d48f580af15ef7cc52e5a5df19b5702358","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412/commits","review_comments_url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412/comments","review_comment_url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mosdef-hub/mbuild/issues/412/comments","statuses_url":"https://api.github.com/repos/mosdef-hub/mbuild/statuses/5e010865cdda8251b421d68761e7c8ddbf170e74","head":{"label":"rmatsum836:lammps-datafile","ref":"lammps-datafile","sha":"5e010865cdda8251b421d68761e7c8ddbf170e74","user":{"login":"rmatsum836","id":25011342,"avatar_url":"https://avatars3.githubusercontent.com/u/25011342?v=4","gravatar_id":"","url":"https://api.github.com/users/rmatsum836","html_url":"https://github.com/rmatsum836","followers_url":"https://api.github.com/users/rmatsum836/followers","following_url":"https://api.github.com/users/rmatsum836/following{/other_user}","gists_url":"https://api.github.com/users/rmatsum836/gists{/gist_id}","starred_url":"https://api.github.com/users/rmatsum836/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmatsum836/subscriptions","organizations_url":"https://api.github.com/users/rmatsum836/orgs","repos_url":"https://api.github.com/users/rmatsum836/repos","events_url":"https://api.github.com/users/rmatsum836/events{/privacy}","received_events_url":"https://api.github.com/users/rmatsum836/received_events","type":"User","site_admin":false},"repo":{"id":94464757,"name":"mbuild","full_name":"rmatsum836/mbuild","owner":{"login":"rmatsum836","id":25011342,"avatar_url":"https://avatars3.githubusercontent.com/u/25011342?v=4","gravatar_id":"","url":"https://api.github.com/users/rmatsum836","html_url":"https://github.com/rmatsum836","followers_url":"https://api.github.com/users/rmatsum836/followers","following_url":"https://api.github.com/users/rmatsum836/following{/other_user}","gists_url":"https://api.github.com/users/rmatsum836/gists{/gist_id}","starred_url":"https://api.github.com/users/rmatsum836/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmatsum836/subscriptions","organizations_url":"https://api.github.com/users/rmatsum836/orgs","repos_url":"https://api.github.com/users/rmatsum836/repos","events_url":"https://api.github.com/users/rmatsum836/events{/privacy}","received_events_url":"https://api.github.com/users/rmatsum836/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rmatsum836/mbuild","description":"A hierarchical, component based molecule builder","fork":true,"url":"https://api.github.com/repos/rmatsum836/mbuild","forks_url":"https://api.github.com/repos/rmatsum836/mbuild/forks","keys_url":"https://api.github.com/repos/rmatsum836/mbuild/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rmatsum836/mbuild/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rmatsum836/mbuild/teams","hooks_url":"https://api.github.com/repos/rmatsum836/mbuild/hooks","issue_events_url":"https://api.github.com/repos/rmatsum836/mbuild/issues/events{/number}","events_url":"https://api.github.com/repos/rmatsum836/mbuild/events","assignees_url":"https://api.github.com/repos/rmatsum836/mbuild/assignees{/user}","branches_url":"https://api.github.com/repos/rmatsum836/mbuild/branches{/branch}","tags_url":"https://api.github.com/repos/rmatsum836/mbuild/tags","blobs_url":"https://api.github.com/repos/rmatsum836/mbuild/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rmatsum836/mbuild/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rmatsum836/mbuild/git/refs{/sha}","trees_url":"https://api.github.com/repos/rmatsum836/mbuild/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rmatsum836/mbuild/statuses/{sha}","languages_url":"https://api.github.com/repos/rmatsum836/mbuild/languages","stargazers_url":"https://api.github.com/repos/rmatsum836/mbuild/stargazers","contributors_url":"https://api.github.com/repos/rmatsum836/mbuild/contributors","subscribers_url":"https://api.github.com/repos/rmatsum836/mbuild/subscribers","subscription_url":"https://api.github.com/repos/rmatsum836/mbuild/subscription","commits_url":"https://api.github.com/repos/rmatsum836/mbuild/commits{/sha}","git_commits_url":"https://api.github.com/repos/rmatsum836/mbuild/git/commits{/sha}","comments_url":"https://api.github.com/repos/rmatsum836/mbuild/comments{/number}","issue_comment_url":"https://api.github.com/repos/rmatsum836/mbuild/issues/comments{/number}","contents_url":"https://api.github.com/repos/rmatsum836/mbuild/contents/{+path}","compare_url":"https://api.github.com/repos/rmatsum836/mbuild/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rmatsum836/mbuild/merges","archive_url":"https://api.github.com/repos/rmatsum836/mbuild/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rmatsum836/mbuild/downloads","issues_url":"https://api.github.com/repos/rmatsum836/mbuild/issues{/number}","pulls_url":"https://api.github.com/repos/rmatsum836/mbuild/pulls{/number}","milestones_url":"https://api.github.com/repos/rmatsum836/mbuild/milestones{/number}","notifications_url":"https://api.github.com/repos/rmatsum836/mbuild/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rmatsum836/mbuild/labels{/name}","releases_url":"https://api.github.com/repos/rmatsum836/mbuild/releases{/id}","deployments_url":"https://api.github.com/repos/rmatsum836/mbuild/deployments","created_at":"2017-06-15T17:50:02Z","updated_at":"2017-06-15T17:50:04Z","pushed_at":"2018-03-12T19:57:18Z","git_url":"git://github.com/rmatsum836/mbuild.git","ssh_url":"git@github.com:rmatsum836/mbuild.git","clone_url":"https://github.com/rmatsum836/mbuild.git","svn_url":"https://github.com/rmatsum836/mbuild","homepage":"http://mosdef-hub.github.io/mbuild/","size":75266,"stargazers_count":0,"watchers_count":0,"language":"Python","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mosdef-hub:master","ref":"master","sha":"3f9929642388ad16c37bf34360ef171d8975d766","user":{"login":"mosdef-hub","id":25673981,"avatar_url":"https://avatars2.githubusercontent.com/u/25673981?v=4","gravatar_id":"","url":"https://api.github.com/users/mosdef-hub","html_url":"https://github.com/mosdef-hub","followers_url":"https://api.github.com/users/mosdef-hub/followers","following_url":"https://api.github.com/users/mosdef-hub/following{/other_user}","gists_url":"https://api.github.com/users/mosdef-hub/gists{/gist_id}","starred_url":"https://api.github.com/users/mosdef-hub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosdef-hub/subscriptions","organizations_url":"https://api.github.com/users/mosdef-hub/orgs","repos_url":"https://api.github.com/users/mosdef-hub/repos","events_url":"https://api.github.com/users/mosdef-hub/events{/privacy}","received_events_url":"https://api.github.com/users/mosdef-hub/received_events","type":"Organization","site_admin":false},"repo":{"id":13804874,"name":"mbuild","full_name":"mosdef-hub/mbuild","owner":{"login":"mosdef-hub","id":25673981,"avatar_url":"https://avatars2.githubusercontent.com/u/25673981?v=4","gravatar_id":"","url":"https://api.github.com/users/mosdef-hub","html_url":"https://github.com/mosdef-hub","followers_url":"https://api.github.com/users/mosdef-hub/followers","following_url":"https://api.github.com/users/mosdef-hub/following{/other_user}","gists_url":"https://api.github.com/users/mosdef-hub/gists{/gist_id}","starred_url":"https://api.github.com/users/mosdef-hub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosdef-hub/subscriptions","organizations_url":"https://api.github.com/users/mosdef-hub/orgs","repos_url":"https://api.github.com/users/mosdef-hub/repos","events_url":"https://api.github.com/users/mosdef-hub/events{/privacy}","received_events_url":"https://api.github.com/users/mosdef-hub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mosdef-hub/mbuild","description":"A hierarchical, component based molecule builder","fork":false,"url":"https://api.github.com/repos/mosdef-hub/mbuild","forks_url":"https://api.github.com/repos/mosdef-hub/mbuild/forks","keys_url":"https://api.github.com/repos/mosdef-hub/mbuild/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mosdef-hub/mbuild/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mosdef-hub/mbuild/teams","hooks_url":"https://api.github.com/repos/mosdef-hub/mbuild/hooks","issue_events_url":"https://api.github.com/repos/mosdef-hub/mbuild/issues/events{/number}","events_url":"https://api.github.com/repos/mosdef-hub/mbuild/events","assignees_url":"https://api.github.com/repos/mosdef-hub/mbuild/assignees{/user}","branches_url":"https://api.github.com/repos/mosdef-hub/mbuild/branches{/branch}","tags_url":"https://api.github.com/repos/mosdef-hub/mbuild/tags","blobs_url":"https://api.github.com/repos/mosdef-hub/mbuild/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mosdef-hub/mbuild/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mosdef-hub/mbuild/git/refs{/sha}","trees_url":"https://api.github.com/repos/mosdef-hub/mbuild/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mosdef-hub/mbuild/statuses/{sha}","languages_url":"https://api.github.com/repos/mosdef-hub/mbuild/languages","stargazers_url":"https://api.github.com/repos/mosdef-hub/mbuild/stargazers","contributors_url":"https://api.github.com/repos/mosdef-hub/mbuild/contributors","subscribers_url":"https://api.github.com/repos/mosdef-hub/mbuild/subscribers","subscription_url":"https://api.github.com/repos/mosdef-hub/mbuild/subscription","commits_url":"https://api.github.com/repos/mosdef-hub/mbuild/commits{/sha}","git_commits_url":"https://api.github.com/repos/mosdef-hub/mbuild/git/commits{/sha}","comments_url":"https://api.github.com/repos/mosdef-hub/mbuild/comments{/number}","issue_comment_url":"https://api.github.com/repos/mosdef-hub/mbuild/issues/comments{/number}","contents_url":"https://api.github.com/repos/mosdef-hub/mbuild/contents/{+path}","compare_url":"https://api.github.com/repos/mosdef-hub/mbuild/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mosdef-hub/mbuild/merges","archive_url":"https://api.github.com/repos/mosdef-hub/mbuild/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mosdef-hub/mbuild/downloads","issues_url":"https://api.github.com/repos/mosdef-hub/mbuild/issues{/number}","pulls_url":"https://api.github.com/repos/mosdef-hub/mbuild/pulls{/number}","milestones_url":"https://api.github.com/repos/mosdef-hub/mbuild/milestones{/number}","notifications_url":"https://api.github.com/repos/mosdef-hub/mbuild/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mosdef-hub/mbuild/labels{/name}","releases_url":"https://api.github.com/repos/mosdef-hub/mbuild/releases{/id}","deployments_url":"https://api.github.com/repos/mosdef-hub/mbuild/deployments","created_at":"2013-10-23T14:24:18Z","updated_at":"2018-01-19T16:59:58Z","pushed_at":"2018-03-12T21:46:32Z","git_url":"git://github.com/mosdef-hub/mbuild.git","ssh_url":"git@github.com:mosdef-hub/mbuild.git","clone_url":"https://github.com/mosdef-hub/mbuild.git","svn_url":"https://github.com/mosdef-hub/mbuild","homepage":"http://mosdef-hub.github.io/mbuild/","size":75410,"stargazers_count":27,"watchers_count":27,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"archived":false,"open_issues_count":44,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":32,"open_issues":44,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412"},"html":{"href":"https://github.com/mosdef-hub/mbuild/pull/412"},"issue":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/issues/412"},"comments":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/issues/412/comments"},"review_comments":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412/comments"},"review_comment":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/pulls/412/commits"},"statuses":{"href":"https://api.github.com/repos/mosdef-hub/mbuild/statuses/5e010865cdda8251b421d68761e7c8ddbf170e74"}},"author_association":"NONE"}}
{"actor":{"display_login":"ctk3b"}}