<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Dear All,<br>I need to hack mdrun in rather complex way and need some help from people, who understand Gromacs internals really well.<br>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.<br>Here is my additional code in md.c  so far:<br><br>...<br>/* ########&nbsp; END FIRST UPDATE STEP&nbsp; ############## */<br>/* ########&nbsp; If doing VV, we now have v(dt)
 ###### */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;/* ################## START TRAJECTORY OUTPUT ################# */<br><br>/* Some preparations goes here */<br>...<br>/* Collecting data*/<br>if (DOMAINDECOMP(cr))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*We need to collect x and f only*/<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dd_collect_vec(cr-&gt;dd,state_local,state_local-&gt;x,state_global-&gt;x);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dd_collect_vec(cr-&gt;dd,state_local,f_local,f_global);<br>&nbsp;&nbsp;&nbsp; }<br><br>if (MASTER(cr))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Collected %d atoms at step: %d\n",top_global-&gt;natoms,step);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Actually pass data */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass_to(top_global-&gt;natoms, t, state_global-&gt;x, f_global);<br>&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /* Processing data here */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*&nbsp; Get data back */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass_from(state_global-&gt;x, f_global);<br>&nbsp;&nbsp;&nbsp; }<br>...<br>if (DOMAINDECOMP(cr)){<br>&nbsp;&nbsp;&nbsp; /* Here I have to redistribute it back and I'm totally stuck :(&nbsp; */<br>}<br><br>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. <br>Any hints are deeply appreciated!<br><br>Regards,<br>Semen<br></div></body></html>