[gmx-developers] Re: Editing the GROMACS energy function

francesco oteri francesco.oteri at gmail.com
Fri Aug 31 14:38:54 CEST 2012


Hi,
I am doing on hacking gromacs and, since gromacs code is very complicated,
in my opinion it is better avoiding to touch so deeply the code.

You can do simply writing your own function and executing it after (or
before, it depends by the details of your modification)
do_force (in md.c) simply modifying the f vector and printing the output
after print_ebin (the function that actually prints results).
Of course this approach is right just if your modification can be developed
as an independent module.

Regarding coordinates, because of domain decomposition, each node can
access only to local atom data.

To obtain the local index starting from the global index,  you need to
execute the following code (tested on gromacs 4.5.5):

#include "gmx_ga2la.h"

int global_index,local_index,cell_id;
t_commrec *cr;

for(global_index=0;global_index<atom_count; global_index++)
       {
   cell_id            = cr->dd->ga2la->laa[global_index].cell;
   local_index   = cr->dd->ga2la->laa[global_index].la;

          if(cell_id == 0)
    {
      //atom global_index is on this node
   }
         else
    {
      //atom global_index is NOT on this node
   }
       }

you can get the atom_count (total number of atoms) in md.c using:
state_global->natoms

I hope I've helped you :)

Francesco


2012/8/31 alex.bjorling <alex.bjorling at gmail.com>

> I'm now in the exact same position as Radhakrishna describes here. After
> posting the following, I did some more research and now have ways to get
> both energy and force from a complicated operation over all coordinates.
>
>
> http://gromacs.5086.n6.nabble.com/Adding-an-artificial-energy-term-for-structure-refinement-tp5000240.html
>
> Has anyone been successful in making these modifications?
>
> Best,
> Alex
>
>
>
> --
> View this message in context:
> http://gromacs.5086.n6.nabble.com/Editing-the-GROMACS-energy-function-tp4669473p5000716.html
> Sent from the GROMACS Developers Forum mailing list archive at Nabble.com.
> --
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.
>



-- 
Cordiali saluti, Dr.Oteri Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20120831/60256280/attachment.html>


More information about the gromacs.org_gmx-developers mailing list