[gmx-developers] difference in force index between gromacs 3.3 and gromacs 4.0.5

Mark Abraham Mark.Abraham at anu.edu.au
Thu Sep 24 17:56:38 CEST 2009

matthieu.chavent at free.fr wrote:
> Dear Gromacs Developpers, 
> I try to adapt an Interactive Molecular Dynamics code for Gromacs 4.0.5. 
> The function that gets some external forces was implemented in gromacs 3.3 in sim_util.c near the line 602:

Actually the snippet below is 4.x code, because it has DD.

> if (bDoForces) {
>     /* Compute forces due to electric field */
>     calc_f_el(MASTER(cr) ? field : NULL,
> 	      start,homenr,mdatoms->chargeA,x,f,inputrec->ex,inputrec->et,t);
>     /* Communicate the forces */
>     if (PAR(cr)) {
>       wallcycle_start(wcycle,ewcMOVEF);
> #added line here	
> 		gimd_ext_forces( step, cr, mdatoms, f );
> #end added line
>       if (DOMAINDECOMP(cr)) {
> 	dd_move_f(cr->dd,f,buf,fr->fshift);	  
> 	/* Position restraint do not introduce inter-cg forces */
> 	if (EEL_FULL(fr->eeltype) && cr->dd->n_intercg_excl)
> 	  dd_move_f(cr->dd,fr->f_novirsum,buf,NULL);
>       } else {
> 	move_f(fplog,cr,GMX_LEFT,GMX_RIGHT,f,buf,nrnb);
> 	}
>       wallcycle_stop(wcycle,ewcMOVEF);
>     }
>   }
> This function works perfectly for Gromacs 3.3 single proc/mpi and for Gromacs 4.0.5 on a single proc. But it didn't work for Gromacs 4.0.5 in mpi... The problem seems to be, when I apply a force in the IMD (using VMD for the visualisation), sometimes I apply no forces on selected atom sometimes it can apply a force when I select an atom... I guess that is, may be, a problem of index (of the force or of the atoms on which we apply the force).  

Under either DD or PD, only atoms local to the processor are present so 
it is expected that this would work single-processor and fail (with 
segfault?) with multiple processors. You will need to work out how to 
decompose your force vector according to the charge group distribution 
over the PP processors. Start with reading the GROMACS 4 paper, and 
section 3.17 of the manual and then the code to understand how the data 
structures work.

> So, I would like to have some advices/pieces of information, if it is possible, on the differences of force implementation between Gromacs 3.3 and Gromacs 4.0.5.  


More information about the gromacs.org_gmx-developers mailing list