From 6b0aa2bb75683c1c29e209f9207224abc2731594 Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Wed, 19 Aug 2026 11:24:55 -0400 Subject: [PATCH] Compare neighbor type against diff_type, not the running counter In stem_cell_phenotype() the neighbor-counting loop tested `pC->type == num_differentiated`, comparing the neighbor's type against the running num_differentiated counter instead of against diff_type. Because num_differentiated starts at 0, the test walked up the cell definition list as it incremented: with this sample's definitions (bacteria=0, blood vessel=1, stem=2, differentiated=3) it first counted bacteria neighbors, then blood vessel, then stem, and only then differentiated. num_differentiated feeds the stem cycling exit rate, so stem proliferation was driven by the wrong contact count. Co-Authored-By: Claude Opus 5 --- sample_projects/interactions/custom_modules/custom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample_projects/interactions/custom_modules/custom.cpp b/sample_projects/interactions/custom_modules/custom.cpp index f4c1161cb..0a0b40133 100644 --- a/sample_projects/interactions/custom_modules/custom.cpp +++ b/sample_projects/interactions/custom_modules/custom.cpp @@ -680,7 +680,7 @@ void stem_cell_phenotype( Cell* pCell, Phenotype& phenotype, double dt ) { if( pC->type == stem_type ) { num_stem++; } - if( pC->type == num_differentiated ) + if( pC->type == diff_type ) { num_differentiated++; } if( pC->type == bacteria_type ) { num_bacteria++; }