GROMACS version: 2024
GROMACS modification: Yes
Here post your question
Hello :)
I’m currently developing a new interpolated force field module in GROMACS. The approach I’m using is similar to the existing qmmm and nnpot modules, and I’ve named my module immm (interpolation mechanics / molecular mechanics). It is also located under the src/gromacs/applied_forces/ directory.
I presented an early version of this module a few months ago, and I’m actively continuing its development.
My question is about accessing velocity information within this custom force provider.
Currently, I’m using the ForceProviderInput structure to obtain positions and related data, but I couldn’t find any access to velocities through this interface.
Is there a way to retrieve (and potentially modify) velocity data without modifying the main mdrun code?
Any advice or pointers to relevant structures or best practices would be greatly appreciated.
Hi Sowon!
Good to hear that the immm module development is continuing. As far as I know, there is currently no canonical way for the MDModules to access particle velocity information.
We could think about adding velocities to the ForceProviderInput struct though, or alternatively make them available through a MDModulesNotifier callback, especially since @pjohansson is also working on a MDModule that would benefit from this, I think.
I think to start with, it would be better to limit this to read-only access, since writing velocities could lead to a world of trouble if not done carefully. @hess do you have any thoughts? I could take a look at implementing this if desired, I don’t think it should be too complicated.
We would rather not give access to the velocities through the ForceProvider interface. That interface should only allow modification of forces. And because of the different ways different integrators work, we also can’t give generic read access to velocities for computing forces.
The plan is to add an update callback to the MDModule interface with read access to coordinates, velocities and forces. I don’t know if that would satisfy your needs.
Right, that makes sense. So that would mean once the update is performed at the end of a step, the callback should provide access to the total computed force on each particle as well as the new positions and velocities?
I was thinking of providing access to the current coordinates and forces before update. With leap-frog the velocities would be offset my -dt/2. For velocity verlet I would need to check.
Thank you! If there are any updates regarding access to velocity information, please let me know. This is part of a future plan for my module, so there’s no urgent need to access it right now.
Just out of curiosity, what would you plan to do in your module with the velocities? If I understood the principle of the method correctly, it is basically interpolating the potential energy function given at fixed points in coordinate space, no? Can that depend on velocities as well?
You’re right. In the interpolation method, velocity information is not used. Velocity becomes relevant when implementing the surface hopping (SH) algorithm using interpolated multi-state PESs. (When a hop occurs, the velocities are rescaled according to the SH algorithm). In our previous immm code, this was implemented by modifying the md.cpp file. So I’m not sure whether this is also part of the ForceProvider module, or if it would be better to handle it elsewhere.
This is clearly not providing a force, but rather related to the integration. We have not planned to add options to affect the integration of the atomic coordinates and velocities. This might become rather complex when constraints and/or temperature coupling is present.
It seems more complex than I thought. Since it’s just an optional part of the module, I only wanted to see if it is easy to implement. thank you for letting me know