From 8f7a0fccca150ab6d953d9e79f4adb47f22f8f36 Mon Sep 17 00:00:00 2001 From: Heber Lima da Rocha Date: Tue, 17 Feb 2026 11:51:45 -0500 Subject: [PATCH 1/2] Allow non-movable cells to have neighbors list and calculate simple pressure without updating velocity --- core/PhysiCell_cell_container.cpp | 2 +- core/PhysiCell_standard_models.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/PhysiCell_cell_container.cpp b/core/PhysiCell_cell_container.cpp index 0c5850b1d..a31302c1f 100644 --- a/core/PhysiCell_cell_container.cpp +++ b/core/PhysiCell_cell_container.cpp @@ -240,7 +240,7 @@ void Cell_Container::update_all_cells(double t, double phenotype_dt_ , double me for( int i=0; i < (*all_cells).size(); i++ ) { Cell* pC = (*all_cells)[i]; - if( pC->functions.update_velocity && pC->is_out_of_domain == false && pC->is_movable ) + if( pC->functions.update_velocity && pC->is_out_of_domain == false ) { pC->functions.update_velocity( pC,pC->phenotype,time_since_last_mechanics ); } } diff --git a/core/PhysiCell_standard_models.cpp b/core/PhysiCell_standard_models.cpp index d46aece70..6edb6b50b 100644 --- a/core/PhysiCell_standard_models.cpp +++ b/core/PhysiCell_standard_models.cpp @@ -645,7 +645,14 @@ void standard_update_cell_velocity( Cell* pCell, Phenotype& phenotype, double dt pCell->add_potentials(*neighbor); } } - + + // Set the velocity to zero if the cell is not movable - This allows non-movable cells have neighbors list and simple_pressure calculated, but not move. + if( pCell->is_movable == false ) + { + pCell->velocity = {0.0, 0.0, 0.0}; + return; + } + pCell->update_motility_vector(dt); pCell->velocity += phenotype.motility.motility_vector; From 6f08abdd14615b9152a44f4e16eb66f903483825 Mon Sep 17 00:00:00 2001 From: Heber Lima da Rocha Date: Fri, 8 May 2026 11:16:00 -0400 Subject: [PATCH 2/2] check is_movable in add_potential function: avoid update velocity --- core/PhysiCell_cell.cpp | 2 +- core/PhysiCell_standard_models.cpp | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/core/PhysiCell_cell.cpp b/core/PhysiCell_cell.cpp index 2755d7d5d..e91086f8b 100644 --- a/core/PhysiCell_cell.cpp +++ b/core/PhysiCell_cell.cpp @@ -1069,7 +1069,7 @@ void Cell::add_potentials(Cell* other_agent) state.neighbors.push_back(other_agent); // move here in 1.10.2 so non-adhesive cells also added. } ///////////////////////////////////////////////////////////////// - if( fabs(temp_r) < 1e-16 ) + if( fabs(temp_r) < 1e-16 || is_movable == false ) { return; } temp_r /= distance; // for( int i = 0 ; i < 3 ; i++ ) diff --git a/core/PhysiCell_standard_models.cpp b/core/PhysiCell_standard_models.cpp index 6edb6b50b..d46aece70 100644 --- a/core/PhysiCell_standard_models.cpp +++ b/core/PhysiCell_standard_models.cpp @@ -645,14 +645,7 @@ void standard_update_cell_velocity( Cell* pCell, Phenotype& phenotype, double dt pCell->add_potentials(*neighbor); } } - - // Set the velocity to zero if the cell is not movable - This allows non-movable cells have neighbors list and simple_pressure calculated, but not move. - if( pCell->is_movable == false ) - { - pCell->velocity = {0.0, 0.0, 0.0}; - return; - } - + pCell->update_motility_vector(dt); pCell->velocity += phenotype.motility.motility_vector;