{"action":"created","issue":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/907","labels_url":"https://api.github.com/repos/pandegroup/openmm/issues/907/labels{/name}","comments_url":"https://api.github.com/repos/pandegroup/openmm/issues/907/comments","events_url":"https://api.github.com/repos/pandegroup/openmm/issues/907/events","html_url":"https://github.com/pandegroup/openmm/issues/907","id":75033279,"number":907,"title":"Significant potential energy discrepancy on CPU platform for solvated system","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":18,"created_at":"2015-05-11T00:17:45Z","updated_at":"2015-05-11T07:00:33Z","closed_at":null,"body":"We've been working on an updated version of our comparison of a battery of test systems across OpenMM platforms to ensure that potential energies and forces agree.\r\n\r\nWe recently updated our test for Src kinase in implicit and explicit solvent, where `2src` is pulled from the RCSB, prepared with PDBFixer, solvated, and minimized:\r\nhttps://github.com/choderalab/openmmtools/pull/56\r\n\r\nThe potential energy is surprisingly off by ~2 kcal/mol on the CPU platform on linux, while the forces are quite a bit more accurate than that:\r\n```\r\nSrcExplicit\r\n                       Reference   -278504.231592 kcal/mol         0.000000 kcal/mol       265.946679 kcal/mol         0.000000 kcal/mol\r\n                             CPU   -278502.325615 kcal/mol         1.905977 kcal/mol       265.946846 kcal/mol         0.010746 kcal/mol\r\n                                 WARNING: Potential energy error (1.905977 kcal/mol) exceeds tolerance (0.060000 kcal/mol).  Test failed.\r\n                            CUDA   -278504.315487 kcal/mol        -0.083894 kcal/mol       265.946591 kcal/mol         0.011991 kcal/mol\r\n                                 WARNING: Potential energy error (-0.083894 kcal/mol) exceeds tolerance (0.060000 kcal/mol).  Test failed.\r\n                          OpenCL   -278504.312023 kcal/mol        -0.080431 kcal/mol       265.946592 kcal/mol         0.011952 kcal/mol\r\n                                 WARNING: Potential energy error (-0.080431 kcal/mol) exceeds tolerance (0.060000 kcal/mol).  Test failed.\r\nWriting failed test system to 'SrcExplicit'.{system,state}.xml ...\r\n```\r\nThe error seems to be in the `NonbondedForce` component:\r\n```\r\nBreakdown of discrepancies by Force component:\r\nHarmonicBondForce\r\n                        platform        potential                     error                 force mag                 rms error\r\n                       Reference       241.355704 kcal/mol         0.000000 kcal/mol        24.533954 kcal/mol         0.000000 kcal/mol\r\n                             CPU       241.355704 kcal/mol         0.000000 kcal/mol        24.533954 kcal/mol         0.000000 kcal/mol\r\n                            CUDA       241.355910 kcal/mol         0.000206 kcal/mol        24.533902 kcal/mol         0.004766 kcal/mol\r\n                          OpenCL       241.355910 kcal/mol         0.000206 kcal/mol        24.533902 kcal/mol         0.004766 kcal/mol\r\nHarmonicAngleForce\r\n                        platform        potential                     error                 force mag                 rms error\r\n                       Reference       930.825886 kcal/mol         0.000000 kcal/mol        24.503043 kcal/mol         0.000000 kcal/mol\r\n                             CPU       930.825886 kcal/mol         0.000000 kcal/mol        24.503043 kcal/mol         0.000000 kcal/mol\r\n                            CUDA       930.826165 kcal/mol         0.000279 kcal/mol        24.503047 kcal/mol         0.002280 kcal/mol\r\n                          OpenCL       930.825942 kcal/mol         0.000056 kcal/mol        24.503044 kcal/mol         0.002280 kcal/mol\r\nPeriodicTorsionForce\r\n                        platform        potential                     error                 force mag                 rms error\r\n                       Reference      4370.242637 kcal/mol         0.000000 kcal/mol         8.505245 kcal/mol         0.000000 kcal/mol\r\n                             CPU      4370.242637 kcal/mol        -0.000000 kcal/mol         8.505245 kcal/mol         0.000000 kcal/mol\r\n                            CUDA      4370.242513 kcal/mol        -0.000124 kcal/mol         8.505225 kcal/mol         0.000682 kcal/mol\r\n                          OpenCL      4370.242327 kcal/mol        -0.000310 kcal/mol         8.505224 kcal/mol         0.000682 kcal/mol\r\nNonbondedForce\r\n                        platform        potential                     error                 force mag                 rms error\r\n                       Reference   -284046.655818 kcal/mol         0.000000 kcal/mol       267.024399 kcal/mol         0.000000 kcal/mol\r\n                             CPU   -284044.749725 kcal/mol         1.906094 kcal/mol       267.024565 kcal/mol         0.010746 kcal/mol\r\n                            CUDA   -284046.741833 kcal/mol        -0.086015 kcal/mol       267.024310 kcal/mol         0.010281 kcal/mol\r\n                          OpenCL   -284046.740408 kcal/mol        -0.084590 kcal/mol       267.024311 kcal/mol         0.010236 kcal/mol\r\nCMMotionRemover\r\n                        platform        potential                     error                 force mag                 rms error\r\n                       Reference         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol\r\n                             CPU         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol\r\n                            CUDA         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol\r\n                          OpenCL         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol         0.000000 kcal/mol\r\n```\r\nTest case failures emit serialized XML files to aid in debugging.  I've uploaded them here:\r\nhttps://gist.github.com/jchodera/ab6120ed6041ea764fc5\r\n\r\nIt would be great if it was possible to take a closer look as to what might be going on here.  The agreement seems to be quite good except for the CPU platform energies."},"comment":{"url":"https://api.github.com/repos/pandegroup/openmm/issues/comments/100789969","html_url":"https://github.com/pandegroup/openmm/issues/907#issuecomment-100789969","issue_url":"https://api.github.com/repos/pandegroup/openmm/issues/907","id":100789969,"user":{"login":"rmcgibbo","id":641278,"avatar_url":"https://avatars.githubusercontent.com/u/641278?v=3","gravatar_id":"","url":"https://api.github.com/users/rmcgibbo","html_url":"https://github.com/rmcgibbo","followers_url":"https://api.github.com/users/rmcgibbo/followers","following_url":"https://api.github.com/users/rmcgibbo/following{/other_user}","gists_url":"https://api.github.com/users/rmcgibbo/gists{/gist_id}","starred_url":"https://api.github.com/users/rmcgibbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmcgibbo/subscriptions","organizations_url":"https://api.github.com/users/rmcgibbo/orgs","repos_url":"https://api.github.com/users/rmcgibbo/repos","events_url":"https://api.github.com/users/rmcgibbo/events{/privacy}","received_events_url":"https://api.github.com/users/rmcgibbo/received_events","type":"User","site_admin":false},"created_at":"2015-05-11T07:00:33Z","updated_at":"2015-05-11T07:00:33Z","body":"This isn't my wheelhouse, but one potential minor inconsistency between the CPU and CUDA platforms that connects to this is that when subtracting out the portion of the exclusions that were included in the reciprocal space calculation, the CUDA platform switches from using `erfc` to `erf` [here](https://github.com/pandegroup/openmm/blob/master/platforms/cuda/src/kernels/coulombLennardJones.cu#L24) because of a precision issue.\r\n\r\nThe corresponding portion of code on the CPU platform [doesn't do this](https://github.com/pandegroup/openmm/blob/master/platforms/cpu/src/CpuNonbondedForce.cpp#L375).\r\n\r\nSwitching line 375 in CpuNonbondedForce to use `erf` instead of `1-erfcApprox` chances the potential energy of John's system by about 1.3 kcal/mol."}}