src/ffs/ffs_result_aflux.c
int ffs_result_aflux_reduce(ffs_result_aflux_t * obj, MPI_Comm comm) {

  int n;
  int nsuccess = 0;
  int nto = 0;
  double tsum_local = 0.0;
  double tmax_local = 0.0;

  dbg_return_if(obj == NULL, -1);

  for (n = 0; n < obj->ntrial_local; n++) {
    tsum_local += obj->t0[n];
    if (obj->t0[n] > tmax_local) tmax_local = obj->t0[n];
    if (obj->status[n] == FFS_TRIAL_SUCCEEDED) nsuccess += 1;
    if (obj->status[n] == FFS_TRIAL_TIMED_OUT) nto += 1;
  }

  MPI_Allreduce(&nsuccess, &obj->nsuccess, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&nto, &obj->nto, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&tsum_local, &obj->tsum, 1, MPI_DOUBLE, MPI_SUM, comm);
  MPI_Allreduce(&tmax_local, &obj->tmax, 1, MPI_DOUBLE, MPI_MAX, comm);

  MPI_Allreduce(&obj->ntrial_local, &obj->ntrial, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&obj->neq_local, &obj->neq, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&obj->ncross_local, &obj->ncross, 1, MPI_INT, MPI_SUM, comm); 

  return 0;
}
/*****************************************************************************
 *
 *  ffs_result_reduce
 *
 *     nsuccess  number of trials reaching first interface 
 *     nto       number of trials timed out before first interface
 *     neq       number of equilibration runs
 *
 *     ncross = total number of initial crossings
 *     tsum   = sum of trajectory times
 *     tmax   = maximum trajectory time
 *
 *****************************************************************************/
ffs_result_reduce
nsuccess  number of trials reaching first interface
nto       number of trials timed out before first interface
neq       number of equilibration runs

ncross = total number of initial crossings
tsum   = sum of trajectory times
tmax   = maximum trajectory time
ffs_result_reduce nsuccess number of trials reaching first interface nto number of trials timed out before first interface neq number of equilibration runs ncross = total number of initial crossings tsum = sum of trajectory times tmax = maximum trajectory time
int ffs_result_aflux_reduce(ffs_result_aflux_t * obj, MPI_Comm comm) {
  int n;
  int nsuccess = 0;
  int nto = 0;
  double tsum_local = 0.0;
  double tmax_local = 0.0;
  dbg_return_if(obj == NULL, -1);
  for (n = 0; n < obj->ntrial_local; n++) {
    tsum_local += obj->t0[n];
    if (obj->t0[n] > tmax_local) tmax_local = obj->t0[n];
    if (obj->status[n] == FFS_TRIAL_SUCCEEDED) nsuccess += 1;
    if (obj->status[n] == FFS_TRIAL_TIMED_OUT) nto += 1;
  }
  MPI_Allreduce(&nsuccess, &obj->nsuccess, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&nto, &obj->nto, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&tsum_local, &obj->tsum, 1, MPI_DOUBLE, MPI_SUM, comm);
  MPI_Allreduce(&tmax_local, &obj->tmax, 1, MPI_DOUBLE, MPI_MAX, comm);
  MPI_Allreduce(&obj->ntrial_local, &obj->ntrial, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&obj->neq_local, &obj->neq, 1, MPI_INT, MPI_SUM, comm);
  MPI_Allreduce(&obj->ncross_local, &obj->ncross, 1, MPI_INT, MPI_SUM, comm); 
  return 0;
}
int ffs_result_aflux_reduce ( ffs_result_aflux_t * obj , MPI_Comm comm ) { int n ; int nsuccess = 0 ; int nto = 0 ; double tsum_local = 0.0 ; double tmax_local = 0.0 ; dbg_return_if ( obj == NULL , -1 ) ; for ( n = 0 ; n < obj -> ntrial_local ; n ++ ) { tsum_local += obj -> t0 [ n ] ; if ( obj -> t0 [ n ] > tmax_local ) tmax_local = obj -> t0 [ n ] ; if ( obj -> status [ n ] == FFS_TRIAL_SUCCEEDED ) nsuccess += 1 ; if ( obj -> status [ n ] == FFS_TRIAL_TIMED_OUT ) nto += 1 ; } MPI_Allreduce ( & nsuccess , & obj -> nsuccess , 1 , MPI_INT , MPI_SUM , comm ) ; MPI_Allreduce ( & nto , & obj -> nto , 1 , MPI_INT , MPI_SUM , comm ) ; MPI_Allreduce ( & tsum_local , & obj -> tsum , 1 , MPI_DOUBLE , MPI_SUM , comm ) ; MPI_Allreduce ( & tmax_local , & obj -> tmax , 1 , MPI_DOUBLE , MPI_MAX , comm ) ; MPI_Allreduce ( & obj -> ntrial_local , & obj -> ntrial , 1 , MPI_INT , MPI_SUM , comm ) ; MPI_Allreduce ( & obj -> neq_local , & obj -> neq , 1 , MPI_INT , MPI_SUM , comm ) ; MPI_Allreduce ( & obj -> ncross_local , & obj -> ncross , 1 , MPI_INT , MPI_SUM , comm ) ; return 0 ; }
ffs_result_reduce
     nsuccess  number of trials reaching first interface
     nto       number of trials timed out before first interface
     neq       number of equilibration runs
ffs_result_reduce nsuccess number of trials reaching first interface nto number of trials timed out before first interface neq number of equilibration runs