openforcefield / standards

A repository of the standards employed across the Open Force Field Consortium.
https://openforcefield.github.io/standards
MIT License
1 stars 3 forks source link

SMIRNOFF: handling of small periodic systems #18

Closed mrshirts closed 10 months ago

mrshirts commented 2 years ago

Is there a specification for long range interactions for if the system size is smaller than the cutoffs? Is only the minimum image calculated or are all periodic copies included? I'm not entirely sure there needs to be a convention, but it probably should be specified if there is or not.

jchodera commented 2 years ago

For periodic systems where we want to specify a periodic sum should be used, we should presumably be specifying that we should use "the Ewald sum" for Coulomb interactions (and/or Lennard-Jones interactions), rather than PME. The choice of PME cutoff, lattice parameters, alpha, etc. would all be left up to the implementation to optimize performance as long as the level of error introduced is acceptable---which is something we should explicitly define. This would enable true Ewald to be used on arbitrary space groups in the simulation engine in a manner that is compliant with the force field specification (e.g. for simulating small molecule crystals).

Only when non-periodic or pure cutoff methods are used (rather than periodic sums) would we need to specify the exact form of the cutoff/switch/shift to be used, since there is no "ideal" periodic lattice sum result to compare to.

mattwthompson commented 1 year ago

I assume

if the system size is smaller than the cutoffs

refers loosely to the size of the molecules, not the periodic boxes. For small (i.e. single-molecule or dimer) systems, the infrastructure and fitting pipelines have been using NoCutoff for years. No periodicity, no periodic sums, no lattices, and not even any cutoffs for vdW terms (https://github.com/openforcefield/standards/issues/51). Other engines don't implement this identically to or as simply as OpenMM, leading to difficulties in porting the behavior.

mattwthompson commented 10 months ago

Is there a specification for long range interactions for if the system size is smaller than the cutoffs?

If system size is defined by box vectors, I think this is simply undefined and either our infrastructure or the downstream engine should error out. (I suspect this is what happens now, I have not checked.)

If system size is defined by some characteristic length or volume of molecules and this would end up < 9 Angstrom, the convention is to just not set the box vectors, which the toolkit and interchange will interpret to mean the system is not periodic. After #53 this means (with mainline OpenFF force fields) the options will be nonperiodic_method="no-cutoff" for vdW:

 "no-cutoff": The vdW interaction is not truncated.

and nonperiodic_potential="Coulomb" for Electrostatics:

denotes that the standard Coulomb potential should be used with no cutoff or reaction-field attenuation

Is only the minimum image calculated or are all periodic copies included?

This comes down to what each engine supports - as I understand it, the intent it that no periodic images are used (for either energy) once you define the system as non-periodic. OpenMM handles this well, GROMACS does not handle it well, Amber does (I think), LAMMPS surely can, other engines I'm not totally sure.

This issue is fairly old. While some details are not completely resolved (particularly existing pain points like PME options) I think the spec now does a sufficient job of guiding users through non-periodic systems so I'm inclined to say the original question is resolved.