# [gmx-developers] Read the component energy and force from the code during simulation

David van der Spoel spoel at xray.bmc.uu.se
Wed Sep 7 17:03:50 CEST 2016

On 07/09/16 15:44, Yi Isaac Yang wrote:
> Hi,
>
> I know it is not a easy work to split the force, just like what we did
> it in AMBER. In AMBER, we divided the neighbor list into different parts
> at first, just to do this work is so annoying... As you said, I need to
> know the "intimate knowledge of the inner workings of GROMACS". Of
> cause, I am not. So this is the reason why I ask for the help in the
> developer list of Gromacs.
>
> At least, can you tell me how to read the component energy from the
> code? As it can be output in the .edr file, I think it is not so hard to
> read from the codes. Maybe I can start to read the code of Gromacs from
> that part.
>
Here we describe it, in the supporting:
http://dx.doi.org/10.1021/ct400404q

> Thanks,
> Isaac
>
> 2016-09-07 14:35 GMT+02:00 Berk Hess <hess at kth.se <mailto:hess at kth.se>>:
>
>     Hi,
>
>     In GROMACS is it practically impossible to obtain forces between
>     components of the system. To achieve this you would need to modify
>     the non-bonded interaction kernels to mask forces based on energy
>     group flags. Then you can either all them multiple times with
>     different mask or use multiple force outputs if you need maximum
>     efficiency. But this requires coding and intimate knowledge of the
>     inner workings of GROMACS.
>
>     Cheers,
>
>     Berk
>
>
>     On 2016-09-07 14:15, Yi Isaac Yang wrote:
>>     Hi Berk,
>>
>>     I am sorry to send so many same mails. Because this is the first
>>     time to use the developer list. I didn't receive my mail after I
>>     sent it, so I send it again and again.
>>
>>     Thank you for reply! Our method is similar as REST (Replica
>>     exchange with solute tempering) which just to enhance the solute
>>     part of the system but keep the rest of the system as usual.
>>     However, our method can't be realized by modified the force field
>>     file like in REST (Terakawa et al. JCC 2010: 1228). We must read
>>     the intra-energy of solute (marked as U_slu-slu) and the
>>     interaction energy between solute and solvent (marked as
>>     U_slu-sol) and to modified them. In order to put the modified
>>     potential energy into the system, we need to know the component
>>     forces caused by the component energy F_slu-slu=-(\partial
>>     U_slu-slu)/(\partial r) and F_slu-sol=-(\partial
>>     U_slu-sol)/(\partial r).
>>
>>     Of cause, I know we cannot divide the whole potential energy into
>>     different parts (solute, solvent or interaction energy). Even in
>>     AMBER, we just draw the short range interaction of the different
>>     parts. However, even if we can only read a part of component
>>     energy, at least we can still enhance the sampling of this part.
>>
>>     Thank you and best regrads,
>>     Isaac
>>
>>     2016-09-07 12:17 GMT+02:00 Berk Hess <hess at kth.se
>>     <mailto:hess at kth.se>>:
>>
>>         Hi,
>>
>>         Please don't send the same mail multiple times.
>>
>>         Your request is not clear enough. Do you want forces on
>>         different parts of the system or between different parts of
>>         the system? The latter is difficult to obtain.
>>         Note that with PME, which is what you should be using in most
>>         cases, it is difficult, if not impossible, to decompose forces
>>         and energies between group (pairs).
>>
>>         Cheers,
>>
>>         Berk
>>
>>
>>         On 2016-09-07 11:46, Yi Isaac Yang wrote:
>>>         Dear developers,
>>>
>>>         I am developing an enhanced sampling method, and I have
>>>         already realized it in AMBER. Now I want to add the code of
>>>         this method into Gromacs. This method need to read the
>>>         component energy and force of different part of the system
>>>         (like protein, solution, etc.) during the simulation.
>>>         However, I am not very familiar withe the codes of Gromacs,
>>>         so I don't know how to read it. I know when I perform MD
>>>         simulation using Gromacs I can set the groups in
>>>         "energygrps", then I can read the energy between those groups
>>>         in .edr file. So I think it shouldn't be too difficult to
>>>         read the component energy and force in the codes. Can you
>>>         tell me how to read the component energy and force from the
>>>         codes?
>>>
>>>         Thank you very much and best regards,
>>>         Isaac
>>>
>>>
>>
>>
>>         --
>>         Gromacs Developers mailing list
>>
>>         * Please search the archive at
>>         http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List
>>         <http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List>
>>         before posting!
>>
>>         http://www.gromacs.org/Support/Mailing_Lists
>>         <http://www.gromacs.org/Support/Mailing_Lists>
>>
>>         * For (un)subscribe requests visit
>>         https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
>>         <https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers>
>>         or send a mail to gmx-developers-request at gromacs.org
>>         <mailto:gmx-developers-request at gromacs.org>.
>>
>>
>>
>>
>>     --
>>     Yesterday Young
>>     College of Chemistry and Molecular Engineering
>>     Peking University
>>
>>
>
>
>     --
>     Gromacs Developers mailing list
>
>     * Please search the archive at
>     http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List
>     <http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List>
>     before posting!
>
>     * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>     <http://www.gromacs.org/Support/Mailing_Lists>
>
>     * For (un)subscribe requests visit
>     https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
>     <https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers>
>     or send a mail to gmx-developers-request at gromacs.org
>     <mailto:gmx-developers-request at gromacs.org>.
>
>
>
>
> --
> Yesterday Young
> College of Chemistry and Molecular Engineering
> Peking University
>
>

--
David van der Spoel, Ph.D., Professor of Biology
Dept. of Cell & Molec. Biol., Uppsala University.
Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
spoel at xray.bmc.uu.se    http://folding.bmc.uu.se