{"action":"created","issue":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/1503","repository_url":"https://api.github.com/repos/pandegroup/openmm","labels_url":"https://api.github.com/repos/pandegroup/openmm/issues/1503/labels{/name}","comments_url":"https://api.github.com/repos/pandegroup/openmm/issues/1503/comments","events_url":"https://api.github.com/repos/pandegroup/openmm/issues/1503/events","html_url":"https://github.com/pandegroup/openmm/issues/1503","id":157315564,"number":1503,"title":"ForceField can get stuck in an infinite recursion in _findAtomMatches","user":{"login":"jchodera","id":3656088,"avatar_url":"https://avatars.githubusercontent.com/u/3656088?v=3","gravatar_id":"","url":"https://api.github.com/users/jchodera","html_url":"https://github.com/jchodera","followers_url":"https://api.github.com/users/jchodera/followers","following_url":"https://api.github.com/users/jchodera/following{/other_user}","gists_url":"https://api.github.com/users/jchodera/gists{/gist_id}","starred_url":"https://api.github.com/users/jchodera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchodera/subscriptions","organizations_url":"https://api.github.com/users/jchodera/orgs","repos_url":"https://api.github.com/users/jchodera/repos","events_url":"https://api.github.com/users/jchodera/events{/privacy}","received_events_url":"https://api.github.com/users/jchodera/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-28T02:09:08Z","updated_at":"2016-05-28T02:37:34Z","closed_at":null,"body":"I've run into some unexpected behavior with `ForceField` where, for some `Topology` and residue template combinations, it appears that `_findAtomMatches` can get stuck in an infinite recursion or loop.  The attached example demonstrates this (attached with necessary input files in a tarball):\r\n```python\r\nfrom simtk.openmm import app\r\nimport cPickle as pickle\r\n\r\ntopology = pickle.load(open('topology.pkl', 'r'))\r\nforcefield = app.ForceField('tip3p.xml', 'amber99sbildn.xml', 'gaff.xml', 'Imatinib-epik-charged.ffxml')\r\nprint('Creating System...')\r\nsystem = forcefield.createSystem(topology, nonbondedMethod=app.CutoffPeriodic)\r\n```\r\nIt will never terminate, and `ctrl-c` gives the stack trace:\r\n```\r\n^CTraceback (most recent call last):\r\n  File \"forcefield-bug.py\", line 7, in <module>\r\n    system = forcefield.createSystem(topology, nonbondedMethod=app.CutoffPeriodic)\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 769, in createSystem\r\n    [template, matches] = self._getResidueTemplateMatches(res, bondedToAtom)\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 570, in _getResidueTemplateMatches\r\n    matches = _matchResidue(res, t, bondedToAtom)\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1046, in _matchResidue\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, 0):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1070, in _findAtomMatches\r\n    if _findAtomMatches(atoms, template, bondedTo, externalBonds, matches, hasMatch, position+1):\r\n  File \"/Users/choderaj/miniconda/lib/python2.7/site-packages/simtk/openmm/app/forcefield.py\", line 1060, in _findAtomMatches\r\n    atom = template.atoms[i]\r\nKeyboardInterrupt\r\n```\r\n\r\n[forcefield-bug.zip](https://github.com/pandegroup/openmm/files/287527/forcefield-bug.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/comments/222285830","html_url":"https://github.com/pandegroup/openmm/issues/1503#issuecomment-222285830","issue_url":"https://api.github.com/repos/pandegroup/openmm/issues/1503","id":222285830,"user":{"login":"jchodera","id":3656088,"avatar_url":"https://avatars.githubusercontent.com/u/3656088?v=3","gravatar_id":"","url":"https://api.github.com/users/jchodera","html_url":"https://github.com/jchodera","followers_url":"https://api.github.com/users/jchodera/followers","following_url":"https://api.github.com/users/jchodera/following{/other_user}","gists_url":"https://api.github.com/users/jchodera/gists{/gist_id}","starred_url":"https://api.github.com/users/jchodera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchodera/subscriptions","organizations_url":"https://api.github.com/users/jchodera/orgs","repos_url":"https://api.github.com/users/jchodera/repos","events_url":"https://api.github.com/users/jchodera/events{/privacy}","received_events_url":"https://api.github.com/users/jchodera/received_events","type":"User","site_admin":false},"created_at":"2016-05-28T02:37:34Z","updated_at":"2016-05-28T02:37:34Z","body":"I'll note that this may be a tough case because the molecules in the `ffxml` file are all protomers of the same molecule---the location of 1-2 protons are just moving around.  "}}
{"actor":{"display_login":"jchodera"}}