diff --git a/src/SetupModel.cpp b/src/SetupModel.cpp index 9b9c15ee4..2bcfa1194 100644 --- a/src/SetupModel.cpp +++ b/src/SetupModel.cpp @@ -2219,10 +2219,10 @@ void AssignPeopleToPlaces(void) l = Cells[i].InvCDF[(int)floor(s * 1024)]; while (Cells[i].cum_trans[l] < s) l++; ct = CellLookup[l]; - m = (int)(ranf() * ((double)ct->S)); j = -1; #pragma omp critical { + m = (int)(ranf() * ((double)ct->S)); if (ct->susceptible[m] >= 0) if ((f3) || (Places[tp][ct->susceptible[m]].AvailByAge[HOST_AGE_YEAR(k)] > 0)) { @@ -2237,6 +2237,7 @@ void AssignPeopleToPlaces(void) ERR_CRITICAL("Out of bounds place link\n"); } t = dist2_raw(Households[Hosts[k].hh].loc_x, Households[Hosts[k].hh].loc_y, Places[tp][j].loc_x, Places[tp][j].loc_y); +#pragma omp critical s = ((double)ct->S) / ((double)ct->S0) * numKernel(t) / Cells[i].max_trans[l]; if ((P.DoAdUnits) && (P.InhibitInterAdunitPlaceAssignment[tp] > 0)) {