[gmx-developers] Help needed with hacking mdrun

Carsten Kutzner ckutzne at gwdg.de
Thu Apr 7 13:45:58 CEST 2011


Hi, 

if you only need positions and forces of a part of the MD system,
you might want to take a look at the flooding code in edsam.c
and how it uses the routines in groupcoord.c which can do most
of the work for you. do_single_flood takes the node-local 
positions x and forces f, assembles the positions x of a selected
group into a collective ('global') array, deduces forces from
it, and applies those to the local f[ ] array. do_edsam does a
similar thing, but operates on the positions x[ ].

Carsten


On Apr 7, 2011, at 11:11 AM, Semen Esilevsky wrote:

> Dear All,
> I need to hack mdrun in rather complex way and need some help from people, who 
> understand Gromacs internals really well.
> My  problem is the following. Each N MD steps I want to pass current  
> coordinates and forces to custom function, which transforms them in a  certain 
> way (doesn't matter how at this point). Then I want to pass  modified forces and 
> 
> coordinates back and continue simulation. Currently I  got stuck with domain 
> decomposition stuff. I figured out how to collect  data on master node and pass 
> it to my function. However,  I have no  idea how to distribute it back to all 
> nodes correctly after  modification.
> Here is my additional code in md.c  so far:
> 
> ...
> /* ########  END FIRST UPDATE STEP  ############## */
> /* ########  If doing VV, we now have v(dt)  ###### */
> 
> /* ################## START TRAJECTORY OUTPUT ################# */
> 
> /* Some preparations goes here */
> ...
> /* Collecting data*/
> if (DOMAINDECOMP(cr))
>    {
>        /*We need to collect x and f only*/
>        dd_collect_vec(cr->dd,state_local,state_local->x,state_global->x);
>        dd_collect_vec(cr->dd,state_local,f_local,f_global);
>    }
> 
> if (MASTER(cr))
>    {
>        printf("Collected %d atoms at step: %d\n",top_global->natoms,step);
>        /* Actually pass data */
>        pass_to(top_global->natoms, t, state_global->x, f_global);
>         ...
>        /* Processing data here */
>        ...
>       /*  Get data back */
>       pass_from(state_global->x, f_global);
>    }
> ...
> if (DOMAINDECOMP(cr)){
>    /* Here I have to redistribute it back from state_global->x and I'm totally 
> stuck :(  */
> }
> 
> The problem is that functions like dd_distribute_vector(...) are only used  
> deep inside domain decomposition code and they use some data structures, which 
> are not exposed in .h files. 
> 
> Is there any other more elegant way of plugging custom code to mdrun?
> 
> Any hints are deeply appreciated!
> 
> Regards,
> Semen
> -- 
> 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.


--
Dr. Carsten Kutzner
Max Planck Institute for Biophysical Chemistry
Theoretical and Computational Biophysics
Am Fassberg 11, 37077 Goettingen, Germany
Tel. +49-551-2012313, Fax: +49-551-2012302
http://www.mpibpc.mpg.de/home/grubmueller/ihp/ckutzne







More information about the gromacs.org_gmx-developers mailing list