8a9,10 > mfpsum = 0.0f; > nummfp = 0.0f; 40,41c42,43 < // int numfrc = FRC_generator(100); < // printf("FRC generated, %d/%d = %0.2f%%\n", numfrc, LN_GRID_X*LN_GRID_Y*LN_GRID_Z - numnogo, 100.0f * (float)numfrc/(float)(LN_GRID_X*LN_GRID_Y*LN_GRID_Z - numnogo)); --- > int numfrc = FRC_generator(100); > printf("FRC generated, %d/%d = %0.2f%%\n", numfrc, LN_GRID_X*LN_GRID_Y*LN_GRID_Z - numnogo, 100.0f * (float)numfrc/(float)(LN_GRID_X*LN_GRID_Y*LN_GRID_Z - numnogo)); 49c51 < if ((x + 8) % 32 == 0 && (z + 4) % 16 == 0) { --- > if ((x + 8) % 16 == 0 && (z + 4) % 16 == 0) { // 32 & 16 122c124 < grid[x][y][z].cell.death_time = grid[x][y][z].cell.birth_time + rnd.getnormal(CD4_MAX_AGE, 15 * DAY); --- > grid[x][y][z].cell.death_time = grid[x][y][z].cell.birth_time + rnd.getnormal(CD4_MAX_AGE, CD4_MAX_AGE_STD); 128c130 < grid[x][y][z].cell.death_time = grid[x][y][z].cell.birth_time + rnd.getnormal(CD8_MAX_AGE, 15 * DAY); --- > grid[x][y][z].cell.death_time = grid[x][y][z].cell.birth_time + rnd.getnormal(CD8_MAX_AGE, CD8_MAX_AGE_STD); 139a142 > grid[x][y][z].cell.mfp = MFP_UNIT; 147c150 < bool LNGrid::CalcTimeSlice(int slice) { // 6 seconds per slice, 20 per 2 minutes --- > bool LNGrid::CalcTimeSlice(int slice) { // now 6 seconds per slice, 3 per 18s // 6 seconds per slice, 20 per 2 minutes 149c152 < if (slice % 20 == 0) { // yes --- > /* if (slice % 20 == 0) { // yes 160a164,180 > }*/ > if (slice % 3 == 0) { // T cells > ClearMoved(); > Recruitment(); > Movement(); > States(); > ClearDead(); > > if (slice % 60 == 0) { > printf(" %0.1fh: [HT] %d, [KT] %d, [DC] %d\n", (float)timeindex/600.0, totalcells[CELL_H], totalcells[CELL_K], totalcells[CELL_D]); > if (totalcellslost > 0) > printf(" Avg grid time: %0.1fh\n", (float)totalgridtime/(float)(totalcellslost * 600)); > if (nummfp > 0) > printf(" Mean Free Path: %0.1fum\n", mfpsum/nummfp); > } > > return true; 271a292 > #ifdef DRAWPOINTS 303a325 > #endif 342c364 < glColor3f(0.2f, 0.4f, 1.0f); --- > glColor3f(0.2f, 0.4f, 1.0f); // light blue 346c368 < glColor3f(0.2f, 1.0f, 0.6f); --- > glColor3f(0.2f, 1.0f, 0.6f); // aqua 350c372 < glColor3f(0.0f, 0.0f, 1.0f); // 0, .2, 1 --- > glColor3f(0.0f, 0.0f, 1.0f); // blue // 0, .2, 1 355c377 < glColor3f(1.0f, 0.2f, 0.2f); --- > glColor3f(1.0f, 0.2f, 0.2f); // light red 358c380 < glColor3f(1.0f, 0.2f, 1.0f); --- > glColor3f(1.0f, 0.2f, 1.0f); // purple 362c384 < glColor3f(1.0f, 0.0f, 0.0f); --- > glColor3f(1.0f, 0.0f, 0.0f); // light red 366c388 < glColor3f(0.0f, 1.0f, 0.0f); --- > glColor3f(0.0f, 1.0f, 0.0f); // green 369c391 < glColor3f(0.4f, 1.0f, 0.4f); --- > glColor3f(0.4f, 1.0f, 0.4f); // light green 371c393 < glColor3f(1.0f, 1.0f, 1.0f); --- > glColor3f(1.0f, 1.0f, 1.0f); // white 375c397 < glColor3f(1.0f, 1.0f, 0.0f); --- > glColor3f(1.0f, 1.0f, 0.0f); // yellow 377c399 < glColor3f(1.0f, 0.4f, 0.4f); --- > glColor3f(1.0f, 0.4f, 0.4f); // pink 380c402 < glColor3f(1.0f, 0.4f, 0.0f); --- > glColor3f(1.0f, 0.4f, 0.0f); // orange 426a449,473 > > // glPushMatrix(); > //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > glDisable(GL_LIGHTING); > glLoadIdentity(); > glTranslatef(0.0f, 0.0f, -1.0f); > // now draw text > glColor4f(1.0f, 1.0f, 1.0f, 1.0f); > // Position The Text On The Screen > glRasterPos2f(0.46, 0.38); > glPrint("%0.1fh", (float)timeindex/600.0f); // Print GL Text To The Screen > glEnable(GL_LIGHTING); > > /* //SDL_Surface *drawtext(TTF_Font *fonttodraw, char fgR, char fgG, char fgB, char fgA, > //char bgR, char bgG, char bgB, char bgA, char * text, textquality quality); > fontsurface = drawtext(timerfont, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, "HELLO", solid); > // timeindex > //SDL_BlitSurface(fontsurface,0,screen,0); > while ( SDL_BlitSurface(fontsurface, 0, screen, 0) == -2 ) { > while ( SDL_LockSurface(fontsurface) < 0 ) > SDL_Delay(10); > SDL_BlitSurface(fontsurface, 0, screen, 0); > SDL_UnlockSurface(fontsurface); > }*/ > // glPopMatrix(); 442a490 > grid[newcoord.x][newcoord.y][newcoord.z].cell.mfp = MFP_UNIT; 445c493 < grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(CD4_MAX_AGE, 15 * DAY); --- > grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(CD4_MAX_AGE, CD4_MAX_AGE_STD); 467a516 > grid[newcoord.x][newcoord.y][newcoord.z].cell.mfp = MFP_UNIT; 470c519 < grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(CD8_MAX_AGE, 15 * DAY); --- > grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(CD8_MAX_AGE, CD8_MAX_AGE_STD); 484,517c533,569 < for (int i = 0; i < als.size(); i++) { < if (rnd.getfloat() < P_PROB_D_RECRUITMENT) { < coord temp = als[i]; < int newdir = rnd.get32() % 27; < coord newcoord = applydir(temp, newdir); < < if (grid[newcoord.x][newcoord.y][newcoord.z].cell.celltype == CELL_NONE) { < grid[newcoord.x][newcoord.y][newcoord.z].cell.displaybig = 1; < grid[newcoord.x][newcoord.y][newcoord.z].cell.lastdir = newdir; < grid[newcoord.x][newcoord.y][newcoord.z].cell.celltype = CELL_D; < grid[newcoord.x][newcoord.y][newcoord.z].cell.enter_time = timeindex; < grid[newcoord.x][newcoord.y][newcoord.z].cell.movedyet = true; < grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time = timeindex - rnd.get_inrange(DC_MIN_AGE, DC_MAX_AGE); < grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(DC_MAX_AGE, 2 * DAY); < // grid[newcoord.x][newcoord.y][newcoord.z].cell.license_time = 0; < grid[newcoord.x][newcoord.y][newcoord.z].cell.hide_time = 0; < grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = rnd.getfloat() * 100.0f; < if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC <= 40.0f) < grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = rnd.getnormal(50, 20); < else < grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = rnd.getnormal(150, 50); // 250, 50? < if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC < 0.0f) < grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = 0.0f; < if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC > pMHC_LIMIT) < grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = pMHC_LIMIT; < if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC <= IDC_MDC_BOUNDARY) { < grid[newcoord.x][newcoord.y][newcoord.z].cell.state = DCELL_IMMATURE; < grid[newcoord.x][newcoord.y][newcoord.z].cell.next_state = DCELL_IMMATURE; < } else { < grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time = timeindex - rnd.getnormal(20, 5) * HOUR; < grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(DC_MAX_TIME_MATURE, 5 * HOUR); < grid[newcoord.x][newcoord.y][newcoord.z].cell.state = DCELL_MATURE; < grid[newcoord.x][newcoord.y][newcoord.z].cell.next_state = DCELL_MATURE; < } --- > if (timeindex % 12 == 0) { > for (int i = 0; i < als.size(); i++) { > if (rnd.getfloat() < P_PROB_D_RECRUITMENT) { > coord temp = als[i]; > int newdir = rnd.get32() % 27; > coord newcoord = applydir(temp, newdir); > > if (grid[newcoord.x][newcoord.y][newcoord.z].cell.celltype == CELL_NONE) { > grid[newcoord.x][newcoord.y][newcoord.z].cell.displaybig = 1; > grid[newcoord.x][newcoord.y][newcoord.z].cell.lastdir = newdir; > grid[newcoord.x][newcoord.y][newcoord.z].cell.celltype = CELL_D; > grid[newcoord.x][newcoord.y][newcoord.z].cell.enter_time = timeindex; > grid[newcoord.x][newcoord.y][newcoord.z].cell.mfp = MFP_UNIT; > grid[newcoord.x][newcoord.y][newcoord.z].cell.movedyet = true; > grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time = timeindex - rnd.get_inrange(DC_MIN_AGE, DC_MAX_AGE); > grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(DC_MAX_AGE, DC_MAX_AGE_STD); > // grid[newcoord.x][newcoord.y][newcoord.z].cell.license_time = 0; > grid[newcoord.x][newcoord.y][newcoord.z].cell.hide_time = 0; > grid[newcoord.x][newcoord.y][newcoord.z].cell.lockdown = 0; > grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = rnd.getfloat() * 100.0f; > if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC <= 40.0f) > grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = rnd.getnormal(50, 50); > else > grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = rnd.getnormal(200, 50); // 250, 50? > if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC < 0.0f) > grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = 0.0f; > if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC > pMHC_LIMIT) > grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC = pMHC_LIMIT; > if (grid[newcoord.x][newcoord.y][newcoord.z].cell.pMHC <= IDC_MDC_BOUNDARY) { > grid[newcoord.x][newcoord.y][newcoord.z].cell.state = DCELL_IMMATURE; > grid[newcoord.x][newcoord.y][newcoord.z].cell.next_state = DCELL_IMMATURE; > } else { > grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time = timeindex - rnd.getnormal(20, 5) * HOUR; > grid[newcoord.x][newcoord.y][newcoord.z].cell.death_time = grid[newcoord.x][newcoord.y][newcoord.z].cell.birth_time + rnd.getnormal(DC_MAX_TIME_MATURE, DC_MAX_TIME_MATURE_STD); > grid[newcoord.x][newcoord.y][newcoord.z].cell.state = DCELL_MATURE; > grid[newcoord.x][newcoord.y][newcoord.z].cell.next_state = DCELL_MATURE; > } 519,520c571,573 < totalcells[CELL_D]++; < newdc++; --- > totalcells[CELL_D]++; > newdc++; > } 538a592,593 > if (grid[x][y][z].cell.celltype == CELL_D && timeindex % 12 != 0) // don't do DCs every cycle > continue; 539a595 > int lastdir = grid[x][y][z].cell.lastdir; 553a610,617 > // did move, so increment > if (newdir == lastdir) { > grid[newcoord.x][newcoord.y][newcoord.z].cell.mfp += MFP_UNIT; > } else { // save last mfp > mfpsum += grid[x][y][z].cell.mfp; > nummfp++; > grid[newcoord.x][newcoord.y][newcoord.z].cell.mfp = MFP_UNIT; > } 554a619,621 > mfpsum += grid[x][y][z].cell.mfp; // save last mfp > nummfp++; > 563c630 < } --- > } // if no movement maybe clear mfp? 576a644,645 > if (grid[x][y][z].cell.celltype == CELL_D && grid[x][y][z].cell.lockdown == 0) > grid[x][y][z].cell.movedyet = false; 600,607c669,684 < float binding_probability = 100.0f / (1.0f + exp(-(grid[location.x][location.y][location.z].cell.pMHC-CD4_pMHC_FOR_MEDIAN_BINDING_PROB)/CD4_SHAPE_BINDING_PROB_CURVE)); < if (rnd.getfloat() * 100.0f <= binding_probability) { < // grid[x][y][z].cell.dc_bound = true; < grid[x][y][z].cell.dc_bound_time = timeindex; < grid[x][y][z].cell.dc_coord = location; < grid[x][y][z].cell.next_state = HCELL_BOUND; < grid[x][y][z].cell.displaybig = 1; // *** < } --- > float ap = CD4_pMHC_FOR_MEDIAN_BINDING_PROB; > float bp = CD4_SHAPE_BINDING_PROB_CURVE; > float xp = grid[location.x][location.y][location.z].cell.pMHC; > float binding_probability = 100/(1+exp(-1*(xp-ap)/bp)); //100.0f / (1.0f + exp(-(grid[location.x][location.y][location.z].cell.pMHC-CD8_pMHC_FOR_MEDIAN_BINDING_PROB)/CD8_SHAPE_BINDING_PROB_CURVE)); > //float binding_probability = 100.0f / (1.0f + exp(-(grid[location.x][location.y][location.z].cell.pMHC-CD4_pMHC_FOR_MEDIAN_BINDING_PROB)/CD4_SHAPE_BINDING_PROB_CURVE)); > if (rnd.getfloat() * 100.0f <= binding_probability) { > // grid[x][y][z].cell.dc_bound = true; > grid[x][y][z].cell.dc_bound_time = timeindex; > grid[x][y][z].cell.dc_unbind_time = timeindex + rnd.getnormal(CD4_MAX_BINDING_TIME, CD4_MAX_BINDING_TIME_STD); > grid[x][y][z].cell.dc_unbind_pMHC = UNBINDING_THRESHOLD + rnd.get_inrange(0, 50); > grid[x][y][z].cell.dc_coord = location; > grid[location.x][location.y][location.z].cell.lockdown = 1; > grid[location.x][location.y][location.z].cell.movedyet = true; > grid[x][y][z].cell.next_state = HCELL_BOUND; > grid[x][y][z].cell.displaybig = 1; // *** > } 614c691 < } else if ((timeindex % HOUR) == 0) { --- > } else if (((timeindex - grid[x][y][z].cell.birth_time) % HOUR) == 0) { 617,621c694,709 < float pMHC_decay = pow((float)(exp(log(0.5) / (30.0f * pMHC_HALFLIFE))), (float)15.0f); < grid[x][y][z].cell.priming_history += (grid[location.x][location.y][location.z].cell.pMHC / pMHC_decay); < if (grid[x][y][z].cell.priming_history > PRIMING_THRESHOLD_VALUE || // *** < grid[location.x][location.y][location.z].cell.pMHC < UNBINDING_THRESHOLD || < (timeindex - grid[x][y][z].cell.dc_bound_time) > CD4_MAX_BINDING_TIME) { --- > // float pMHC_decay = pow((float)(exp(log(0.5) / (30.0f * pMHC_HALFLIFE))), (float)15.0f); > // grid[x][y][z].cell.priming_history += (grid[location.x][location.y][location.z].cell.pMHC / pMHC_decay); > // if (grid[x][y][z].cell.priming_history > PRIMING_THRESHOLD_VALUE || // *** > // grid[location.x][location.y][location.z].cell.pMHC < UNBINDING_THRESHOLD || > // (timeindex - grid[x][y][z].cell.dc_bound_time) > CD4_MAX_BINDING_TIME) { > if (grid[location.x][location.y][location.z].cell.pMHC < grid[x][y][z].cell.dc_unbind_pMHC || > timeindex >= grid[x][y][z].cell.dc_unbind_time) { > float cp = CD4_TIME_FOR_MEDIAN_PRIMING_PROB; > float dp = CD4_SHAPE_PRIMING_PROB_CURVE; > float xp = grid[location.x][location.y][location.z].cell.pMHC * (timeindex - grid[x][y][z].cell.dc_bound_time); > // grid[x][y][z].cell.dc_bound = false; > float priming_probability = 100.0f/(1+exp(-1*(xp-cp)/dp)); //90.0f;// 100.0f / (exp(-(grid[x][y][z].cell.priming_history / UNBINDING_THRESHOLD - CD4_TIME_FOR_MEDIAN_PRIMING_PROB)/CD4_SHAPE_PRIMING_PROB_CURVE)); > //cout << "H cell priming probability: " << priming_probability << endl; > if (rnd.getfloat() * 100.0f <= priming_probability) { > grid[x][y][z].cell.birth_time = timeindex; > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_AGE, CD4_MAX_AGE_STD); 623,636c711,718 < float priming_probability = 90.0f;// 100.0f / (exp(-(grid[x][y][z].cell.priming_history / UNBINDING_THRESHOLD - CD4_TIME_FOR_MEDIAN_PRIMING_PROB)/CD4_SHAPE_PRIMING_PROB_CURVE)); < //cout << "H cell priming probability: " << priming_probability << endl; < if (rnd.getfloat() * 100.0f <= priming_probability) { < grid[x][y][z].cell.birth_time = timeindex; < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_AGE, 15 * DAY); < // grid[x][y][z].cell.dc_bound = false; < grid[x][y][z].cell.displaybig = 1; // *** < grid[x][y][z].cell.next_state = HCELL_ACTIVE; < grid[x][y][z].cell.division_counter = 0; < } else { < grid[x][y][z].cell.hide_time = timeindex + HOUR; < grid[x][y][z].cell.next_state = HCELL_RESTING; < grid[x][y][z].cell.priming_history = 0.0f; < } --- > grid[x][y][z].cell.displaybig = 1; // *** > grid[x][y][z].cell.next_state = HCELL_ACTIVE; > grid[x][y][z].cell.division_counter = 0; > } else { > grid[x][y][z].cell.next_state = HCELL_RESTING; > grid[x][y][z].cell.hide_time = timeindex + HOUR; > grid[x][y][z].cell.priming_history = 0.0f; > } 649c731 < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_TIME_EFFECTOR, DAY); --- > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_TIME_EFFECTOR, CD4_MAX_TIME_EFFECTOR_STD); 656c738 < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_AGE, 15 * DAY); --- > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_AGE, CD4_MAX_AGE_STD); 662c744 < grid[location.x][location.y][location.z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_AGE, 15 * DAY); --- > grid[location.x][location.y][location.z].cell.death_time = timeindex + rnd.getnormal(CD4_MAX_AGE, CD4_MAX_AGE_STD); 663a746 > grid[location.x][location.y][location.z].cell.mfp = MFP_UNIT; 685,693c768,783 < // if (grid[location.x][location.y][location.z].cell.state == DCELL_LICENSED) { < float binding_probability = 100.0f / (1.0f + exp(-(grid[location.x][location.y][location.z].cell.pMHC-CD8_pMHC_FOR_MEDIAN_BINDING_PROB)/CD8_SHAPE_BINDING_PROB_CURVE)); < if (rnd.getfloat() * 100.0f <= binding_probability) { < // grid[x][y][z].cell.dc_bound = true; < grid[x][y][z].cell.dc_bound_time = timeindex; < grid[x][y][z].cell.dc_coord = location; < grid[x][y][z].cell.displaybig = 1; // *** < grid[x][y][z].cell.next_state = KCELL_BOUND; < } --- > // if (grid[location.x][location.y][location.z].cell.state == DCELL_LICENSED) { > float ap = CD8_pMHC_FOR_MEDIAN_BINDING_PROB; > float bp = CD8_SHAPE_BINDING_PROB_CURVE; > float xp = grid[location.x][location.y][location.z].cell.pMHC; > float binding_probability = 100/(1+exp(-1*(xp-ap)/bp)); //100.0f / (1.0f + exp(-(grid[location.x][location.y][location.z].cell.pMHC-CD8_pMHC_FOR_MEDIAN_BINDING_PROB)/CD8_SHAPE_BINDING_PROB_CURVE)); > if (rnd.getfloat() * 100.0f <= binding_probability) { > // grid[x][y][z].cell.dc_bound = true; > grid[x][y][z].cell.dc_bound_time = timeindex; > grid[x][y][z].cell.dc_unbind_time = timeindex + rnd.getnormal(CD8_MAX_BINDING_TIME, CD8_MAX_BINDING_TIME_STD); > grid[x][y][z].cell.dc_unbind_pMHC = UNBINDING_THRESHOLD + rnd.get_inrange(0, 50); > grid[x][y][z].cell.dc_coord = location; > grid[location.x][location.y][location.z].cell.lockdown = 1; > grid[location.x][location.y][location.z].cell.movedyet = true; > grid[x][y][z].cell.next_state = KCELL_BOUND; > grid[x][y][z].cell.displaybig = 1; // *** > } 700c790 < } else if ((timeindex % HOUR) == 0) { --- > } else if (((timeindex - grid[x][y][z].cell.birth_time) % HOUR) == 0) { 703,707c793,799 < float pMHC_decay = pow((float)(exp(log(0.5) / (30.0f * pMHC_HALFLIFE))), (float)15.0f); < grid[x][y][z].cell.priming_history += (grid[location.x][location.y][location.z].cell.pMHC / pMHC_decay); < if (grid[x][y][z].cell.priming_history > PRIMING_THRESHOLD_VALUE || < grid[location.x][location.y][location.z].cell.pMHC < UNBINDING_THRESHOLD || < (timeindex - grid[x][y][z].cell.dc_bound_time) > CD8_MAX_BINDING_TIME) { --- > //float pMHC_decay = pow((float)(exp(log(0.5) / (30.0f * pMHC_HALFLIFE))), (float)15.0f); > //grid[x][y][z].cell.priming_history += (grid[location.x][location.y][location.z].cell.pMHC / pMHC_decay); > //if (grid[x][y][z].cell.priming_history > PRIMING_THRESHOLD_VALUE || > // grid[location.x][location.y][location.z].cell.pMHC < UNBINDING_THRESHOLD || > // (timeindex - grid[x][y][z].cell.dc_bound_time) > CD8_MAX_BINDING_TIME) { > if (grid[location.x][location.y][location.z].cell.pMHC < grid[x][y][z].cell.dc_unbind_pMHC || > timeindex >= grid[x][y][z].cell.dc_unbind_time) { 709,721c801,816 < float priming_probability = 90.0f;//100.0f / (exp(-(grid[x][y][z].cell.priming_history / UNBINDING_THRESHOLD - CD8_TIME_FOR_MEDIAN_PRIMING_PROB)/CD8_SHAPE_PRIMING_PROB_CURVE)); < if (rnd.getfloat() * 100.0f <= priming_probability) { < grid[x][y][z].cell.birth_time = timeindex; < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_AGE, 15 * DAY); < // grid[x][y][z].cell.dc_bound = false; < grid[x][y][z].cell.next_state = KCELL_ACTIVE; < grid[x][y][z].cell.displaybig = 1; // *** < grid[x][y][z].cell.division_counter = 0; < } else { < grid[x][y][z].cell.next_state = KCELL_RESTING; < grid[x][y][z].cell.hide_time = timeindex + HOUR; < grid[x][y][z].cell.priming_history = 0.0f; < } --- > float cp = CD8_TIME_FOR_MEDIAN_PRIMING_PROB; > float dp = CD8_SHAPE_PRIMING_PROB_CURVE; > float xp = grid[location.x][location.y][location.z].cell.pMHC * (timeindex - grid[x][y][z].cell.dc_bound_time); > float priming_probability = 100.0f/(1+exp(-1*(xp-cp)/dp)); //90.0f;//100.0f / (exp(-(grid[x][y][z].cell.priming_history / UNBINDING_THRESHOLD - CD8_TIME_FOR_MEDIAN_PRIMING_PROB)/CD8_SHAPE_PRIMING_PROB_CURVE)); > if (rnd.getfloat() * 100.0f <= priming_probability) { > grid[x][y][z].cell.birth_time = timeindex; > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_AGE, CD8_MAX_AGE_STD); > // grid[x][y][z].cell.dc_bound = false; > grid[x][y][z].cell.displaybig = 1; // *** > grid[x][y][z].cell.next_state = KCELL_ACTIVE; > grid[x][y][z].cell.division_counter = 0; > } else { > grid[x][y][z].cell.next_state = KCELL_RESTING; > grid[x][y][z].cell.hide_time = timeindex + HOUR; > grid[x][y][z].cell.priming_history = 0.0f; > } 734c829 < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_TIME_EFFECTOR, DAY); --- > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_TIME_EFFECTOR, CD8_MAX_TIME_EFFECTOR_STD); 741c836 < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_AGE, 15 * DAY); --- > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_AGE, CD8_MAX_AGE_STD); 747c842 < grid[location.x][location.y][location.z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_AGE, 15 * DAY); --- > grid[location.x][location.y][location.z].cell.death_time = timeindex + rnd.getnormal(CD8_MAX_AGE, CD8_MAX_AGE_STD); 748a844 > grid[location.x][location.y][location.z].cell.mfp = MFP_UNIT; 759c855 < } else if (grid[x][y][z].cell.celltype == CELL_D) { --- > } else if (grid[x][y][z].cell.celltype == CELL_D && timeindex % 12 == 0) { 760a857 > grid[x][y][z].cell.pMHC *= pMHC_DECAY_FACTOR; 766,767c863,864 < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(DC_MAX_TIME_MATURE, 5 * HOUR); < grid[x][y][z].cell.pMHC = ((BINDING_THRESHOLD) + grid[location.x][location.y][location.z].cell.pMHC / 2.0f); --- > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(DC_MAX_TIME_MATURE, DC_MAX_TIME_MATURE_STD); > grid[x][y][z].cell.pMHC += grid[location.x][location.y][location.z].cell.pMHC; //((BINDING_THRESHOLD) + grid[location.x][location.y][location.z].cell.pMHC / 2.0f); 770a868 > grid[x][y][z].cell.pMHC *= pMHC_DECAY_FACTOR; 777,778c875,876 < grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(DC_TIME_BEING_LICENSED, 4 * HOUR); < grid[x][y][z].cell.pMHC = UNBINDING_THRESHOLD + 150; --- > grid[x][y][z].cell.death_time = timeindex + rnd.getnormal(DC_TIME_BEING_LICENSED, DC_TIME_BEING_LICENSED_STD); > grid[x][y][z].cell.pMHC += 150; 783a882 > grid[x][y][z].cell.pMHC *= pMHC_DECAY_FACTOR;