GROMACS version: 2022.1
GROMACS modification: Intended
Dear all,
I would like to implement a custom external potential to be included in the force calculations. By potential I mean a spatially varying field, not pairwise interactions. Such a field should be able to act on certain (index) groups of particles. In a sense, what I would like to achieve is a generalization of functionalities like the flat bottom position restraint. Indeed, our use cases cannot be covered by the implemented position restraints, pulling or density-guided simulations (I think so at least). Therefore I would like to implement an additional module in GROMACS. I have a quite naive view of the code base, so I would like to find the least intrusive solution that still leverages the DD and acceleration capabilities of the MD engine. I am grateful for any suggestions that prevent me from running into a completely wrong direction.
As a first alternative, I have been looking into the gmxapi python interface and the sample_restraint plugin code.It is a really great tool, but there seems to be a lot of boilerplate tailored towards pair restraints based on the IRestraintPotential interface. If I understood correctly, modules of this specific form get wrapped by RestraintForceProviders in the MDRunner. However, I would like to implement a module that relies on single particle coordinates as provided by the generic IForceProvider interface. Is it possible to create such an object an bind it to an md session via gmxapi? Is this even an intended use case for the API?
Secondly, I have also been looking into the applied_forces modules, particularly electricfield and densityfitting. These classes seem to provide the interface and get the data that I need. Would it be a viable option to implement an additional module like that directly in the GROMACS library and then “register” it in tpxio and mdmodules?
Thanks a lot and kind regards,
Max