{"action":"created","issue":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/1779","repository_url":"https://api.github.com/repos/pandegroup/openmm","labels_url":"https://api.github.com/repos/pandegroup/openmm/issues/1779/labels{/name}","comments_url":"https://api.github.com/repos/pandegroup/openmm/issues/1779/comments","events_url":"https://api.github.com/repos/pandegroup/openmm/issues/1779/events","html_url":"https://github.com/pandegroup/openmm/issues/1779","id":220259556,"number":1779,"title":"Allow for different cutoff styles on CUDA platform","user":{"login":"mvanvleet","id":14022320,"avatar_url":"https://avatars3.githubusercontent.com/u/14022320?v=3","gravatar_id":"","url":"https://api.github.com/users/mvanvleet","html_url":"https://github.com/mvanvleet","followers_url":"https://api.github.com/users/mvanvleet/followers","following_url":"https://api.github.com/users/mvanvleet/following{/other_user}","gists_url":"https://api.github.com/users/mvanvleet/gists{/gist_id}","starred_url":"https://api.github.com/users/mvanvleet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvanvleet/subscriptions","organizations_url":"https://api.github.com/users/mvanvleet/orgs","repos_url":"https://api.github.com/users/mvanvleet/repos","events_url":"https://api.github.com/users/mvanvleet/events{/privacy}","received_events_url":"https://api.github.com/users/mvanvleet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-04-07T16:11:09Z","updated_at":"2017-04-07T20:40:13Z","closed_at":null,"body":"I'm attempting to run a simulation which simultaneously uses the following forces: AmoebaMultipoleForce, NonbondedForce, CustomHBondForce, and CustomManyParticleForce. I intend to run a simulation using periodic boundary conditions and as much Ewald summation as possible, which means that I should be using (respectively) the following cutoffs: PME, LJPME, CutoffPeriodic, CutoffPeriodic.\r\n\r\nIf I use the CPU platform, I've been able to use the python layer to tailor these cutoffs as follows:\r\n\r\n```python\r\n# Create system from force field\r\nsystem = forcefield.createSystem(model_topology,\r\n                nonbondedMethod=app.NoCutoff,\r\n                nonbondedCutoff=1.0*unit.nanometers,\r\n                constraints='AllBonds',\r\n                polarization='mutual',\r\n                ewaldErrorTolerance=0.0005)\r\n\r\n# Set distance cutoffs, constraints, and other force-specific options\r\ntwo_body_cutoff = 1.1*unit.nanometers\r\nthree_body_cutoff = 0.9*unit.nanometers\r\nfor force in system.getForces():\r\n    if isinstance(force, mm.CustomHbondForce):\r\n        force.setNonbondedMethod(mm.NonbondedForce.CutoffPeriodic)\r\n        force.setCutoffDistance(two_body_cutoff)\r\n    elif isinstance(force, mm.CustomNonbondedForce):\r\n        force.setNonbondedMethod(mm.NonbondedForce.CutoffPeriodic)\r\n        force.setCutoffDistance(two_body_cutoff)\r\n        force.setUseLongRangeCorrection(True)\r\n    elif isinstance(force, mm.AmoebaMultipoleForce):\r\n        force.setNonbondedMethod(mm.NonbondedForce.PME)\r\n    elif isinstance(force, mm.NonbondedForce):\r\n        force.setNonbondedMethod(mm.NonbondedForce.LJPME)\r\n    elif isinstance(force, mm.CustomManyParticleForce):\r\n        force.setNonbondedMethod(mm.NonbondedForce.CutoffPeriodic)\r\n        force.setCutoffDistance(three_body_cutoff)\r\n    else:\r\n        pass\r\n\r\n```\r\n(Note that, in my initial call to createSystem, only the choice of `nonbondedMethod=app.NoCutoff` doesn't raise an error.)\r\n\r\nIf I switch to using the CUDA platform, however, I get the following error:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"run_co2.py\", line 98, in <module>\r\n    simulation = app.Simulation(model_topology, system, integrator, platform)\r\n  File \"/home/mvanvleet/.local/lib64/python2.7/site-packages/simtk/openmm/app/simulation.py\", line 103, in __init__\r\n    self.context = mm.Context(self.system, self.integrator, platform)\r\n  File \"/home/mvanvleet/.local/lib64/python2.7/site-packages/simtk/openmm/openmm.py\", line 2835, in __init__\r\n    this = _openmm.new_Context(*args)\r\nException: All Forces must agree on whether to use a cutoff\r\n```\r\n\r\nEither I'm misunderstanding how to properly input cutoffs for each of my forces (in which case advice on how to structure my input script is very welcome), or the exception handling in openmm.py should be changed to better deal with different, non-mutually-exclusive choices of cutoffs for different forces.\r\n\r\nFinally, in case its helpful I've attached my input scripts in the following file:\r\n[cuda_cutoff.zip](https://github.com/pandegroup/openmm/files/906114/cuda_cutoff.zip)\r\nGithub won't allow me to upload a .tgz file, so you may need to change the file extension from .zip to .tgz before unarchiving. \r\n"},"comment":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/comments/292646027","html_url":"https://github.com/pandegroup/openmm/issues/1779#issuecomment-292646027","issue_url":"https://api.github.com/repos/pandegroup/openmm/issues/1779","id":292646027,"user":{"login":"mvanvleet","id":14022320,"avatar_url":"https://avatars3.githubusercontent.com/u/14022320?v=3","gravatar_id":"","url":"https://api.github.com/users/mvanvleet","html_url":"https://github.com/mvanvleet","followers_url":"https://api.github.com/users/mvanvleet/followers","following_url":"https://api.github.com/users/mvanvleet/following{/other_user}","gists_url":"https://api.github.com/users/mvanvleet/gists{/gist_id}","starred_url":"https://api.github.com/users/mvanvleet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvanvleet/subscriptions","organizations_url":"https://api.github.com/users/mvanvleet/orgs","repos_url":"https://api.github.com/users/mvanvleet/repos","events_url":"https://api.github.com/users/mvanvleet/events{/privacy}","received_events_url":"https://api.github.com/users/mvanvleet/received_events","type":"User","site_admin":false},"created_at":"2017-04-07T20:40:13Z","updated_at":"2017-04-07T20:40:13Z","body":"Also, @Lnaden, I accidentally deleted a parenthesis in the original .xml input file I gave you; in case that's the 'input file' problem you were referring to, I attached an updated version (renamed as a .txt file so that I could upload it).\r\n\r\n[sapt_co2.txt](https://github.com/pandegroup/openmm/files/906810/sapt_co2.txt)\r\n\r\n\r\n"}}
{"actor":{"display_login":"mvanvleet"}}