Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhysiMeSS 1.0.1 #291

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fibre and Cell settings are now part of the custom data, allowing dif…
…ferent types of cells and fibres
  • Loading branch information
vincent-noel committed Sep 6, 2024
commit f31de8191d68b00e134fe6c419123cf363527a0e
2 changes: 1 addition & 1 deletion addons/PhysiMeSS/PhysiMeSS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void remove_physimess_out_of_bounds_fibres()
void physimess_update_cell_velocity( Cell* pCell, Phenotype& phenotype, double dt)
{

double movement_threshold = PhysiCell::parameters.doubles("fibre_stuck_threshold");
double movement_threshold = pCell->custom_data["fibre_stuck_threshold"];
if (!isFibre(pCell) && phenotype.motility.is_motile) {

// Here I changed this, because here we don't have access to the old position, and I didn't want to track the old position
Expand Down
12 changes: 6 additions & 6 deletions addons/PhysiMeSS/PhysiMeSS_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ void PhysiMeSS_Cell::add_potentials_from_fibre(PhysiMeSS_Fibre* pFibre)
double xip = pow(xi, p_exponent);
double xiq = pow((1 - xi * xi), q_exponent);

fibre_adhesion = PhysiCell::parameters.doubles("vel_adhesion") * xip *
(1 - cell_velocity / PhysiCell::parameters.doubles("cell_velocity_max"));
fibre_adhesion = this->custom_data["vel_adhesion"] * xip *
(1 - cell_velocity / this->custom_data["cell_velocity_max"]);

fibre_repulsion = PhysiCell::parameters.doubles("vel_contact") * xiq;
fibre_repulsion = this->custom_data["vel_contact"] * xiq;

axpy(&(velocity), fibre_adhesion, pFibre->state.orientation);
naxpy(&(velocity), fibre_repulsion, previous_velocity);
Expand All @@ -119,8 +119,8 @@ void PhysiMeSS_Cell::degrade_fibre(PhysiMeSS_Fibre* pFibre)
distance = std::max(sqrt(distance), 0.00001);

// Fibre degradation by cell - switched on by flag fibre_degradation
double stuck_threshold = PhysiCell::parameters.doubles("fibre_stuck_time");
if (PhysiCell::parameters.bools("fibre_degradation") && stuck_counter >= stuck_threshold) {
double stuck_threshold = this->custom_data["fibre_stuck_time"];
if (this->custom_data["fibre_degradation"] > 0.5 && stuck_counter >= stuck_threshold) {
// if (stuck_counter >= stuck_threshold){
// std::cout << "Cell " << ID << " is stuck at time " << PhysiCell::PhysiCell_globals.current_time
// << " near fibre " << pFibre->ID << std::endl;;
Expand All @@ -129,7 +129,7 @@ void PhysiMeSS_Cell::degrade_fibre(PhysiMeSS_Fibre* pFibre)
double dotproduct = dot_product(displacement, phenotype.motility.motility_vector);
if (dotproduct >= 0) {
double rand_degradation = PhysiCell::UniformRandom();
double prob_degradation = PhysiCell::parameters.doubles("fibre_degradation_rate");
double prob_degradation = this->custom_data["fibre_degradation_rate"];
if (rand_degradation <= prob_degradation) {
//std::cout << " --------> fibre " << (*other_agent).ID << " is flagged for degradation " << std::endl;
// (*other_agent).parameters.degradation_flag = true;
Expand Down
24 changes: 13 additions & 11 deletions addons/PhysiMeSS/PhysiMeSS_fibre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ std::vector<PhysiCell::Cell_Definition*>* getFibreCellDefinitions() {

return result;
}

PhysiMeSS_Fibre::PhysiMeSS_Fibre()
{
// std::cout << "PhysiMeSS_Fibre constructor,";
fibres_crosslinkers.clear();
fibres_crosslink_point.clear();

mLength = PhysiCell::NormalRandom(PhysiCell::parameters.doubles("fibre_length"), PhysiCell::parameters.doubles("length_normdist_sd")) / 2.0;
mRadius = PhysiCell::parameters.doubles("fibre_radius");
// mLength = PhysiCell::NormalRandom(PhysiCell::parameters.doubles("fibre_length"), PhysiCell::parameters.doubles("length_normdist_sd")) / 2.0;
// mRadius = PhysiCell::parameters.doubles("fibre_radius");
// std::cout << "mLength = " << mLength;
X_crosslink_count = 0;
fail_count = 0;
}

void PhysiMeSS_Fibre::assign_fibre_orientation()
{
mLength = PhysiCell::NormalRandom(this->custom_data["fibre_length"], this->custom_data["length_normdist_sd"]) / 2.0;
mRadius = this->custom_data["fibre_radius"];
this->assign_orientation();
if (default_microenvironment_options.simulate_2D) {
if (PhysiCell::parameters.bools("anisotropic_fibres")){
double theta = PhysiCell::NormalRandom(PhysiCell::parameters.doubles("fibre_angle"),PhysiCell::parameters.doubles("angle_normdist_sd"));
if (this->custom_data["anisotropic_fibres"] > 0.5){
double theta = PhysiCell::NormalRandom(this->custom_data["fibre_angle"], this->custom_data["angle_normdist_sd"]);
this->state.orientation[0] = cos(theta);
this->state.orientation[1] = sin(theta);
}
Expand Down Expand Up @@ -135,7 +137,7 @@ void PhysiMeSS_Fibre::check_out_of_bounds(std::vector<double>& position)
break after 10 failures
It needs re-writing at some stage to handle the 3D case properly */

if (PhysiCell::parameters.bools("anisotropic_fibres")) {
if (this->custom_data["anisotropic_fibres"]) {
if (xs < Xmin || xe > Xmax || xe < Xmin || xs > Xmax ||
ys < Ymin || ye > Ymax || ye < Ymin || ys > Ymax) {
fail_count = 10;
Expand Down Expand Up @@ -205,7 +207,7 @@ void PhysiMeSS_Fibre::add_potentials_from_cell(PhysiMeSS_Cell* cell)
// cell-fibre pushing only if fibre no crosslinks
if (X_crosslink_count == 0) {
//fibre pushing turned on
if (PhysiCell::parameters.bools("fibre_pushing")) {
if (cell->custom_data["fibre_pushing"] > 0.5) {
// as per PhysiCell
static double simple_pressure_scale = 0.027288820670331;
// temp_r = 1 - distance/R;
Expand All @@ -227,15 +229,15 @@ void PhysiMeSS_Fibre::add_potentials_from_cell(PhysiMeSS_Cell* cell)
}

// fibre rotation turned on (2D)
if (PhysiCell::parameters.bools("fibre_rotation")) {
if (cell->custom_data["fibre_rotation"] > 0.5) {
std::vector<double> old_orientation(3, 0.0);
for (int i = 0; i < 2; i++) {
old_orientation[i] = state.orientation[i];
}

double moment_arm_magnitude = sqrt(
point_of_impact[0] * point_of_impact[0] + point_of_impact[1] * point_of_impact[1]);
double impulse = PhysiCell::parameters.doubles("fibre_sticky")*(*cell).phenotype.motility.migration_speed * moment_arm_magnitude;
double impulse = cell->custom_data["fibre_sticky"]*(*cell).phenotype.motility.migration_speed * moment_arm_magnitude;
double fibre_length = 2 * mLength;
double angular_velocity = impulse / (0.5 * fibre_length * fibre_length);
double angle = angular_velocity;
Expand All @@ -246,7 +248,7 @@ void PhysiMeSS_Fibre::add_potentials_from_cell(PhysiMeSS_Cell* cell)
}

// fibre rotation around other fibre (2D only and fibres intersect at a single point)
if (PhysiCell::parameters.bools("fibre_rotation") && X_crosslink_count == 1) {
if (cell->custom_data["fibre_rotation"] > 0.5 && X_crosslink_count == 1) {
double distance_fibre_centre_to_crosslink = 0.0;
std::vector<double> fibre_centre_to_crosslink(3, 0.0);
for (int i = 0; i < 2; i++) {
Expand All @@ -261,7 +263,7 @@ void PhysiMeSS_Fibre::add_potentials_from_cell(PhysiMeSS_Cell* cell)
}
double moment_arm_magnitude = sqrt(
point_of_impact[0] * point_of_impact[0] + point_of_impact[1] * point_of_impact[1]);
double impulse = PhysiCell::parameters.doubles("fibre_sticky")*(*cell).phenotype.motility.migration_speed * moment_arm_magnitude;
double impulse = cell->custom_data["fibre_sticky"]*(*cell).phenotype.motility.migration_speed * moment_arm_magnitude;
double fibre_length = 2 * mLength;
double angular_velocity = impulse / (0.5 * fibre_length * fibre_length);
double angle = angular_velocity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,20 @@

</phenotype>
<custom_data>
<sample>1.0</sample>
<fibre_degradation units="none" description="flag for fibre degradation">0.0</fibre_degradation>
<fibre_degradation_rate units="1/min" description="fibre degradation rate">0.01</fibre_degradation_rate>
<fibre_custom_degradation units="none" description="flag for having degradation depends on pressure">0.0</fibre_custom_degradation>
<fibre_stuck_time units="1/min" description="time before stuck cell can degrade fibre">10.0</fibre_stuck_time>
<fibre_stuck_threshold units="none" description="movement threshold to declare a cell stuck">0.05</fibre_stuck_threshold>
<fibre_pressure_threshold units="1/min" description="time before stuck cell can degrade fibre">10.0</fibre_pressure_threshold>

<fibre_pushing units="none" description="flag for fibre pushing">0.0</fibre_pushing>
<fibre_sticky units="none" description="measure of how easy it is to move a fibre">1.0</fibre_sticky>
<fibre_rotation units="none" description="flag for fibre rotation">0.0</fibre_rotation>

<vel_adhesion units="" description="cell velocity parallel to fibre">0.6</vel_adhesion>
<vel_contact units="" description="cell velocity orthogonal to fibre">0.1</vel_contact>
<cell_velocity_max units="" description="max cell velocity">1.0</cell_velocity_max>
</custom_data>
</cell_definition>

Expand Down Expand Up @@ -261,9 +274,15 @@

</phenotype>
<custom_data>
<sample>1.0</sample>
</custom_data>
</cell_definition>
<anisotropic_fibres units="none" description="flag for whether we want anisotropic fibres">1.0</anisotropic_fibres>
<fibre_length units="microns" description="length of fibres">60.0</fibre_length>
<length_normdist_sd units="microns" description="standard deviation of fibre length">0.0</length_normdist_sd>
<fibre_radius units="microns" description="radius of fibres">2.0</fibre_radius>
<radius_normdist_sd units="microns" description="standard deviation of fibre radius">0.0</radius_normdist_sd>
<fibre_angle units="radians" description="angle of fibre orientation">1.57</fibre_angle>
<angle_normdist_sd units="radians" description="standard deviation of fibre orientation angle">0.0</angle_normdist_sd>
</custom_data>
</cell_definition>

<cell_definition name="fibre_horizontal" ID="2">
<phenotype>
Expand Down Expand Up @@ -353,8 +372,13 @@

</phenotype>
<custom_data>
<sample>1.0</sample>
</custom_data>
<anisotropic_fibres units="none" description="flag for whether we want anisotropic fibres">1.0</anisotropic_fibres>
<fibre_length units="microns" description="length of fibres">60.0</fibre_length>
<length_normdist_sd units="microns" description="standard deviation of fibre length">0.0</length_normdist_sd>
<fibre_radius units="microns" description="radius of fibres">2.0</fibre_radius>
<radius_normdist_sd units="microns" description="standard deviation of fibre radius">0.0</radius_normdist_sd>
<fibre_angle units="radians" description="angle of fibre orientation">1.57</fibre_angle>
<angle_normdist_sd units="radians" description="standard deviation of fibre orientation angle">0.0</angle_normdist_sd> </custom_data>
</cell_definition>

<cell_definition name="attractant" ID="3">
Expand Down Expand Up @@ -461,31 +485,8 @@
<user_parameters>
<random_seed type="int" units="dimensionless" description="">0</random_seed>
<number_of_cells type="int" units="none" description="initial number of cells (for each cell type)">0</number_of_cells>

<number_of_fibres type="int" units="none" description="initial number of fibres (for each fibre type)">2000</number_of_fibres>
<anisotropic_fibres type="bool" units="none" description="flag for whether we want anisotropic fibres">true</anisotropic_fibres>
<fibre_length type="double" units="microns" description="length of fibres">60.0</fibre_length>
<length_normdist_sd type="double" units="microns" description="standard deviation of fibre length">0.0</length_normdist_sd>
<fibre_radius type="double" units="microns" description="radius of fibres">2.0</fibre_radius>
<radius_normdist_sd type="double" units="microns" description="standard deviation of fibre radius">0.0</radius_normdist_sd>
<fibre_angle type="double" units="radians" description="angle of fibre orientation">1.57</fibre_angle>
<angle_normdist_sd type="double" units="radians" description="standard deviation of fibre orientation angle">0.0</angle_normdist_sd>

<fibre_degradation type="bool" units="none" description="flag for fibre degradation">false</fibre_degradation>
<fibre_degradation_rate type="double" units="1/min" description="fibre degradation rate">0.01</fibre_degradation_rate>
<fibre_custom_degradation type="bool" units="none" description="flag for having degradation depends on pressure">false</fibre_custom_degradation>
<fibre_stuck_time type="double" units="1/min" description="time before stuck cell can degrade fibre">10.0</fibre_stuck_time>
<fibre_stuck_threshold type="double" units="none" description="movement threshold to declare a cell stuck">0.05</fibre_stuck_threshold>
<fibre_pressure_threshold type="double" units="1/min" description="time before stuck cell can degrade fibre">10.0</fibre_pressure_threshold>
<color_cells_by_pressure type="bool" units="" description="flag for coloring cells by pressure">false</color_cells_by_pressure>

<fibre_pushing type="bool" units="none" description="flag for fibre pushing">false</fibre_pushing>
<fibre_sticky type="double" units="none" description="measure of how easy it is to move a fibre">1.0</fibre_sticky>
<fibre_rotation type="bool" units="none" description="flag for fibre rotation">false</fibre_rotation>

<vel_adhesion type="double" units="" description="cell velocity parallel to fibre">0.6</vel_adhesion>
<vel_contact type="double" units="" description="cell velocity orthogonal to fibre">0.1</vel_contact>
<cell_velocity_max type="double" units="" description="max cell velocity">1.0</cell_velocity_max>
</user_parameters>
</user_parameters>

</PhysiCell_settings>
Loading