struct Pstruct {double x[3]; double v[3]; int k;} bigbuf[1000], particle[100]; int ierr, nprocs, root=0, p, sum, npart; int displ[10], n[10]; MPI_Comm comm; MPI_Data_type Ptype; CREATE PARTICLE DATATYPE ierr = MPI_Comm_size (comm, &nprocs); sum = 0; for (p=0; p<nprocs; p++){ displ[p] = sum; sum += n[p];} ierr = MPI_Scatter (n, 1, MPI_Int, &npart, 1, MPI_Int, root, comm); ierr = MPI_Scatterv (bigbuf, n, displ, Ptype, particle, npart, Ptype, root, comm)