[gmx-developers] rvec structure

Berk Hess hessb at mpip-mainz.mpg.de
Thu Jul 7 16:38:01 CEST 2005


Hi,

You don't need a temp array.

My test code is in CVS revision 1.8 of mvxvf.c:

 >   static int *recvcounts=NULL,*displs;
 >   int i;
 >
 >   if (recvcounts == NULL) {
 >     snew(recvcounts,nsb->nprocs);
 >     snew(displs,nsb->nprocs);
 >     for(i=0; i<nsb->nprocs; i++) {
 >       recvcounts[i] = nsb->homenr[i]*sizeof(x[0]);
 >       displs[i]     = nsb->index[i]*sizeof(x[0]);
 >     }
 >   }
 >   MPI_Allgatherv(arrayp(x[nsb->index[nsb->pid]],nsb->homenr[nsb->pid]),
 >                MPI_BYTE,x,recvcounts,displs,MPI_BYTE,MPI_COMM_WORLD);

It also contains the force summing, just one like is enough for this:
MPI_Allreduce(f,f,nsb->natoms*DIM,mpi_type,MPI_SUM,MPI_COMM_WORLD);

Berk.




More information about the gromacs.org_gmx-developers mailing list