torchmdnet coulomb_cutoff only if periodic#138
Conversation
|
Just checking in on the status of this. We're likely to do a 1.6.1 patch in the near future. It would be great if this fix could be included. |
|
Are you still planning to finish this? We've fixed a couple of other bugs, and I'd like to create a release to get them out. Should I keep waiting for this or do the release now? |
|
Thanks! I'm confused why you disable the cutoff when using |
|
Yes good point, it is not always the correct behavior, but it is the best default behavior in the basic MM/ML single small molecule mechanical embedding examples such as in the OpenMM cookbook tutorial: https://openmm.github.io/openmm-cookbook/dev/notebooks/tutorials/machine_learning_potentials.html#Simulating-Mixed-ML/MM-Systems. As seen in the original issue the in-vacuum energies are noticeably perturbed by the cutoff approximation #137 and thus it should not be used for a small molecule in a mechanical embedding scheme. The user can override the default behavior however they want and this is explained in the documentation. |
|
That doesn't feel right. We shouldn't make assuptions about what systems people will simulate or how models will work. You assume that any TorchMD-Net model with a Coulomb term will use reaction field. That may be true of AceFF-2.0, but there's nothing stopping someone from creating a model that uses PME. It's very likely that future models will do that. Even if we assume reaction field, for any ML region that's more than a single molecule, it's essential to include the PBC with minimum image convention. Otherwise each molecule will only ever see one periodic copy of the others. If a molecule drifts over to the next box, it will stop interacting with anything. And even if we assume you're just simulating a single molecule in a box of MM water, and assume everything is done with reaction field, there's no reason to omit the cutoff between pairs of ML atoms. They should be screened by the water just like everything else. That's what the MM force field would do. |
|
Yes good points, I have simplified the logic to just apply the periodic cutoff based on the openmm System/Topology's PBC settings. |
|
Thanks! Tests are failing with this change: You might need to add Some of the ANI and AIMNet2 tests are also failing. I'm not sure what's happening with that, but I don't think it's related to this change. |
|
Looks good. I'm not sure what's going on with the ANI and AIMNet2 failures, but I'll investigate them in a separate PR. Is this ready to merge? |
|
Yes it is ready! p.s. the aimnet2 failures look to come from similar reasons (from Claude): TestAIMNet2
|
| aimnet version | E (kJ/mol) | passes? |
|---|---|---|
| v0.1.1 (last pre-refactor) | −151663224.6 | ✅ |
| v0.2.0 | −151715123.0 | ❌ |
main (0.2.0.post1.dev1+g5b76c17a4) |
−151715123.0 | ❌ |
Options
- Pin
aimnet < 0.2in test requirements. - Regenerate the reference with AIMNet2ASE on current aimnet and update
TestAIMNet2Potential.py:41. - File an upstream issue — ~23 kJ/mol/atom drift on a 2269-atom box from a "same-method" refactor is larger than expected; may indicate a self-energy or unit difference.
|
Thanks! |
fixes #137
For in-vacuum energy evaluations we do not want to use a coulomb cutoff as it introduces errors from the reaction field approximation it uses.
Probably also for mechanical embedding small molecule mixed systems we also do not want to use the coulomb cutoff. This does not yet address that so is still a draft.