diff --git a/.github/workflows/build_binaries.yml b/.github/workflows/build_binaries.yml index 30e3c7ce4..5cec0dd7e 100644 --- a/.github/workflows/build_binaries.yml +++ b/.github/workflows/build_binaries.yml @@ -4,7 +4,7 @@ on: push: pull_request: release: - types: [created] + types: [published] jobs: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1e662879d..ca40b72f7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,6 +33,7 @@ jobs: {project: "interaction-sample", name: "PhysiCell interactions", binary: "interaction_demo", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""}, {project: "pred-prey-farmer", name: "PhysiCell prey predator", binary: "pred_prey", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""}, {project: "rules-sample", name: "PhysiCell rules sample", binary: "rules_sample", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""}, + {project: "asymmetric-division-sample", name: "PhysiCell asymmetric division", binary: "project", config: "config/PhysiCell_settings.xml", max_time: 120, output_folder: ""} ] name: Testing ${{ matrix.projects.name }} on ${{ matrix.os.name }} diff --git a/Makefile b/Makefile index 440b03cf0..76ad9b813 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ list-projects: @echo "Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample" @echo " celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample" @echo " worm-sample interaction-sample mechano-sample rules-sample physimess-sample custom-division-sample" + @echo " asymmetric-division-sample" @echo "" @echo "Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample" @echo " cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion" @@ -197,15 +198,23 @@ physimess-sample: cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml cp -r ./sample_projects/physimess/config/* ./config/ - custom-division-sample: - cp ./sample_projects/custom_division/custom_modules/* ./custom_modules/ + cp -r ./sample_projects/custom_division/custom_modules/* ./custom_modules/ touch main.cpp && cp main.cpp main-backup.cpp cp ./sample_projects/custom_division/main.cpp ./main.cpp cp Makefile Makefile-backup cp ./sample_projects/custom_division/Makefile . cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml - cp ./sample_projects/custom_division/config/* ./config/ + cp -r ./sample_projects/custom_division/config/* ./config/ + +asymmetric-division-sample: + cp -r ./sample_projects/asymmetric_division/custom_modules/* ./custom_modules/ + touch main.cpp && cp main.cpp main-backup.cpp + cp ./sample_projects/asymmetric_division/main.cpp ./main.cpp + cp Makefile Makefile-backup + cp ./sample_projects/asymmetric_division/Makefile . + cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml + cp -r ./sample_projects/asymmetric_division/config/* ./config/ # ---- intracellular projects ode-energy-sample: diff --git a/addons/PhysiMeSS/PhysiMeSS.cpp b/addons/PhysiMeSS/PhysiMeSS.cpp index da010c21d..0201c9b56 100644 --- a/addons/PhysiMeSS/PhysiMeSS.cpp +++ b/addons/PhysiMeSS/PhysiMeSS.cpp @@ -134,8 +134,7 @@ void physimess_update_cell_velocity( Cell* pCell, Phenotype& phenotype, double d void physimess_mechanics( double dt ) { - static double dt_tolerance = 0.001 * dt; - if(fabs(((PhysiCell_globals.current_time - last_update_time)) - dt) < dt_tolerance) + if ( PhysiCell_globals.current_time >= last_update_time + dt - 0.5 * diffusion_dt) // last_update_time + dt = next update time; - 0.5 * diffusion_dt will give the time step closest to the desired next time (assumign diffusion_dt is the smallest time step) { last_update_time = PhysiCell_globals.current_time; diff --git a/beta/download_binary.py b/beta/download_binary.py index ca6aadb8f..0194dac6a 100644 --- a/beta/download_binary.py +++ b/beta/download_binary.py @@ -12,10 +12,10 @@ import stat import shutil -physicell_version = "1.14.0" +physicell_version = "1.14.1" repo_physicell = "MathCancer/PhysiCell" physiboss_version = "v2.2.3" -repo_physiboss = "sysbio-curie/PhysiBoSS" +repo_physiboss = "PhysiBoSS/PhysiBoSS" list_models = { "physiboss-tutorial": "https://github.com/" + repo_physiboss + "/releases/download/" + physiboss_version + "/", "physiboss-tutorial-invasion": "https://github.com/" + repo_physiboss + "/releases/download/" + physiboss_version + "/", diff --git a/core/PhysiCell_cell.cpp b/core/PhysiCell_cell.cpp index f96cf789c..5ec235bfd 100644 --- a/core/PhysiCell_cell.cpp +++ b/core/PhysiCell_cell.cpp @@ -173,6 +173,7 @@ Cell_Definition::Cell_Definition() // are appropriately sized. Same on motiltiy. phenotype.cell_interactions.sync_to_cell_definitions(); phenotype.cell_transformations.sync_to_cell_definitions(); + phenotype.cycle.asymmetric_division.sync_to_cell_definitions(); phenotype.motility.sync_to_current_microenvironment(); phenotype.mechanics.sync_to_cell_definitions(); @@ -654,8 +655,8 @@ Cell* Cell::divide( ) // child->phenotype.integrity.damage = 0.0; // leave alone - damage is heritable child->state.total_attack_time = 0.0; - if( this->functions.cell_division_function ) - { this->functions.cell_division_function( this, child); } + if( this->functions.cell_division_function ) + { this->functions.cell_division_function( this, child); } return child; } @@ -1341,7 +1342,6 @@ void Cell::ingest_cell( Cell* pCell_to_eat ) pCell_to_eat->functions.update_phenotype = NULL; pCell_to_eat->functions.contact_function = NULL; pCell_to_eat->functions.cell_division_function = NULL; - // should set volume fuction to NULL too! pCell_to_eat->functions.volume_update_function = NULL; @@ -1794,7 +1794,7 @@ void display_cell_definitions( std::ostream& os ) os << std::endl; os << "\t\t contact function: "; display_ptr_as_bool( pCF->contact_function , std::cout ); os << std::endl; - os << "\t\t cell division function: "; display_ptr_as_bool( pCF->cell_division_function , std::cout ); + os << "\t\t cell division function: "; display_ptr_as_bool( pCF->cell_division_function , std::cout ); os << std::endl; // summarize motility @@ -2032,6 +2032,9 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node // transformation pCD->phenotype.cell_transformations.transformation_rates.assign(number_of_cell_defs,0.0); + + // asymmetric division + pCD->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.assign(number_of_cell_defs,0.0); } else { @@ -2070,6 +2073,7 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node // this requires that prebuild_cell_definition_index_maps was already run pCD->phenotype.cell_interactions.sync_to_cell_definitions(); pCD->phenotype.cell_transformations.sync_to_cell_definitions(); + pCD->phenotype.cycle.asymmetric_division.sync_to_cell_definitions(); pCD->phenotype.mechanics.sync_to_cell_definitions(); // set the reference phenotype @@ -2218,11 +2222,49 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node node = node.next_sibling( "duration" ); } - } - - + node = cd_node.child( "phenotype" ); + node = node.child( "cycle" ); + node = node.child( "standard_asymmetric_division" ); + if( node && node.attribute("enabled").as_bool() ) + { + Asymmetric_Division *pAD = &(pCD->phenotype.cycle.asymmetric_division); + + // asymmetric division rates + pugi::xml_node node_adp = node.child( "asymmetric_division_probability"); + while (node_adp) + { + // get the name of the target cell type + std::string target_name = node_adp.attribute("name").value(); + // now find its index + auto search = cell_definition_indices_by_name.find(target_name); + // safety first! + if( search != cell_definition_indices_by_name.end() ) + { + // if the target is found, set the appropriate rate + int target_index = search->second; + + double asymmetric_division_probability = xml_get_my_double_value(node_adp); + pAD->asymmetric_division_probabilities[target_index] = asymmetric_division_probability; + } + else + { + std::cout << "Error: When processing the " << pCD->name << " cell definition: " << std::endl + << "\tCould not find cell type " << target_name << " for asymmetric division." << std::endl + << "\tRemove this cell type from the asymmetric division probabilities!" << std::endl << std::endl; + exit(-1); + } + node_adp = node_adp.next_sibling("asymmetric_division_probability"); + } + std::cout << "Asymmetric division probabilities for " << pCD->name << ": "; + for (int i = 0; i < pAD->asymmetric_division_probabilities.size(); i++) + { + std::cout << pAD->asymmetric_division_probabilities[i] << " "; + } + std::cout << std::endl; + pCD->functions.cell_division_function = standard_asymmetric_division_function; + } } // here's what it ***should*** do: @@ -2438,45 +2480,11 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node node = node.next_sibling( "duration" ); } - -/* - if( node.child( "phase_durations" ) ) - { node = node.child( "phase_durations" ); } - if( node ) - { - node = node.child( "duration"); - while( node ) - { - // which duration? - int start = node.attribute("index").as_int(); - // fixed duration? - bool fixed = false; - if( node.attribute( "fixed_duration" ) ) - { fixed = node.attribute("fixed_duration").as_bool(); } - // actual value of the duration - double value = xml_get_my_double_value( node ); - - // set the transition rate - pCD->phenotype.cycle.data.exit_rate(start) = 1.0 / (value+1e-16); - // set it to fixed / non-fixed - pCD->phenotype.cycle.model().phase_links[start][0].fixed_duration = fixed; - - node = node.next_sibling( "duration" ); - } - - } - -*/ - - node = node.parent(); // phase_durations node = node.parent(); // model } - // node = node.parent(); - model_node = model_node.next_sibling( "model" ); -// death_model_index++; } } @@ -2821,7 +2829,7 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node } std::cout << std::endl; } - } + } // secretion @@ -2972,6 +2980,10 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node pugi::xml_node node_dr = node.child("attack_damage_rate"); pCI->attack_damage_rate = xml_get_my_double_value(node_dr); + // attack_duration + pugi::xml_node node_ad = node.child("attack_duration"); + pCI->attack_duration = xml_get_my_double_value(node_ad); + // fusion_rates pugi::xml_node node_fr = node.child( "fusion_rates"); if( node_fr ) @@ -3063,7 +3075,9 @@ Cell_Definition* initialize_cell_definition_from_pugixml( pugi::xml_node cd_node { pCI->damage_repair_rate = xml_get_my_double_value( node_drr ); } } - // intracellular + node = cd_node.child( "phenotype" ); + + // intracellular node = cd_node.child( "phenotype" ); node = node.child( "intracellular" ); if( node ) diff --git a/core/PhysiCell_cell.h b/core/PhysiCell_cell.h index 41342b4f3..573d93704 100644 --- a/core/PhysiCell_cell.h +++ b/core/PhysiCell_cell.h @@ -188,7 +188,7 @@ class Cell : public Basic_Agent bool is_out_of_domain; bool is_movable; - + void flag_for_division( void ); // done void flag_for_removal( void ); // done diff --git a/core/PhysiCell_cell_container.cpp b/core/PhysiCell_cell_container.cpp index dcb046c72..17851a5ea 100644 --- a/core/PhysiCell_cell_container.cpp +++ b/core/PhysiCell_cell_container.cpp @@ -159,7 +159,7 @@ void Cell_Container::update_all_cells(double t, double phenotype_dt_ , double me } } - if( fabs(time_since_last_cycle-phenotype_dt_ ) < phenotype_dt_tolerance || !initialzed) + if( time_since_last_cycle > phenotype_dt_ - 0.5 * diffusion_dt_ || !initialzed ) { // Reset the max_radius in each voxel. It will be filled in set_total_volume // It might be better if we calculate it before mechanics each time @@ -201,7 +201,7 @@ void Cell_Container::update_all_cells(double t, double phenotype_dt_ , double me double time_since_last_mechanics= t- last_mechanics_time; // if( time_since_last_mechanics>= mechanics_dt || !initialzed) - if( fabs(time_since_last_mechanics - mechanics_dt_) < mechanics_dt_tolerance || !initialzed) + if( time_since_last_mechanics > mechanics_dt_ - 0.5 * diffusion_dt_ || !initialzed ) { if(!initialzed) { diff --git a/core/PhysiCell_phenotype.cpp b/core/PhysiCell_phenotype.cpp index 806eed512..a19d4d4cc 100644 --- a/core/PhysiCell_phenotype.cpp +++ b/core/PhysiCell_phenotype.cpp @@ -1358,6 +1358,38 @@ double& Cell_Transformations::transformation_rate( std::string type_name ) return transformation_rates[n]; } +Asymmetric_Division::Asymmetric_Division() +{ + asymmetric_division_probabilities = {0.0}; +} + +void Asymmetric_Division::sync_to_cell_definitions() +{ + extern std::unordered_map cell_definition_indices_by_name; + int number_of_cell_defs = cell_definition_indices_by_name.size(); + + if( asymmetric_division_probabilities.size() != number_of_cell_defs ) + { asymmetric_division_probabilities.resize( number_of_cell_defs, 0.0); } + + return; +} + +double Asymmetric_Division::probabilities_total( void ) +{ + double total = 0.0; + for( int i=0; i < asymmetric_division_probabilities.size(); i++ ) + { total += asymmetric_division_probabilities[i]; } + return total; +} + +// ease of access +double& Asymmetric_Division::asymmetric_division_probability( std::string type_name ) +{ + extern std::unordered_map cell_definition_indices_by_name; + int n = cell_definition_indices_by_name[type_name]; + return asymmetric_division_probabilities[n]; +} + // beta functionality in 1.10.3 Cell_Integrity::Cell_Integrity() { diff --git a/core/PhysiCell_phenotype.h b/core/PhysiCell_phenotype.h index ebbd39843..c69b19400 100644 --- a/core/PhysiCell_phenotype.h +++ b/core/PhysiCell_phenotype.h @@ -213,6 +213,23 @@ class Cycle_Model std::ostream& display( std::ostream& os ); // done }; +class Asymmetric_Division +{ +private: +public: + // rates of asymmetric division into different cell types + std::vector asymmetric_division_probabilities; + + // initialization + Asymmetric_Division(); // done + void sync_to_cell_definitions(); // done + + double probabilities_total(); + + // ease of access + double& asymmetric_division_probability( std::string type_name ); // done +}; + class Cycle { private: @@ -230,6 +247,8 @@ class Cycle int& current_phase_index( void ); // done void sync_to_cycle_model( Cycle_Model& cm ); // done + + Asymmetric_Division asymmetric_division; }; class Death_Parameters diff --git a/core/PhysiCell_signal_behavior.cpp b/core/PhysiCell_signal_behavior.cpp index ff342fea0..f286273d6 100644 --- a/core/PhysiCell_signal_behavior.cpp +++ b/core/PhysiCell_signal_behavior.cpp @@ -527,6 +527,16 @@ void setup_signal_behavior_dictionaries( void ) behavior_to_int[temp] = map_index; } + // asymmetic division + for( int i=0; i < n ; i++ ) + { + map_index++; + Cell_Definition* pCD = cell_definitions_by_type[i]; + std::string temp = "asymmetric division to " + pCD->name; + behavior_to_int[temp] = map_index; + int_to_behavior[map_index] = temp; + } + // custom behaviors for( int nc=0 ; nc < cell_defaults.custom_data.variables.size() ; nc++ ) { @@ -1372,6 +1382,12 @@ void set_behaviors( Cell* pCell , std::vector parameters ) parameters.begin()+first_transformation_index+n , pCell->phenotype.cell_transformations.transformation_rates.begin() ); + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + std::copy( parameters.begin()+first_asymmetric_division_index , + parameters.begin()+first_asymmetric_division_index+n , + pCell->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.begin() ); + // custom behaviors static int first_custom_ind = find_behavior_index( "custom 0"); if( first_custom_ind >= 0 ) @@ -1574,6 +1590,11 @@ void set_single_behavior( Cell* pCell, int index , double parameter ) if( index >= first_transformation_index && index < first_transformation_index + n ) { pCell->phenotype.cell_transformations.transformation_rates[index-first_transformation_index] = parameter; return; } + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + if( index >= first_asymmetric_division_index && index < first_asymmetric_division_index + n ) + { pCell->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[index-first_asymmetric_division_index] = parameter; return; } + // custom behavior static int first_custom_ind = find_behavior_index( "custom 0"); static int max_custom_ind = first_custom_ind + pCell->custom_data.variables.size(); @@ -1781,6 +1802,12 @@ std::vector get_behaviors( Cell* pCell ) pCell->phenotype.cell_transformations.transformation_rates.end(), parameters.begin()+first_transformation_index ); + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + std::copy( pCell->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.begin(), + pCell->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.end(), + parameters.begin()+first_asymmetric_division_index ); + // custom behavior static int first_custom_ind = find_behavior_index( "custom 0"); static int max_custom_ind = first_custom_ind + pCell->custom_data.variables.size(); @@ -1989,6 +2016,11 @@ double get_single_behavior( Cell* pCell , int index ) if( index >= first_transformation_index && index < first_transformation_index+n ) { return pCell->phenotype.cell_transformations.transformation_rates[index-first_transformation_index]; } + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + if( index >= first_asymmetric_division_index && index < first_asymmetric_division_index+n ) + { return pCell->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[index-first_asymmetric_division_index]; } + // custom behavior static int first_custom_ind = find_behavior_index( "custom 0"); static int max_custom_ind = first_custom_ind + pCell->custom_data.variables.size(); @@ -2226,6 +2258,12 @@ std::vector get_base_behaviors( Cell* pCell ) pCD->phenotype.cell_transformations.transformation_rates.end(), parameters.begin()+first_transformation_index ); + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + std::copy( pCD->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.begin(), + pCD->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.end(), + parameters.begin()+first_asymmetric_division_index ); + // custom behavior static int first_custom_ind = find_behavior_index( "custom 0"); static int max_custom_ind = first_custom_ind + pCell->custom_data.variables.size(); @@ -2437,6 +2475,11 @@ double get_single_base_behavior( Cell* pCell , int index ) if( index >= first_transformation_index && index < first_transformation_index + n ) { return pCD->phenotype.cell_transformations.transformation_rates[index-first_transformation_index]; } + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + if( index >= first_asymmetric_division_index && index < first_asymmetric_division_index + n ) + { return pCD->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[index-first_asymmetric_division_index]; } + // custom behavior static int first_custom_ind = find_behavior_index( "custom 0"); static int max_custom_ind = first_custom_ind + pCell->custom_data.variables.size(); @@ -2654,6 +2697,11 @@ double get_single_base_behavior( Cell_Definition* pCD , int index ) if( index >= first_transformation_index && index < first_transformation_index + n ) { return pCD->phenotype.cell_transformations.transformation_rates[index-first_transformation_index]; } + // asymmetric division + static int first_asymmetric_division_index = find_behavior_index( "asymmetric division to " + cell_definitions_by_type[0]->name ); + if( index >= first_asymmetric_division_index && index < first_asymmetric_division_index + n ) + { return pCD->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[index-first_asymmetric_division_index]; } + // custom behavior static int first_custom_ind = find_behavior_index( "custom 0"); static int max_custom_ind = first_custom_ind + pCD->custom_data.variables.size(); diff --git a/core/PhysiCell_standard_models.cpp b/core/PhysiCell_standard_models.cpp index d2d0a33c4..2a38d3bb9 100644 --- a/core/PhysiCell_standard_models.cpp +++ b/core/PhysiCell_standard_models.cpp @@ -779,6 +779,7 @@ void initialize_default_cell_definition( void ) // these for the cell_defaults cell_defaults.phenotype.cell_interactions.sync_to_cell_definitions(); cell_defaults.phenotype.cell_transformations.sync_to_cell_definitions(); + cell_defaults.phenotype.cycle.asymmetric_division.sync_to_cell_definitions(); cell_defaults.phenotype.motility.sync_to_current_microenvironment(); cell_defaults.phenotype.mechanics.sync_to_cell_definitions(); @@ -1369,9 +1370,55 @@ void standard_cell_transformations( Cell* pCell, Phenotype& phenotype, double dt return; } } - + } +void standard_asymmetric_division_function( Cell* pCell_parent, Cell* pCell_daughter ) +{ + Cell_Definition* pCD_parent = cell_definitions_by_name[pCell_parent->type_name]; + double total = pCell_parent->phenotype.cycle.asymmetric_division.probabilities_total(); + if (total > 1.0) + { + double sym_div_prob = pCell_parent->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[pCell_parent->type] + 1.0 - total; + if (sym_div_prob < 0.0) + { + throw std::runtime_error("Error: Asymmetric division probabilities for " + pCD_parent->name + " sum to greater than 1.0 and cannot be normalized."); + } + pCell_parent->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[pCell_parent->type] = sym_div_prob; + pCell_daughter->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[pCell_daughter->type] = sym_div_prob; + } + double r = UniformRandom(); + for( int i=0; i < pCD_parent->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.size(); i++ ) + { + if( r <= pCell_parent->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[i] ) + { + if (i != pCell_daughter->type) // only convert if the daughter is not already the correct type + { pCell_daughter->convert_to_cell_definition( *cell_definitions_by_index[i] ); } + return; + } + r -= pCell_parent->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities[i]; + } + // if we're here, then do not do asym div + return; +} + +// alternative way to select the index from weights that could be faster (is faster as # cell types --> infinity) +// int select_by_probabilities( const std::vector& probabilities ) +// { +// double r = UniformRandom(); + +// std::vector cumulative_weights(probabilities.size()); +// std::partial_sum(probabilities.begin(), probabilities.end(), cumulative_weights.begin()); + +// // Use binary search to find the index +// auto it = std::upper_bound(cumulative_weights.begin(), cumulative_weights.end(), r); +// int index = std::distance(cumulative_weights.begin(), it); +// if (index >= probabilities.size()) +// { return -1; } + +// return index; +// } + void dynamic_attachments( Cell* pCell , Phenotype& phenotype, double dt ) { // check for detachments diff --git a/core/PhysiCell_standard_models.h b/core/PhysiCell_standard_models.h index 5fedd182e..525c28204 100644 --- a/core/PhysiCell_standard_models.h +++ b/core/PhysiCell_standard_models.h @@ -143,6 +143,7 @@ void evaluate_interactions( Cell* pCell, Phenotype& phenotype, double dt ); // automated cell phagocytosis, attack, and fusion void standard_cell_cell_interactions( Cell* pCell, Phenotype& phenotype, double dt ); void standard_cell_transformations( Cell* pCell, Phenotype& phenotype, double dt ); +void standard_asymmetric_division_function( Cell* pCell_parent, Cell* pCell_daughter ); void advanced_chemotaxis_function_normalized( Cell* pCell, Phenotype& phenotype , double dt ); void advanced_chemotaxis_function( Cell* pCell, Phenotype& phenotype , double dt ); diff --git a/examples/PhysiCell_test_DCIS.cpp b/examples/PhysiCell_test_DCIS.cpp index 3aa571941..41b2273ae 100644 --- a/examples/PhysiCell_test_DCIS.cpp +++ b/examples/PhysiCell_test_DCIS.cpp @@ -311,7 +311,7 @@ int main( int argc, char* argv[] ) { while( t < t_max ) { - if( fabs( t - t_next_output_time ) < 0.0001 ) + if( t > t_next_output_time - 0.5 * dt ) { log_output(t, output_index, microenvironment, report_file); t_next_output_time += t_output_interval; diff --git a/examples/PhysiCell_test_HDS.cpp b/examples/PhysiCell_test_HDS.cpp index b56fd69f6..a8a1a6aea 100644 --- a/examples/PhysiCell_test_HDS.cpp +++ b/examples/PhysiCell_test_HDS.cpp @@ -276,7 +276,7 @@ for(int i=0;i t_next_output_time - 0.5 * dt ) { log_output(t, output_index, microenvironment, report_file); t_next_output_time += t_output_interval; diff --git a/examples/PhysiCell_test_cell_cycle.cpp b/examples/PhysiCell_test_cell_cycle.cpp index f00a024f5..00162e4af 100644 --- a/examples/PhysiCell_test_cell_cycle.cpp +++ b/examples/PhysiCell_test_cell_cycle.cpp @@ -272,7 +272,7 @@ int main( int argc, char* argv[] ) { while( t < t_max ) { - if( fabs( t - t_next_output_time ) < 0.0001 ) + if( t > t_next_output_time - 0.5 * dt ) { write_test_report(*all_cells,t); t_next_output_time += t_output_interval; diff --git a/examples/PhysiCell_test_mechanics_1.cpp b/examples/PhysiCell_test_mechanics_1.cpp index 3dad283b5..76a74a10f 100644 --- a/examples/PhysiCell_test_mechanics_1.cpp +++ b/examples/PhysiCell_test_mechanics_1.cpp @@ -209,7 +209,7 @@ int main( int argc, char* argv[] ) while( t < t_max ) { - if( fabs( t - t_next_output_time ) < dt/10.0 ) + if( t > t_next_output_time - 0.5 * dt ) { report_file<position,pCell2->position)<<"\n"; t_next_output_time += t_output_interval; diff --git a/examples/PhysiCell_test_mechanics_2.cpp b/examples/PhysiCell_test_mechanics_2.cpp index ef0bd25cc..3279fdf55 100644 --- a/examples/PhysiCell_test_mechanics_2.cpp +++ b/examples/PhysiCell_test_mechanics_2.cpp @@ -208,8 +208,7 @@ int main( int argc, char* argv[] ) { while( t < t_max ) { - // std::cout<<"time: "< t_next_output_time - 0.5 * dt ) { std::cout<<"time: "< t_next_output_time - 0.5 * dt ) { vol_report<get_total_volume()<<"\t"<phenotype.volume.fluid<<"\t"<phenotype.volume.nuclear_solid<<"\t"<phenotype.volume.cytoplasmic_solid<<"\n"; t_next_output_time += t_output_interval; diff --git a/modules/PhysiCell_MultiCellDS.cpp b/modules/PhysiCell_MultiCellDS.cpp index 30e29ce01..9fdc8d448 100644 --- a/modules/PhysiCell_MultiCellDS.cpp +++ b/modules/PhysiCell_MultiCellDS.cpp @@ -567,6 +567,11 @@ void add_PhysiCell_cells_to_open_xml_pugi_v2( pugi::xml_document& xml_dom, std:: add_variable_to_labels( data_names,data_units,data_start_indices,data_sizes, "transformation_rates" , "1/min" , n ); + // asymmetric division + // std::vector asymmetric_division_probabilities; // n + add_variable_to_labels( data_names, data_units, data_start_indices, data_sizes, + "asymmetric_division_probabilities" , "none" , n ); + // cell integrity // double damage; @@ -976,6 +981,10 @@ void add_PhysiCell_cells_to_open_xml_pugi_v2( pugi::xml_document& xml_dom, std:: // name = "transformation_rates"; std::fwrite( pCell->phenotype.cell_transformations.transformation_rates.data() , sizeof(double) , n , fp ); +// asymmetric division + // name = "asymmetric_division_rate"; + std::fwrite( pCell->phenotype.cycle.asymmetric_division.asymmetric_division_probabilities.data() , sizeof(double) , n, fp ); + // cell integrity // name = "damage"; std::fwrite( &( pCell->phenotype.cell_integrity.damage ) , sizeof(double) , 1 , fp ); diff --git a/sample_projects/Makefile-default b/sample_projects/Makefile-default index 440b03cf0..76ad9b813 100644 --- a/sample_projects/Makefile-default +++ b/sample_projects/Makefile-default @@ -74,6 +74,7 @@ list-projects: @echo "Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample" @echo " celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample" @echo " worm-sample interaction-sample mechano-sample rules-sample physimess-sample custom-division-sample" + @echo " asymmetric-division-sample" @echo "" @echo "Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample" @echo " cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion" @@ -197,15 +198,23 @@ physimess-sample: cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml cp -r ./sample_projects/physimess/config/* ./config/ - custom-division-sample: - cp ./sample_projects/custom_division/custom_modules/* ./custom_modules/ + cp -r ./sample_projects/custom_division/custom_modules/* ./custom_modules/ touch main.cpp && cp main.cpp main-backup.cpp cp ./sample_projects/custom_division/main.cpp ./main.cpp cp Makefile Makefile-backup cp ./sample_projects/custom_division/Makefile . cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml - cp ./sample_projects/custom_division/config/* ./config/ + cp -r ./sample_projects/custom_division/config/* ./config/ + +asymmetric-division-sample: + cp -r ./sample_projects/asymmetric_division/custom_modules/* ./custom_modules/ + touch main.cpp && cp main.cpp main-backup.cpp + cp ./sample_projects/asymmetric_division/main.cpp ./main.cpp + cp Makefile Makefile-backup + cp ./sample_projects/asymmetric_division/Makefile . + cp ./config/PhysiCell_settings.xml ./config/PhysiCell_settings-backup.xml + cp -r ./sample_projects/asymmetric_division/config/* ./config/ # ---- intracellular projects ode-energy-sample: diff --git a/sample_projects/asymmetric_division/Makefile b/sample_projects/asymmetric_division/Makefile new file mode 100644 index 000000000..6682b5c46 --- /dev/null +++ b/sample_projects/asymmetric_division/Makefile @@ -0,0 +1,314 @@ +VERSION := $(shell grep . VERSION.txt | cut -f1 -d:) +PROGRAM_NAME := project + +CC := g++ +# CC := g++-mp-7 # typical macports compiler name +# CC := g++-7 # typical homebrew compiler name + +# Check for environment definitions of compiler +# e.g., on CC = g++-7 on OSX +ifdef PHYSICELL_CPP + CC := $(PHYSICELL_CPP) +endif + +ARCH := native # best auto-tuning +# ARCH := core2 # a reasonably safe default for most CPUs since 2007 +# ARCH := corei7 +# ARCH := corei7-avx # earlier i7 +# ARCH := core-avx-i # i7 ivy bridge or newer +# ARCH := core-avx2 # i7 with Haswell or newer +# ARCH := nehalem +# ARCH := westmere +# ARCH := sandybridge # circa 2011 +# ARCH := ivybridge # circa 2012 +# ARCH := haswell # circa 2013 +# ARCH := broadwell # circa 2014 +# ARCH := skylake # circa 2015 +# ARCH := bonnell +# ARCH := silvermont +# ARCH := skylake-avx512 +# ARCH := nocona #64-bit pentium 4 or later + +# CFLAGS := -march=$(ARCH) -Ofast -s -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 +CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 + +ifeq ($(OS),Windows_NT) +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + UNAME_P := $(shell uname -p) + var := $(shell which $(CC) | xargs file) + ifeq ($(lastword $(var)),arm64) + CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -fopenmp -m64 -std=c++11 + endif + endif +endif + +COMPILE_COMMAND := $(CC) $(CFLAGS) + +BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ +BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o + +PhysiCell_core_OBJECTS := PhysiCell_phenotype.o PhysiCell_cell_container.o PhysiCell_standard_models.o \ +PhysiCell_cell.o PhysiCell_custom.o PhysiCell_utilities.o PhysiCell_constants.o PhysiCell_basic_signaling.o \ +PhysiCell_signal_behavior.o PhysiCell_rules.o + +PhysiCell_module_OBJECTS := PhysiCell_SVG.o PhysiCell_pathology.o PhysiCell_MultiCellDS.o PhysiCell_various_outputs.o \ +PhysiCell_pugixml.o PhysiCell_settings.o PhysiCell_geometry.o + +# put your custom objects here (they should be in the custom_modules directory) + +PhysiCell_custom_module_OBJECTS := custom.o + +pugixml_OBJECTS := pugixml.o + +PhysiCell_OBJECTS := $(BioFVM_OBJECTS) $(pugixml_OBJECTS) $(PhysiCell_core_OBJECTS) $(PhysiCell_module_OBJECTS) +ALL_OBJECTS := $(PhysiCell_OBJECTS) $(PhysiCell_custom_module_OBJECTS) + +# compile the project + +all: main.cpp $(ALL_OBJECTS) + $(COMPILE_COMMAND) -o $(PROGRAM_NAME) $(ALL_OBJECTS) main.cpp + make name + +name: + @echo "" + @echo "Executable name is" $(PROGRAM_NAME) + @echo "" + +# PhysiCell core components + +PhysiCell_phenotype.o: ./core/PhysiCell_phenotype.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_phenotype.cpp + +PhysiCell_digital_cell_line.o: ./core/PhysiCell_digital_cell_line.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_digital_cell_line.cpp + +PhysiCell_cell.o: ./core/PhysiCell_cell.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_cell.cpp + +PhysiCell_cell_container.o: ./core/PhysiCell_cell_container.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_cell_container.cpp + +PhysiCell_standard_models.o: ./core/PhysiCell_standard_models.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_standard_models.cpp + +PhysiCell_utilities.o: ./core/PhysiCell_utilities.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_utilities.cpp + +PhysiCell_custom.o: ./core/PhysiCell_custom.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_custom.cpp + +PhysiCell_constants.o: ./core/PhysiCell_constants.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_constants.cpp + +PhysiCell_signal_behavior.o: ./core/PhysiCell_signal_behavior.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_signal_behavior.cpp + +PhysiCell_rules.o: ./core/PhysiCell_rules.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_rules.cpp + +# BioFVM core components (needed by PhysiCell) + +BioFVM_vector.o: ./BioFVM/BioFVM_vector.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_vector.cpp + +BioFVM_agent_container.o: ./BioFVM/BioFVM_agent_container.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_agent_container.cpp + +BioFVM_mesh.o: ./BioFVM/BioFVM_mesh.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_mesh.cpp + +BioFVM_microenvironment.o: ./BioFVM/BioFVM_microenvironment.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_microenvironment.cpp + +BioFVM_solvers.o: ./BioFVM/BioFVM_solvers.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_solvers.cpp + +BioFVM_utilities.o: ./BioFVM/BioFVM_utilities.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_utilities.cpp + +BioFVM_basic_agent.o: ./BioFVM/BioFVM_basic_agent.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_basic_agent.cpp + +BioFVM_matlab.o: ./BioFVM/BioFVM_matlab.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_matlab.cpp + +BioFVM_MultiCellDS.o: ./BioFVM/BioFVM_MultiCellDS.cpp + $(COMPILE_COMMAND) -c ./BioFVM/BioFVM_MultiCellDS.cpp + +pugixml.o: ./BioFVM/pugixml.cpp + $(COMPILE_COMMAND) -c ./BioFVM/pugixml.cpp + +# standard PhysiCell modules + +PhysiCell_SVG.o: ./modules/PhysiCell_SVG.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_SVG.cpp + +PhysiCell_pathology.o: ./modules/PhysiCell_pathology.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_pathology.cpp + +PhysiCell_MultiCellDS.o: ./modules/PhysiCell_MultiCellDS.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_MultiCellDS.cpp + +PhysiCell_various_outputs.o: ./modules/PhysiCell_various_outputs.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_various_outputs.cpp + +PhysiCell_pugixml.o: ./modules/PhysiCell_pugixml.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_pugixml.cpp + +PhysiCell_settings.o: ./modules/PhysiCell_settings.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_settings.cpp + +PhysiCell_basic_signaling.o: ./core/PhysiCell_basic_signaling.cpp + $(COMPILE_COMMAND) -c ./core/PhysiCell_basic_signaling.cpp + +PhysiCell_geometry.o: ./modules/PhysiCell_geometry.cpp + $(COMPILE_COMMAND) -c ./modules/PhysiCell_geometry.cpp + +# user-defined PhysiCell modules + +custom.o: ./custom_modules/custom.cpp + $(COMPILE_COMMAND) -c ./custom_modules/custom.cpp + +# cleanup + +reset: + rm -f *.cpp + cp ./sample_projects/Makefile-default Makefile + rm -f ./custom_modules/* + touch ./custom_modules/empty.txt + touch ALL_CITATIONS.txt + touch ./core/PhysiCell_cell.cpp + rm ALL_CITATIONS.txt + cp ./config/PhysiCell_settings-backup.xml ./config/PhysiCell_settings.xml + touch ./config/empty.csv + rm -f ./config/*.csv + +clean: + rm -f *.o + rm -f $(PROGRAM_NAME)* + +data-cleanup: + rm -rf ./output + mkdir ./output + touch ./output/empty.txt + +# archival + +checkpoint: + zip -r $$(date +%b_%d_%Y_%H%M).zip Makefile *.cpp *.h config/*.xml custom_modules/* + +zip: + zip -r latest.zip Makefile* *.cpp *.h BioFVM/* config/* core/* custom_modules/* matlab/* modules/* sample_projects/* + cp latest.zip $$(date +%b_%d_%Y_%H%M).zip + cp latest.zip VERSION_$(VERSION).zip + mv *.zip archives/ + +tar: + tar --ignore-failed-read -czf latest.tar Makefile* *.cpp *.h BioFVM/* config/* core/* custom_modules/* matlab/* modules/* sample_projects/* + cp latest.tar $$(date +%b_%d_%Y_%H%M).tar + cp latest.tar VERSION_$(VERSION).tar + mv *.tar archives/ + +unzip: + cp ./archives/latest.zip . + unzip latest.zip + +untar: + cp ./archives/latest.tar . + tar -xzf latest.tar + +# easier animation + +FRAMERATE := 24 +OUTPUT := output + +jpeg: + @magick identify -format "%h" $(OUTPUT)/initial.svg > __H.txt + @magick identify -format "%w" $(OUTPUT)/initial.svg > __W.txt + @expr 2 \* \( $$(grep . __H.txt) / 2 \) > __H1.txt + @expr 2 \* \( $$(grep . __W.txt) / 2 \) > __W1.txt + @echo "$$(grep . __W1.txt)!x$$(grep . __H1.txt)!" > __resize.txt + @magick mogrify -format jpg -resize $$(grep . __resize.txt) $(OUTPUT)/s*.svg + rm -f __H*.txt __W*.txt __resize.txt + +gif: + magick convert $(OUTPUT)/s*.svg $(OUTPUT)/out.gif + +movie: + ffmpeg -r $(FRAMERATE) -f image2 -i $(OUTPUT)/snapshot%08d.jpg -vcodec libx264 -pix_fmt yuv420p -strict -2 -tune animation -crf 15 -acodec none $(OUTPUT)/out.mp4 + +# upgrade rules + +SOURCE := PhysiCell_upgrade.zip +get-upgrade: + @echo $$(curl https://raw.githubusercontent.com/MathCancer/PhysiCell/master/VERSION.txt) > VER.txt + @echo https://github.com/MathCancer/PhysiCell/releases/download/$$(grep . VER.txt)/PhysiCell_V.$$(grep . VER.txt).zip > DL_FILE.txt + rm -f VER.txt + $$(curl -L $$(grep . DL_FILE.txt) --output PhysiCell_upgrade.zip) + rm -f DL_FILE.txt + +PhysiCell_upgrade.zip: + make get-upgrade + +upgrade: $(SOURCE) + unzip $(SOURCE) PhysiCell/VERSION.txt + mv -f PhysiCell/VERSION.txt . + unzip $(SOURCE) PhysiCell/core/* + cp -r PhysiCell/core/* core + unzip $(SOURCE) PhysiCell/modules/* + cp -r PhysiCell/modules/* modules + unzip $(SOURCE) PhysiCell/sample_projects/* + cp -r PhysiCell/sample_projects/* sample_projects + unzip $(SOURCE) PhysiCell/BioFVM/* + cp -r PhysiCell/BioFVM/* BioFVM + unzip $(SOURCE) PhysiCell/documentation/User_Guide.pdf + mv -f PhysiCell/documentation/User_Guide.pdf documentation + rm -f -r PhysiCell + rm -f $(SOURCE) + +# use: make save PROJ=your_project_name +PROJ := my_project + +save: + echo "Saving project as $(PROJ) ... " + mkdir -p ./user_projects + mkdir -p ./user_projects/$(PROJ) + mkdir -p ./user_projects/$(PROJ)/custom_modules + mkdir -p ./user_projects/$(PROJ)/config + cp main.cpp ./user_projects/$(PROJ) + cp Makefile ./user_projects/$(PROJ) + cp VERSION.txt ./user_projects/$(PROJ) + cp ./config/* ./user_projects/$(PROJ)/config + cp ./custom_modules/* ./user_projects/$(PROJ)/custom_modules + +load: + echo "Loading project from $(PROJ) ... " + cp ./user_projects/$(PROJ)/main.cpp . + cp ./user_projects/$(PROJ)/Makefile . + cp ./user_projects/$(PROJ)/config/* ./config/ + cp ./user_projects/$(PROJ)/custom_modules/* ./custom_modules/ + +pack: + @echo " " + @echo "Preparing project $(PROJ) for sharing ... " + @echo " " + cd ./user_projects && zip -r $(PROJ).zip $(PROJ) + @echo " " + @echo "Share ./user_projects/$(PROJ).zip ... " + @echo "Other users can unzip $(PROJ).zip in their ./user_projects, compile, and run." + @echo " " + +unpack: + @echo " " + @echo "Preparing shared project $(PROJ).zip for use ... " + @echo " " + cd ./user_projects && unzip $(PROJ).zip + @echo " " + @echo "Load this project via make load PROJ=$(PROJ) ... " + @echo " " + +list-user-projects: + @echo "user projects::" + @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' diff --git a/sample_projects/asymmetric_division/config/PhysiCell_settings.xml b/sample_projects/asymmetric_division/config/PhysiCell_settings.xml new file mode 100644 index 000000000..8f4bded17 --- /dev/null +++ b/sample_projects/asymmetric_division/config/PhysiCell_settings.xml @@ -0,0 +1,544 @@ + + + + -500 + 500 + -500 + 500 + -10 + 10 + 20 + 20 + 20 + true + + + + 1440 + min + micron + 0.01 + 0.1 + 6 + + + + 6 + + + + output + + 6 + true + + + 6 + true + + substrate + YlOrRd + 0 + 1 + + + + false + + + + + false + true + false + 0 + + + + + + 100000.0 + 10 + + 0 + 0 + + 0 + 0 + 0 + 0 + 0 + 0 + + + + true + true + + ./config/initial.mat + + + ./config/dirichlet.mat + + + + + + + + + + 1440 + + + 0.0 + 1.0 + 0.0 + + + + + 0 + + 516 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 0 + 86400 + + + 1.11667e-2 + 8.33333e-4 + 5.33333e-5 + 2.16667e-3 + 0 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0 + 0 + 2.0 + + + 0.4 + 10.0 + 1.25 + + 1 + 1.0 + 1.0 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1 + 1 + .5 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0 + 1 + 0 + 0 + + + + 0 + 0 + 0 + + 0 + 0.0 + 0.0 + + + 0 + 0.0 + 0.0 + + 1 + 0.1 + + 0 + 0.0 + 0.0 + + + + + 0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + + + + 1.0 + + + + Volume + 4 + 2 + 100000 + + + apoptosis + 1e-6 + 1e-2 + + + + + + + + 0 + + + 0.0 + 1.0 + 0.0 + + + + + 0 + + 0.001938 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 9000000000.0 + 1.15741e-05 + + + 1.11667e-02 + 8.33333e-4 + 5.33333e-05 + 2.16667e-4 + 7e-05 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0.0 + 0.0 + 2 + + + 0.4 + 10.0 + 1.25 + + 1.0 + 1.0 + 1.0 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1.0 + 1.0 + 0.0 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0.0 + 1.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 0.0 + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + 1.0 + 0.1 + + 0.0 + 0.0 + 0.0 + + + + + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + + + + 0.0 + + + + + + + + + 0 + + + 0.0 + 0.0 + 1.0 + + + + + 0 + + 0.001938 + + + 0.05 + 0 + 1.66667e-02 + 5.83333e-03 + 0 + 2.0 + + + + 0.0 + + 9e9 + 1.15741e-05 + + + 1.11667e-02 + 8.33333e-4 + 5.33333e-05 + 2.16667e-4 + 7e-05 + 2.0 + + + + + 2494 + 0.75 + 540 + 0.05 + 0.0045 + 0.0055 + 0.0 + 0.0 + 2 + + + 0.4 + 10.0 + 1.25 + + 1.0 + 1.0 + 1.0 + + + 1.8 + 15.12 + + 0.01 + 0.0 + 0.0 + 12 + + + 1.0 + 1.0 + 0.0 + + false + true + + false + substrate + 1 + + + false + false + + 0.0 + + + + + + + 0.0 + 1.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 0.0 + + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + + 1.0 + 0.1 + + 0.0 + 0.0 + 0.0 + + + + + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + + + + 0.0 + + + + + + + + + ./config + cells.csv + + + + + + + ./config + cell_rules.csv + + + + + + + 0 + 0 + + \ No newline at end of file diff --git a/sample_projects/asymmetric_division/config/cell_rules.csv b/sample_projects/asymmetric_division/config/cell_rules.csv new file mode 100644 index 000000000..13e43b73e --- /dev/null +++ b/sample_projects/asymmetric_division/config/cell_rules.csv @@ -0,0 +1,3 @@ +stem,contact with progenitor_1,decreases,asymmetric division to progenitor_1,0.0,3,4,0 +stem,contact with progenitor_1,increases,asymmetric division to progenitor_2,1.0,3,4,0 +stem,volume,increases,cycle entry,0.17,1200.0,8,0 \ No newline at end of file diff --git a/sample_projects/asymmetric_division/config/cells.csv b/sample_projects/asymmetric_division/config/cells.csv new file mode 100644 index 000000000..c967618de --- /dev/null +++ b/sample_projects/asymmetric_division/config/cells.csv @@ -0,0 +1,2 @@ +x,y,z,type +0,0,0,stem \ No newline at end of file diff --git a/sample_projects/asymmetric_division/custom_modules/custom.cpp b/sample_projects/asymmetric_division/custom_modules/custom.cpp new file mode 100644 index 000000000..8721f207d --- /dev/null +++ b/sample_projects/asymmetric_division/custom_modules/custom.cpp @@ -0,0 +1,211 @@ +/* +############################################################################### +# If you use PhysiCell in your project, please cite PhysiCell and the version # +# number, such as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# See VERSION.txt or call get_PhysiCell_version() to get the current version # +# x.y.z. Call display_citations() to get detailed information on all cite-# +# able software used in your PhysiCell application. # +# # +# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM # +# as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1], # +# with BioFVM [2] to solve the transport equations. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- # +# llelized diffusive transport solver for 3-D biological simulations, # +# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 # +# # +############################################################################### +# # +# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # +# # +# Copyright (c) 2015-2021, Paul Macklin and the PhysiCell Project # +# All rights reserved. # +# # +# Redistribution and use in source and binary forms, with or without # +# modification, are permitted provided that the following conditions are met: # +# # +# 1. Redistributions of source code must retain the above copyright notice, # +# this list of conditions and the following disclaimer. # +# # +# 2. Redistributions in binary form must reproduce the above copyright # +# notice, this list of conditions and the following disclaimer in the # +# documentation and/or other materials provided with the distribution. # +# # +# 3. Neither the name of the copyright holder nor the names of its # +# contributors may be used to endorse or promote products derived from this # +# software without specific prior written permission. # +# # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # +# POSSIBILITY OF SUCH DAMAGE. # +# # +############################################################################### +*/ + +#include "./custom.h" + +void create_cell_types( void ) +{ + // set the random seed + SeedRandom( parameters.ints("random_seed") ); + + /* + Put any modifications to default cell definition here if you + want to have "inherited" by other cell types. + + This is a good place to set default functions. + */ + + initialize_default_cell_definition(); + cell_defaults.phenotype.secretion.sync_to_microenvironment( µenvironment ); + + cell_defaults.functions.volume_update_function = standard_volume_update_function; + cell_defaults.functions.update_velocity = standard_update_cell_velocity; + + cell_defaults.functions.update_migration_bias = NULL; + cell_defaults.functions.update_phenotype = NULL; // update_cell_and_death_parameters_O2_based; + cell_defaults.functions.custom_cell_rule = NULL; + cell_defaults.functions.contact_function = NULL; + + cell_defaults.functions.add_cell_basement_membrane_interactions = NULL; + cell_defaults.functions.calculate_distance_to_membrane = NULL; + + /* + This parses the cell definitions in the XML config file. + */ + + initialize_cell_definitions_from_pugixml(); + + /* + This builds the map of cell definitions and summarizes the setup. + */ + + build_cell_definitions_maps(); + + /* + This intializes cell signal and response dictionaries + */ + + setup_signal_behavior_dictionaries(); + + /* + Cell rule definitions + */ + + setup_cell_rules(); + + /* + Put any modifications to individual cell definitions here. + + This is a good place to set custom functions. + */ + + cell_defaults.functions.update_phenotype = phenotype_function; + cell_defaults.functions.custom_cell_rule = custom_function; + cell_defaults.functions.contact_function = contact_function; + + /* + This builds the map of cell definitions and summarizes the setup. + */ + + display_cell_definitions( std::cout ); + + return; +} + +void setup_microenvironment( void ) +{ + // set domain parameters + + // put any custom code to set non-homogeneous initial conditions or + // extra Dirichlet nodes here. + + // initialize BioFVM + + initialize_microenvironment(); + + return; +} + +void setup_tissue( void ) +{ + double Xmin = microenvironment.mesh.bounding_box[0]; + double Ymin = microenvironment.mesh.bounding_box[1]; + double Zmin = microenvironment.mesh.bounding_box[2]; + + double Xmax = microenvironment.mesh.bounding_box[3]; + double Ymax = microenvironment.mesh.bounding_box[4]; + double Zmax = microenvironment.mesh.bounding_box[5]; + + if( default_microenvironment_options.simulate_2D == true ) + { + Zmin = 0.0; + Zmax = 0.0; + } + + double Xrange = Xmax - Xmin; + double Yrange = Ymax - Ymin; + double Zrange = Zmax - Zmin; + + // create some of each type of cell + + Cell* pC; + + for( int k=0; k < cell_definitions_by_index.size() ; k++ ) + { + Cell_Definition* pCD = cell_definitions_by_index[k]; + std::cout << "Placing cells of type " << pCD->name << " ... " << std::endl; + for( int n = 0 ; n < parameters.ints("number_of_cells") ; n++ ) + { + std::vector position = {0,0,0}; + position[0] = Xmin + UniformRandom()*Xrange; + position[1] = Ymin + UniformRandom()*Yrange; + position[2] = Zmin + UniformRandom()*Zrange; + + pC = create_cell( *pCD ); + pC->assign_position( position ); + } + } + std::cout << std::endl; + + // load cells from your CSV file (if enabled) + load_cells_from_pugixml(); + set_parameters_from_distributions(); + + return; +} + +std::vector my_coloring_function( Cell* pCell ) +{ return paint_by_number_cell_coloring(pCell); } + +void phenotype_function( Cell* pCell, Phenotype& phenotype, double dt ) +{ return; } + +void custom_function( Cell* pCell, Phenotype& phenotype , double dt ) +{ return; } + +void contact_function( Cell* pMe, Phenotype& phenoMe , Cell* pOther, Phenotype& phenoOther , double dt ) +{ return; } \ No newline at end of file diff --git a/sample_projects/asymmetric_division/custom_modules/custom.h b/sample_projects/asymmetric_division/custom_modules/custom.h new file mode 100644 index 000000000..0e6df8d02 --- /dev/null +++ b/sample_projects/asymmetric_division/custom_modules/custom.h @@ -0,0 +1,92 @@ +/* +############################################################################### +# If you use PhysiCell in your project, please cite PhysiCell and the version # +# number, such as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# See VERSION.txt or call get_PhysiCell_version() to get the current version # +# x.y.z. Call display_citations() to get detailed information on all cite-# +# able software used in your PhysiCell application. # +# # +# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM # +# as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1], # +# with BioFVM [2] to solve the transport equations. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- # +# llelized diffusive transport solver for 3-D biological simulations, # +# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 # +# # +############################################################################### +# # +# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # +# # +# Copyright (c) 2015-2021, Paul Macklin and the PhysiCell Project # +# All rights reserved. # +# # +# Redistribution and use in source and binary forms, with or without # +# modification, are permitted provided that the following conditions are met: # +# # +# 1. Redistributions of source code must retain the above copyright notice, # +# this list of conditions and the following disclaimer. # +# # +# 2. Redistributions in binary form must reproduce the above copyright # +# notice, this list of conditions and the following disclaimer in the # +# documentation and/or other materials provided with the distribution. # +# # +# 3. Neither the name of the copyright holder nor the names of its # +# contributors may be used to endorse or promote products derived from this # +# software without specific prior written permission. # +# # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # +# POSSIBILITY OF SUCH DAMAGE. # +# # +############################################################################### +*/ + +#include "../core/PhysiCell.h" +#include "../modules/PhysiCell_standard_modules.h" + +using namespace BioFVM; +using namespace PhysiCell; + +// setup functions to help us along + +void create_cell_types( void ); +void setup_tissue( void ); + +// set up the BioFVM microenvironment +void setup_microenvironment( void ); + +// custom pathology coloring function + +std::vector my_coloring_function( Cell* ); + +// custom functions can go here + +void phenotype_function( Cell* pCell, Phenotype& phenotype, double dt ); +void custom_function( Cell* pCell, Phenotype& phenotype , double dt ); + +void contact_function( Cell* pMe, Phenotype& phenoMe , Cell* pOther, Phenotype& phenoOther , double dt ); + diff --git a/sample_projects/asymmetric_division/main.cpp b/sample_projects/asymmetric_division/main.cpp new file mode 100644 index 000000000..2f7e98c75 --- /dev/null +++ b/sample_projects/asymmetric_division/main.cpp @@ -0,0 +1,254 @@ +/* +############################################################################### +# If you use PhysiCell in your project, please cite PhysiCell and the version # +# number, such as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1]. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# See VERSION.txt or call get_PhysiCell_version() to get the current version # +# x.y.z. Call display_citations() to get detailed information on all cite-# +# able software used in your PhysiCell application. # +# # +# Because PhysiCell extensively uses BioFVM, we suggest you also cite BioFVM # +# as below: # +# # +# We implemented and solved the model using PhysiCell (Version x.y.z) [1], # +# with BioFVM [2] to solve the transport equations. # +# # +# [1] A Ghaffarizadeh, R Heiland, SH Friedman, SM Mumenthaler, and P Macklin, # +# PhysiCell: an Open Source Physics-Based Cell Simulator for Multicellu- # +# lar Systems, PLoS Comput. Biol. 14(2): e1005991, 2018 # +# DOI: 10.1371/journal.pcbi.1005991 # +# # +# [2] A Ghaffarizadeh, SH Friedman, and P Macklin, BioFVM: an efficient para- # +# llelized diffusive transport solver for 3-D biological simulations, # +# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 # +# # +############################################################################### +# # +# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) # +# # +# Copyright (c) 2015-2022, Paul Macklin and the PhysiCell Project # +# All rights reserved. # +# # +# Redistribution and use in source and binary forms, with or without # +# modification, are permitted provided that the following conditions are met: # +# # +# 1. Redistributions of source code must retain the above copyright notice, # +# this list of conditions and the following disclaimer. # +# # +# 2. Redistributions in binary form must reproduce the above copyright # +# notice, this list of conditions and the following disclaimer in the # +# documentation and/or other materials provided with the distribution. # +# # +# 3. Neither the name of the copyright holder nor the names of its # +# contributors may be used to endorse or promote products derived from this # +# software without specific prior written permission. # +# # +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # +# POSSIBILITY OF SUCH DAMAGE. # +# # +############################################################################### +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "./core/PhysiCell.h" +#include "./modules/PhysiCell_standard_modules.h" + +// put custom code modules here! + +#include "./custom_modules/custom.h" + +using namespace BioFVM; +using namespace PhysiCell; + +int main( int argc, char* argv[] ) +{ + // load and parse settings file(s) + + bool XML_status = false; + char copy_command [1024]; + if( argc > 1 ) + { + XML_status = load_PhysiCell_config_file( argv[1] ); + sprintf( copy_command , "cp %s %s" , argv[1] , PhysiCell_settings.folder.c_str() ); + } + else + { + XML_status = load_PhysiCell_config_file( "./config/PhysiCell_settings.xml" ); + sprintf( copy_command , "cp ./config/PhysiCell_settings.xml %s" , PhysiCell_settings.folder.c_str() ); + } + if( !XML_status ) + { exit(-1); } + + // copy config file to output directry + system( copy_command ); + + // OpenMP setup + omp_set_num_threads(PhysiCell_settings.omp_num_threads); + + // time setup + std::string time_units = "min"; + + /* Microenvironment setup */ + + setup_microenvironment(); // modify this in the custom code + + /* PhysiCell setup */ + + // set mechanics voxel size, and match the data structure to BioFVM + double mechanics_voxel_size = 30; + Cell_Container* cell_container = create_cell_container_for_microenvironment( microenvironment, mechanics_voxel_size ); + + /* Users typically start modifying here. START USERMODS */ + + create_cell_types(); + + setup_tissue(); + + /* Users typically stop modifying here. END USERMODS */ + + // set MultiCellDS save options + + set_save_biofvm_mesh_as_matlab( true ); + set_save_biofvm_data_as_matlab( true ); + set_save_biofvm_cell_data( true ); + set_save_biofvm_cell_data_as_custom_matlab( true ); + + // save a simulation snapshot + + char filename[1024]; + sprintf( filename , "%s/initial" , PhysiCell_settings.folder.c_str() ); + save_PhysiCell_to_MultiCellDS_v2( filename , microenvironment , PhysiCell_globals.current_time ); + + // save a quick SVG cross section through z = 0, after setting its + // length bar to 200 microns + + PhysiCell_SVG_options.length_bar = 200; + + // for simplicity, set a pathology coloring function + + std::vector (*cell_coloring_function)(Cell*) = my_coloring_function; + std::string (*substrate_coloring_function)(double, double, double) = paint_by_density_percentage; + + sprintf( filename , "%s/initial.svg" , PhysiCell_settings.folder.c_str() ); + SVG_plot( filename , microenvironment, 0.0 , PhysiCell_globals.current_time, cell_coloring_function, substrate_coloring_function ); + + sprintf( filename , "%s/legend.svg" , PhysiCell_settings.folder.c_str() ); + create_plot_legend( filename , cell_coloring_function ); + + display_citations(); + + // set the performance timers + + BioFVM::RUNTIME_TIC(); + BioFVM::TIC(); + + std::ofstream report_file; + if( PhysiCell_settings.enable_legacy_saves == true ) + { + sprintf( filename , "%s/simulation_report.txt" , PhysiCell_settings.folder.c_str() ); + + report_file.open(filename); // create the data log file + report_file<<"simulated time\tnum cells\tnum division\tnum death\twall time"<update_all_cells( PhysiCell_globals.current_time ); + + /* + Custom add-ons could potentially go here. + */ + + PhysiCell_globals.current_time += diffusion_dt; + } + + if( PhysiCell_settings.enable_legacy_saves == true ) + { + log_output(PhysiCell_globals.current_time, PhysiCell_globals.full_output_index, microenvironment, report_file); + report_file.close(); + } + } + catch( const std::exception& e ) + { // reference to the base of a polymorphic object + std::cout << e.what(); // information from length_error printed + } + + // save a final simulation snapshot + + sprintf( filename , "%s/final" , PhysiCell_settings.folder.c_str() ); + save_PhysiCell_to_MultiCellDS_v2( filename , microenvironment , PhysiCell_globals.current_time ); + + sprintf( filename , "%s/final.svg" , PhysiCell_settings.folder.c_str() ); + SVG_plot(filename, microenvironment, 0.0, PhysiCell_globals.current_time, cell_coloring_function, substrate_coloring_function); + + // timer + + std::cout << std::endl << "Total simulation runtime: " << std::endl; + BioFVM::display_stopwatch_value( std::cout , BioFVM::runtime_stopwatch_value() ); + + return 0; +} diff --git a/sample_projects/biorobots/main.cpp b/sample_projects/biorobots/main.cpp index 214399ebb..2e5a302f0 100644 --- a/sample_projects/biorobots/main.cpp +++ b/sample_projects/biorobots/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/cancer_biorobots/main.cpp b/sample_projects/cancer_biorobots/main.cpp index 41876503a..7b2131179 100644 --- a/sample_projects/cancer_biorobots/main.cpp +++ b/sample_projects/cancer_biorobots/main.cpp @@ -196,7 +196,7 @@ int main( int argc, char* argv[] ) } // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -216,7 +216,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/cancer_immune/main-cancer_immune_3D.cpp b/sample_projects/cancer_immune/main-cancer_immune_3D.cpp index 3959fb514..10f9aca2f 100644 --- a/sample_projects/cancer_immune/main-cancer_immune_3D.cpp +++ b/sample_projects/cancer_immune/main-cancer_immune_3D.cpp @@ -199,7 +199,7 @@ int main( int argc, char* argv[] ) } // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -219,7 +219,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/celltypes3/main.cpp b/sample_projects/celltypes3/main.cpp index cc2b26152..c329cfdfb 100644 --- a/sample_projects/celltypes3/main.cpp +++ b/sample_projects/celltypes3/main.cpp @@ -222,7 +222,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -242,7 +242,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/custom_division/main.cpp b/sample_projects/custom_division/main.cpp index 2f7e98c75..bf6e65d15 100644 --- a/sample_projects/custom_division/main.cpp +++ b/sample_projects/custom_division/main.cpp @@ -181,7 +181,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -201,7 +201,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/heterogeneity/main.cpp b/sample_projects/heterogeneity/main.cpp index 09bd280c0..98b47d9e5 100644 --- a/sample_projects/heterogeneity/main.cpp +++ b/sample_projects/heterogeneity/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/immune_test_2024/main.cpp b/sample_projects/immune_test_2024/main.cpp index 9d26e541d..8df1843ec 100644 --- a/sample_projects/immune_test_2024/main.cpp +++ b/sample_projects/immune_test_2024/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/interactions/main.cpp b/sample_projects/interactions/main.cpp index 050ba8569..ec4b5f408 100644 --- a/sample_projects/interactions/main.cpp +++ b/sample_projects/interactions/main.cpp @@ -183,7 +183,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -203,7 +203,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/mechano/main.cpp b/sample_projects/mechano/main.cpp index ffe29342f..24c358803 100644 --- a/sample_projects/mechano/main.cpp +++ b/sample_projects/mechano/main.cpp @@ -186,7 +186,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -206,7 +206,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/physimess/main.cpp b/sample_projects/physimess/main.cpp index 9d9d2b67f..86601cdb4 100644 --- a/sample_projects/physimess/main.cpp +++ b/sample_projects/physimess/main.cpp @@ -182,7 +182,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -202,7 +202,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/pred_prey_farmer/main.cpp b/sample_projects/pred_prey_farmer/main.cpp index 2d6ddec87..9797710f0 100644 --- a/sample_projects/pred_prey_farmer/main.cpp +++ b/sample_projects/pred_prey_farmer/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/rules_sample/main.cpp b/sample_projects/rules_sample/main.cpp index 9d26e541d..8df1843ec 100644 --- a/sample_projects/rules_sample/main.cpp +++ b/sample_projects/rules_sample/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/template/main.cpp b/sample_projects/template/main.cpp index 2f7e98c75..bf6e65d15 100644 --- a/sample_projects/template/main.cpp +++ b/sample_projects/template/main.cpp @@ -181,7 +181,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -201,7 +201,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/virus_macrophage/main.cpp b/sample_projects/virus_macrophage/main.cpp index b9fdfca8e..7009514aa 100644 --- a/sample_projects/virus_macrophage/main.cpp +++ b/sample_projects/virus_macrophage/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects/worm/main.cpp b/sample_projects/worm/main.cpp index 2d6ddec87..9797710f0 100644 --- a/sample_projects/worm/main.cpp +++ b/sample_projects/worm/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/boolean/cancer_invasion/main.cpp b/sample_projects_intracellular/boolean/cancer_invasion/main.cpp index 162ce4bc5..eac3e89cf 100644 --- a/sample_projects_intracellular/boolean/cancer_invasion/main.cpp +++ b/sample_projects_intracellular/boolean/cancer_invasion/main.cpp @@ -191,7 +191,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -211,7 +211,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/boolean/physiboss_cell_lines/main.cpp b/sample_projects_intracellular/boolean/physiboss_cell_lines/main.cpp index a3d872462..002ed6092 100644 --- a/sample_projects_intracellular/boolean/physiboss_cell_lines/main.cpp +++ b/sample_projects_intracellular/boolean/physiboss_cell_lines/main.cpp @@ -189,7 +189,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -209,7 +209,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/boolean/template_BM/main.cpp b/sample_projects_intracellular/boolean/template_BM/main.cpp index f30923d04..e1dfd12cb 100644 --- a/sample_projects_intracellular/boolean/template_BM/main.cpp +++ b/sample_projects_intracellular/boolean/template_BM/main.cpp @@ -183,7 +183,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -203,7 +203,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/boolean/tutorial/README.md b/sample_projects_intracellular/boolean/tutorial/README.md index 9341560b4..6e530df90 100644 --- a/sample_projects_intracellular/boolean/tutorial/README.md +++ b/sample_projects_intracellular/boolean/tutorial/README.md @@ -4,7 +4,7 @@ In this folder we provide the models presented in the PhysiBoSS tutorials ## Manuscript -The manuscript of the paper is available here, and the supplementary materials (containing the detailed instructions to build the model) is available here +The manuscript of the paper is available [here](https://doi.org/10.1093/bib/bbae509), and the supplementary materials (containing the detailed instructions to build the model) is available [here](https://raw.githubusercontent.com/PhysiBoSS/PhysiBoSS/refs/heads/master/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_supp_mat.pdf) ## Binary file diff --git a/sample_projects_intracellular/boolean/tutorial/main.cpp b/sample_projects_intracellular/boolean/tutorial/main.cpp index 8b7814154..0cfa59427 100644 --- a/sample_projects_intracellular/boolean/tutorial/main.cpp +++ b/sample_projects_intracellular/boolean/tutorial/main.cpp @@ -191,7 +191,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -211,7 +211,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/boolean/tutorial/paper/CellFate_Analysis.pdf b/sample_projects_intracellular/boolean/tutorial/paper/CellFate_Analysis.pdf deleted file mode 100644 index f84d44f55..000000000 Binary files a/sample_projects_intracellular/boolean/tutorial/paper/CellFate_Analysis.pdf and /dev/null differ diff --git a/sample_projects_intracellular/boolean/tutorial/paper/Cell_cycle_analysis.pdf b/sample_projects_intracellular/boolean/tutorial/paper/Cell_cycle_analysis.pdf deleted file mode 100644 index 3e5ecd9c8..000000000 Binary files a/sample_projects_intracellular/boolean/tutorial/paper/Cell_cycle_analysis.pdf and /dev/null differ diff --git a/sample_projects_intracellular/boolean/tutorial/paper/Cell_cycle_boolean_analysis.pdf b/sample_projects_intracellular/boolean/tutorial/paper/Cell_cycle_boolean_analysis.pdf deleted file mode 100644 index 06ee6aefb..000000000 Binary files a/sample_projects_intracellular/boolean/tutorial/paper/Cell_cycle_boolean_analysis.pdf and /dev/null differ diff --git a/sample_projects_intracellular/boolean/tutorial/paper/Corral_analysis.pdf b/sample_projects_intracellular/boolean/tutorial/paper/Corral_analysis.pdf deleted file mode 100644 index 609389ebe..000000000 Binary files a/sample_projects_intracellular/boolean/tutorial/paper/Corral_analysis.pdf and /dev/null differ diff --git a/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_main_text.pdf b/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_main_text.pdf deleted file mode 100644 index 46d68f138..000000000 Binary files a/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_main_text.pdf and /dev/null differ diff --git a/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_supp_mat.pdf b/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_supp_mat.pdf deleted file mode 100644 index e7214757c..000000000 Binary files a/sample_projects_intracellular/boolean/tutorial/paper/PhysiBoSS_tutorial_supp_mat.pdf and /dev/null differ diff --git a/sample_projects_intracellular/fba/cancer_metabolism/main.cpp b/sample_projects_intracellular/fba/cancer_metabolism/main.cpp index e3bb3381d..0901f0038 100644 --- a/sample_projects_intracellular/fba/cancer_metabolism/main.cpp +++ b/sample_projects_intracellular/fba/cancer_metabolism/main.cpp @@ -185,7 +185,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -205,7 +205,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/fba/ecoli_acetic_switch/main_ecoli_acetic_switch.cpp b/sample_projects_intracellular/fba/ecoli_acetic_switch/main_ecoli_acetic_switch.cpp index eb79727da..e26e6f11f 100644 --- a/sample_projects_intracellular/fba/ecoli_acetic_switch/main_ecoli_acetic_switch.cpp +++ b/sample_projects_intracellular/fba/ecoli_acetic_switch/main_ecoli_acetic_switch.cpp @@ -174,7 +174,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -194,7 +194,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/sample_projects_intracellular/ode/ode_energy/main.cpp b/sample_projects_intracellular/ode/ode_energy/main.cpp index 61ef138f0..828ce4dc9 100644 --- a/sample_projects_intracellular/ode/ode_energy/main.cpp +++ b/sample_projects_intracellular/ode/ode_energy/main.cpp @@ -176,7 +176,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -196,7 +196,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/unit_tests/custom_DCs_2substrates/main.cpp b/unit_tests/custom_DCs_2substrates/main.cpp index 9d26e541d..8df1843ec 100644 --- a/unit_tests/custom_DCs_2substrates/main.cpp +++ b/unit_tests/custom_DCs_2substrates/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/unit_tests/custom_voxel_values/main.cpp b/unit_tests/custom_voxel_values/main.cpp index 9d26e541d..8df1843ec 100644 --- a/unit_tests/custom_voxel_values/main.cpp +++ b/unit_tests/custom_voxel_values/main.cpp @@ -180,7 +180,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -200,7 +200,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) { diff --git a/unit_tests/substrate_internalization/unit_test_conservation.cpp b/unit_tests/substrate_internalization/unit_test_conservation.cpp index 895956a97..912660a50 100644 --- a/unit_tests/substrate_internalization/unit_test_conservation.cpp +++ b/unit_tests/substrate_internalization/unit_test_conservation.cpp @@ -170,7 +170,7 @@ int main( int argc, char* argv[] ) while( PhysiCell_globals.current_time < PhysiCell_settings.max_time + 0.1*diffusion_dt ) { // save data if it's time. - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_full_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_full_save_time - 0.5 * diffusion_dt ) { display_simulation_status( std::cout ); if( PhysiCell_settings.enable_legacy_saves == true ) @@ -190,7 +190,7 @@ int main( int argc, char* argv[] ) } // save SVG plot if it's time - if( fabs( PhysiCell_globals.current_time - PhysiCell_globals.next_SVG_save_time ) < 0.01 * diffusion_dt ) + if( PhysiCell_globals.current_time > PhysiCell_globals.next_SVG_save_time - 0.5 * diffusion_dt ) { if( PhysiCell_settings.enable_SVG_saves == true ) {