<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"><div>In fact I need forces and positions of all atoms. The code in groupcoord.c and edsam.c is as cryptic as in md.c for me, unfortunately... <br>My problem now is very simple in fact: I have to distribute global forces from master node (no need to update domain decompositions - just put them to corresponding local f's where they currently belong).<br><br>Regards,<br>Semen <br></div><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><br><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Carsten Kutzner <ckutzne@gwdg.de><br><b><span style="font-weight: bold;">To:</span></b> Discussion list for GROMACS development
<gmx-developers@gromacs.org><br><b><span style="font-weight: bold;">Sent:</span></b> Thu, April 7, 2011 2:45:58 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [gmx-developers] Help needed with hacking mdrun<br></font><br>
Hi, <br><br>if you only need positions and forces of a part of the MD system,<br>you might want to take a look at the flooding code in edsam.c<br>and how it uses the routines in groupcoord.c which can do most<br>of the work for you. do_single_flood takes the node-local <br>positions x and forces f, assembles the positions x of a selected<br>group into a collective ('global') array, deduces forces from<br>it, and applies those to the local f[ ] array. do_edsam does a<br>similar thing, but operates on the positions x[ ].<br><br>Carsten<br><br><br>On Apr 7, 2011, at 11:11 AM, Semen Esilevsky wrote:<br><br>> Dear All,<br>> I need to hack mdrun in rather complex way and need some help from people, who <br>> understand Gromacs internals really well.<br>> My problem is the following. Each N MD steps I want to pass current <br>> coordinates and forces to custom function, which transforms them in a certain <br>> way (doesn't
matter how at this point). Then I want to pass modified forces and <br>> <br>> coordinates back and continue simulation. Currently I got stuck with domain <br>> decomposition stuff. I figured out how to collect data on master node and pass <br>> it to my function. However, I have no idea how to distribute it back to all <br>> nodes correctly after modification.<br>> Here is my additional code in md.c so far:<br>> <br>> ...<br>> /* ######## END FIRST UPDATE STEP ############## */<br>> /* ######## If doing VV, we now have v(dt) ###### */<br>> <br>> /* ################## START TRAJECTORY OUTPUT ################# */<br>> <br>> /* Some preparations goes here */<br>> ...<br>> /* Collecting data*/<br>> if (DOMAINDECOMP(cr))<br>> {<br>> /*We need to collect x and f only*/<br>>
dd_collect_vec(cr->dd,state_local,state_local->x,state_global->x);<br>> dd_collect_vec(cr->dd,state_local,f_local,f_global);<br>> }<br>> <br>> if (MASTER(cr))<br>> {<br>> printf("Collected %d atoms at step: %d\n",top_global->natoms,step);<br>> /* Actually pass data */<br>> pass_to(top_global->natoms, t, state_global->x, f_global);<br>> ...<br>> /* Processing data here */<br>> ...<br>> /* Get data back */<br>> pass_from(state_global->x, f_global);<br>> }<br>> ...<br>> if (DOMAINDECOMP(cr)){<br>> /* Here I have to redistribute it back from state_global->x and I'm totally <br>> stuck
:( */<br>> }<br>> <br>> The problem is that functions like dd_distribute_vector(...) are only used <br>> deep inside domain decomposition code and they use some data structures, which <br>> are not exposed in .h files. <br>> <br>> Is there any other more elegant way of plugging custom code to mdrun?<br>> <br>> Any hints are deeply appreciated!<br>> <br>> Regards,<br>> Semen<br>> -- <br>> gmx-developers mailing list<br>> <a ymailto="mailto:gmx-developers@gromacs.org" href="mailto:gmx-developers@gromacs.org">gmx-developers@gromacs.org</a><br><span>> <a target="_blank" href="http://lists.gromacs.org/mailman/listinfo/gmx-developers">http://lists.gromacs.org/mailman/listinfo/gmx-developers</a></span><br>> Please don't post (un)subscribe requests to the list. Use the <br>> www interface or send it to <a ymailto="mailto:gmx-developers-request@gromacs.org"
href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.<br><br><br>--<br>Dr. Carsten Kutzner<br>Max Planck Institute for Biophysical Chemistry<br>Theoretical and Computational Biophysics<br>Am Fassberg 11, 37077 Goettingen, Germany<br>Tel. +49-551-2012313, Fax: +49-551-2012302<br><span><a target="_blank" href="http://www.mpibpc.mpg.de/home/grubmueller/ihp/ckutzne">http://www.mpibpc.mpg.de/home/grubmueller/ihp/ckutzne</a></span><br><br><br><br><br>--<br>gmx-developers mailing list<br><a ymailto="mailto:gmx-developers@gromacs.org" href="mailto:gmx-developers@gromacs.org">gmx-developers@gromacs.org</a><br><a href="http://lists.gromacs.org/mailman/listinfo/gmx-developers" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-developers</a><br>Please don't post (un)subscribe requests to the list. Use the<br>www interface or send it to <a ymailto="mailto:gmx-developers-request@gromacs.org"
href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.<br></div></div>
</div></body></html>