{"action":"created","issue":{"url":"https://api.github.com/repos/ParmEd/ParmEd/issues/791","repository_url":"https://api.github.com/repos/ParmEd/ParmEd","labels_url":"https://api.github.com/repos/ParmEd/ParmEd/issues/791/labels{/name}","comments_url":"https://api.github.com/repos/ParmEd/ParmEd/issues/791/comments","events_url":"https://api.github.com/repos/ParmEd/ParmEd/issues/791/events","html_url":"https://github.com/ParmEd/ParmEd/issues/791","id":194156264,"number":791,"title":"Incorrect charge on an atom after reading to and writing from GROMACS format","user":{"login":"davidlmobley","id":7132257,"avatar_url":"https://avatars.githubusercontent.com/u/7132257?v=3","gravatar_id":"","url":"https://api.github.com/users/davidlmobley","html_url":"https://github.com/davidlmobley","followers_url":"https://api.github.com/users/davidlmobley/followers","following_url":"https://api.github.com/users/davidlmobley/following{/other_user}","gists_url":"https://api.github.com/users/davidlmobley/gists{/gist_id}","starred_url":"https://api.github.com/users/davidlmobley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidlmobley/subscriptions","organizations_url":"https://api.github.com/users/davidlmobley/orgs","repos_url":"https://api.github.com/users/davidlmobley/repos","events_url":"https://api.github.com/users/davidlmobley/events{/privacy}","received_events_url":"https://api.github.com/users/davidlmobley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-07T20:12:19Z","updated_at":"2016-12-08T00:27:49Z","closed_at":null,"body":"I've found a bug of some sort where an atom in a residue ends up with an incorrect charge after writing to GROMACS format (or it has its charge swapped with another symmetry-equivalent atom, or atoms are re-named and re-ordered).\r\n\r\nInputs and outputs are attached, and to reproduce it, please use this:\r\n```python\r\n#!/bin/env python\r\n\r\nimport parmed\r\nfrom simtk.openmm.app import PDBFile\r\nimport simtk.openmm.app as app\r\n\r\n# Load PDB\r\npdbfile = PDBFile('cyclohexane_ethanol_0.4_0.6.pdb')\r\n\r\n# Load AMBER system\r\nparm = parmed.load_file('out.prmtop', 'out.crd')\r\nambersys = parm.createSystem(nonbondedMethod= app.NoCutoff, constraints = None, implicitSolvent = None)\r\nprint(parm.atoms[126].charge, parm.atoms[126].name)\r\n\r\n\r\n# Save to GROMACS\r\nstructure = parmed.openmm.topsystem.load_topology( pdbfile.topology, ambersys, pdbfile.positions )\r\n# Same behavior with this:\r\n#structure = parmed.openmm.topsystem.load_topology( parm.topology, ambersys, parm.positions )\r\nprint(structure.atoms[126].charge, structure.atoms[126].name)\r\nstructure.save( 'bug.top', overwrite = True, format=\"gromacs\")\r\nstructure.save( 'bug.gro', overwrite = True, format = \"gro\")\r\n\r\n# Load GROMACS system\r\ntop = parmed.load_file('bug.top')\r\nprint(top.atoms[126].charge, top.atoms[126].name)\r\n```\r\n\r\nOutput is:\r\n```\r\n(-0.07549999670733112, 'C1')\r\n(-0.07549999670733112, 'C1')\r\n(-0.0761, 'C1')\r\n```\r\n\r\nAs you can see, `C1` in residue `ZBE` (which happens to be cyclohexane) has a charge magnitude slightly less than 0.076 before GROMACS format is involved, and slightly over 0.076 after GROMACS format is involved. This isn't rounding -- the carbon atoms in cyclohexane all have charges of -0.0755 except this one, which is (for some reason) -0.0761. In AMBER, this charge appears to end up on atom 128; after a round-trip from GROMACS, it ends up on atom 126.\r\n\r\n@swails , any insights? In my test, this is making it so energies are not identical after conversion to GROMACS format.\r\n\r\n[Archive.zip](https://github.com/ParmEd/ParmEd/files/637654/Archive.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/ParmEd/ParmEd/issues/comments/265617176","html_url":"https://github.com/ParmEd/ParmEd/issues/791#issuecomment-265617176","issue_url":"https://api.github.com/repos/ParmEd/ParmEd/issues/791","id":265617176,"user":{"login":"davidlmobley","id":7132257,"avatar_url":"https://avatars.githubusercontent.com/u/7132257?v=3","gravatar_id":"","url":"https://api.github.com/users/davidlmobley","html_url":"https://github.com/davidlmobley","followers_url":"https://api.github.com/users/davidlmobley/followers","following_url":"https://api.github.com/users/davidlmobley/following{/other_user}","gists_url":"https://api.github.com/users/davidlmobley/gists{/gist_id}","starred_url":"https://api.github.com/users/davidlmobley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidlmobley/subscriptions","organizations_url":"https://api.github.com/users/davidlmobley/orgs","repos_url":"https://api.github.com/users/davidlmobley/repos","events_url":"https://api.github.com/users/davidlmobley/events{/privacy}","received_events_url":"https://api.github.com/users/davidlmobley/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T00:27:49Z","updated_at":"2016-12-08T00:27:49Z","body":"(In fact, I think somehow the problem is an issue with the `prmtop` produced as there shouldn't be anything here which has \"mixed 1-4 scaling\")"}}
{"actor":{"display_login":"davidlmobley"}}