{"action":"created","comment":{"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/comments/52840668","id":52840668,"diff_hunk":"@@ -1064,6 +1068,57 @@ def write_next_timestep(self, ts=None, **kwargs):\n         self._check_pdb_coordinates()\n         self._write_timestep(ts, **kwargs)\n \n+    @staticmethod\n+    def _deduce_PDB_atom_name(atom):\n+        \"\"\"Deduce how the atom name should be aligned.\n+\n+        Atom name format can be deduced from the atom type, yet atom type is\n+        not always available. This function uses the atom name and residue name\n+        to deduce how the atom name should be formatted. The rules in use got\n+        inferred from an analysis of the PDB. See gist at\n+        <https://gist.github.com/jbarnoud/37a524330f29b5b7b096> for more\n+        details.\n+        \"\"\"\n+        ions = ('FE', 'AS', 'ZN', 'MG', 'MN', 'CO', 'BR',\n+                'CU', 'TA', 'MO', 'AL', 'BE', 'SE', 'PT',\n+                'EU', 'NI', 'IR', 'RH', 'AU', 'GD', 'RU')\n+        # Mercurial can be confused for hydrogen gamma. Yet, mercurial is\n+        # rather rare in the PDB. Here are all the residues that contain\n+        # mercurial.\n+        special_hg = ('CMH', 'EMC', 'MBO', 'MMC', 'HGB', 'BE7', 'PMB')\n+        # Chloride can be confused for a carbon. Here are the residues that\n+        # contain chloride.\n+        special_cl = ('0QE', 'CPT', 'DCE', 'EAA', 'IMN', 'OCZ', 'OMY', 'OMZ',\n+                      'UN9', '1N1', '2T8', '393', '3MY', 'BMU', 'CLM', 'CP6',\n+                      'DB8', 'DIF', 'EFZ', 'LUR', 'RDC', 'UCL', 'XMM', 'HLT',\n+                      'IRE', 'LCP', 'PCI', 'VGH')\n+        # In these pairs, the atom name is aligned on the first column\n+        # (column 13).\n+        include_pairs = (Pair('OEC', 'CA1'),\n+                         Pair('PLL', 'PD'),\n+                         Pair('OEX', 'CA1'))\n+        # In these pairs, the atom name is aligned on the second column\n+        # (column 14), but other rules would align them on the first column.\n+        exclude_pairs = (Pair('C14', 'C14'), Pair('C15', 'C15'),\n+                         Pair('F9F', 'F9F'), Pair('OAN', 'OAN'),\n+                         Pair('BLM', 'NI'), Pair('BZG', 'CO'),\n+                         Pair('BZG', 'NI'), Pair('VNL', 'CO1'),\n+                         Pair('VNL', 'CO2'), Pair('PF5', 'FE1'),\n+                         Pair('PF5', 'FE2'), Pair('UNL', 'UNL'))\n+        if len(atom.name) >= 4:\n+            return atom.name[:4]\n+        if len(atom.name) == 1:","path":"package/MDAnalysis/coordinates/PDB.py","position":61,"original_position":61,"commit_id":"6e4b22596d1a069bf30fe0ffc864795dfaf999d6","original_commit_id":"6e4b22596d1a069bf30fe0ffc864795dfaf999d6","user":{"login":"kain88-de","id":4302678,"avatar_url":"https://avatars.githubusercontent.com/u/4302678?v=3","gravatar_id":"","url":"https://api.github.com/users/kain88-de","html_url":"https://github.com/kain88-de","followers_url":"https://api.github.com/users/kain88-de/followers","following_url":"https://api.github.com/users/kain88-de/following{/other_user}","gists_url":"https://api.github.com/users/kain88-de/gists{/gist_id}","starred_url":"https://api.github.com/users/kain88-de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kain88-de/subscriptions","organizations_url":"https://api.github.com/users/kain88-de/orgs","repos_url":"https://api.github.com/users/kain88-de/repos","events_url":"https://api.github.com/users/kain88-de/events{/privacy}","received_events_url":"https://api.github.com/users/kain88-de/received_events","type":"User","site_admin":false},"body":"I know you return in each if but for style I would prefer a `elif` here. Since you can only ever go down one of the if branches.","created_at":"2016-02-14T10:31:36Z","updated_at":"2016-02-14T10:31:36Z","html_url":"https://github.com/MDAnalysis/mdanalysis/pull/722#discussion_r52840668","pull_request_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722","_links":{"self":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/comments/52840668"},"html":{"href":"https://github.com/MDAnalysis/mdanalysis/pull/722#discussion_r52840668"},"pull_request":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722"}}},"pull_request":{"url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722","id":59283996,"html_url":"https://github.com/MDAnalysis/mdanalysis/pull/722","diff_url":"https://github.com/MDAnalysis/mdanalysis/pull/722.diff","patch_url":"https://github.com/MDAnalysis/mdanalysis/pull/722.patch","issue_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/722","number":722,"state":"open","locked":false,"title":"Fix atom name formatting in PrimitivePDBWriter","user":{"login":"jbarnoud","id":1382074,"avatar_url":"https://avatars.githubusercontent.com/u/1382074?v=3","gravatar_id":"","url":"https://api.github.com/users/jbarnoud","html_url":"https://github.com/jbarnoud","followers_url":"https://api.github.com/users/jbarnoud/followers","following_url":"https://api.github.com/users/jbarnoud/following{/other_user}","gists_url":"https://api.github.com/users/jbarnoud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarnoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarnoud/subscriptions","organizations_url":"https://api.github.com/users/jbarnoud/orgs","repos_url":"https://api.github.com/users/jbarnoud/repos","events_url":"https://api.github.com/users/jbarnoud/events{/privacy}","received_events_url":"https://api.github.com/users/jbarnoud/received_events","type":"User","site_admin":false},"body":"Fixes #647","created_at":"2016-02-14T01:48:44Z","updated_at":"2016-02-14T10:31:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1a1fee090eeae4901342b68321a3b96e70d3f67","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722/commits","review_comments_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722/comments","review_comment_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/722/comments","statuses_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/statuses/6e4b22596d1a069bf30fe0ffc864795dfaf999d6","head":{"label":"jbarnoud:issue-647-pdb-atom-name","ref":"issue-647-pdb-atom-name","sha":"6e4b22596d1a069bf30fe0ffc864795dfaf999d6","user":{"login":"jbarnoud","id":1382074,"avatar_url":"https://avatars.githubusercontent.com/u/1382074?v=3","gravatar_id":"","url":"https://api.github.com/users/jbarnoud","html_url":"https://github.com/jbarnoud","followers_url":"https://api.github.com/users/jbarnoud/followers","following_url":"https://api.github.com/users/jbarnoud/following{/other_user}","gists_url":"https://api.github.com/users/jbarnoud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarnoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarnoud/subscriptions","organizations_url":"https://api.github.com/users/jbarnoud/orgs","repos_url":"https://api.github.com/users/jbarnoud/repos","events_url":"https://api.github.com/users/jbarnoud/events{/privacy}","received_events_url":"https://api.github.com/users/jbarnoud/received_events","type":"User","site_admin":false},"repo":{"id":43294106,"name":"mdanalysis","full_name":"jbarnoud/mdanalysis","owner":{"login":"jbarnoud","id":1382074,"avatar_url":"https://avatars.githubusercontent.com/u/1382074?v=3","gravatar_id":"","url":"https://api.github.com/users/jbarnoud","html_url":"https://github.com/jbarnoud","followers_url":"https://api.github.com/users/jbarnoud/followers","following_url":"https://api.github.com/users/jbarnoud/following{/other_user}","gists_url":"https://api.github.com/users/jbarnoud/gists{/gist_id}","starred_url":"https://api.github.com/users/jbarnoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbarnoud/subscriptions","organizations_url":"https://api.github.com/users/jbarnoud/orgs","repos_url":"https://api.github.com/users/jbarnoud/repos","events_url":"https://api.github.com/users/jbarnoud/events{/privacy}","received_events_url":"https://api.github.com/users/jbarnoud/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbarnoud/mdanalysis","description":"MDAnalysis is a Python library to analyze molecular dynamics trajectories.","fork":true,"url":"https://api.github.com/repos/jbarnoud/mdanalysis","forks_url":"https://api.github.com/repos/jbarnoud/mdanalysis/forks","keys_url":"https://api.github.com/repos/jbarnoud/mdanalysis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbarnoud/mdanalysis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbarnoud/mdanalysis/teams","hooks_url":"https://api.github.com/repos/jbarnoud/mdanalysis/hooks","issue_events_url":"https://api.github.com/repos/jbarnoud/mdanalysis/issues/events{/number}","events_url":"https://api.github.com/repos/jbarnoud/mdanalysis/events","assignees_url":"https://api.github.com/repos/jbarnoud/mdanalysis/assignees{/user}","branches_url":"https://api.github.com/repos/jbarnoud/mdanalysis/branches{/branch}","tags_url":"https://api.github.com/repos/jbarnoud/mdanalysis/tags","blobs_url":"https://api.github.com/repos/jbarnoud/mdanalysis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbarnoud/mdanalysis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbarnoud/mdanalysis/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbarnoud/mdanalysis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbarnoud/mdanalysis/statuses/{sha}","languages_url":"https://api.github.com/repos/jbarnoud/mdanalysis/languages","stargazers_url":"https://api.github.com/repos/jbarnoud/mdanalysis/stargazers","contributors_url":"https://api.github.com/repos/jbarnoud/mdanalysis/contributors","subscribers_url":"https://api.github.com/repos/jbarnoud/mdanalysis/subscribers","subscription_url":"https://api.github.com/repos/jbarnoud/mdanalysis/subscription","commits_url":"https://api.github.com/repos/jbarnoud/mdanalysis/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbarnoud/mdanalysis/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbarnoud/mdanalysis/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbarnoud/mdanalysis/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbarnoud/mdanalysis/contents/{+path}","compare_url":"https://api.github.com/repos/jbarnoud/mdanalysis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbarnoud/mdanalysis/merges","archive_url":"https://api.github.com/repos/jbarnoud/mdanalysis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbarnoud/mdanalysis/downloads","issues_url":"https://api.github.com/repos/jbarnoud/mdanalysis/issues{/number}","pulls_url":"https://api.github.com/repos/jbarnoud/mdanalysis/pulls{/number}","milestones_url":"https://api.github.com/repos/jbarnoud/mdanalysis/milestones{/number}","notifications_url":"https://api.github.com/repos/jbarnoud/mdanalysis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbarnoud/mdanalysis/labels{/name}","releases_url":"https://api.github.com/repos/jbarnoud/mdanalysis/releases{/id}","deployments_url":"https://api.github.com/repos/jbarnoud/mdanalysis/deployments","created_at":"2015-09-28T10:12:35Z","updated_at":"2016-01-15T18:02:06Z","pushed_at":"2016-02-14T01:47:56Z","git_url":"git://github.com/jbarnoud/mdanalysis.git","ssh_url":"git@github.com:jbarnoud/mdanalysis.git","clone_url":"https://github.com/jbarnoud/mdanalysis.git","svn_url":"https://github.com/jbarnoud/mdanalysis","homepage":"http://www.mdanalysis.org","size":182477,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"MDAnalysis:develop","ref":"develop","sha":"173ff26522717af14c798106a87d5c328416336f","user":{"login":"MDAnalysis","id":11445951,"avatar_url":"https://avatars.githubusercontent.com/u/11445951?v=3","gravatar_id":"","url":"https://api.github.com/users/MDAnalysis","html_url":"https://github.com/MDAnalysis","followers_url":"https://api.github.com/users/MDAnalysis/followers","following_url":"https://api.github.com/users/MDAnalysis/following{/other_user}","gists_url":"https://api.github.com/users/MDAnalysis/gists{/gist_id}","starred_url":"https://api.github.com/users/MDAnalysis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MDAnalysis/subscriptions","organizations_url":"https://api.github.com/users/MDAnalysis/orgs","repos_url":"https://api.github.com/users/MDAnalysis/repos","events_url":"https://api.github.com/users/MDAnalysis/events{/privacy}","received_events_url":"https://api.github.com/users/MDAnalysis/received_events","type":"Organization","site_admin":false},"repo":{"id":33389183,"name":"mdanalysis","full_name":"MDAnalysis/mdanalysis","owner":{"login":"MDAnalysis","id":11445951,"avatar_url":"https://avatars.githubusercontent.com/u/11445951?v=3","gravatar_id":"","url":"https://api.github.com/users/MDAnalysis","html_url":"https://github.com/MDAnalysis","followers_url":"https://api.github.com/users/MDAnalysis/followers","following_url":"https://api.github.com/users/MDAnalysis/following{/other_user}","gists_url":"https://api.github.com/users/MDAnalysis/gists{/gist_id}","starred_url":"https://api.github.com/users/MDAnalysis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MDAnalysis/subscriptions","organizations_url":"https://api.github.com/users/MDAnalysis/orgs","repos_url":"https://api.github.com/users/MDAnalysis/repos","events_url":"https://api.github.com/users/MDAnalysis/events{/privacy}","received_events_url":"https://api.github.com/users/MDAnalysis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MDAnalysis/mdanalysis","description":"MDAnalysis is a Python library to analyze molecular dynamics trajectories.","fork":false,"url":"https://api.github.com/repos/MDAnalysis/mdanalysis","forks_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/forks","keys_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/teams","hooks_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/hooks","issue_events_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/events{/number}","events_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/events","assignees_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/assignees{/user}","branches_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/branches{/branch}","tags_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/tags","blobs_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/git/refs{/sha}","trees_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/statuses/{sha}","languages_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/languages","stargazers_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/stargazers","contributors_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/contributors","subscribers_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/subscribers","subscription_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/subscription","commits_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/commits{/sha}","git_commits_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/git/commits{/sha}","comments_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/comments{/number}","issue_comment_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/comments{/number}","contents_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/contents/{+path}","compare_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/merges","archive_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/downloads","issues_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues{/number}","pulls_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls{/number}","milestones_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/milestones{/number}","notifications_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/labels{/name}","releases_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/releases{/id}","deployments_url":"https://api.github.com/repos/MDAnalysis/mdanalysis/deployments","created_at":"2015-04-04T00:39:41Z","updated_at":"2016-01-29T11:21:34Z","pushed_at":"2016-02-14T01:48:45Z","git_url":"git://github.com/MDAnalysis/mdanalysis.git","ssh_url":"git@github.com:MDAnalysis/mdanalysis.git","clone_url":"https://github.com/MDAnalysis/mdanalysis.git","svn_url":"https://github.com/MDAnalysis/mdanalysis","homepage":"http://www.mdanalysis.org","size":251223,"stargazers_count":53,"watchers_count":53,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":33,"mirror_url":null,"open_issues_count":81,"forks":33,"open_issues":81,"watchers":53,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722"},"html":{"href":"https://github.com/MDAnalysis/mdanalysis/pull/722"},"issue":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/722"},"comments":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/issues/722/comments"},"review_comments":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722/comments"},"review_comment":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/pulls/722/commits"},"statuses":{"href":"https://api.github.com/repos/MDAnalysis/mdanalysis/statuses/6e4b22596d1a069bf30fe0ffc864795dfaf999d6"}}}}