Skip to content

Conversation

rheiland
Copy link
Collaborator

@rheiland rheiland commented Aug 25, 2025

  • add a cell custom function as an alternative to randomly positioning the daughter cell in divide()
  • if this function is defined (non-NULL), it will be called and return a 3-vector which is the normalized direction from the parent cell to the daughter cell
  • this PR does not define another sample project to test/demo; rather, I'd like to suggest that we consider adopting a .zip approach that bundles all necessary files for compiling and testing. For now, we could simply adopt the user_projects workflow.

To test:

  • clone this branch, then:
make
make reset
# download https://github.com/rheiland/sample_models/blob/main/bacterial_growth.zip
# and put into `/user_projects` and  unzip it there, then:
make load PROJ=bacterial_growth
make
project    # or use the Studio to run & plot results

Sample output:
Screenshot 2025-08-28 at 11 22 26 AM

Copy link
Collaborator

@drbergman drbergman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually quite timely and really useful! I think a couple minor changes will improve on this in ways worth considering though. Looking forward to discussing further!

}
else
{
rand_vec = cell_division_orientation();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to initialize cell_division_direction_function as cell_division_orientation? simplifies the logic here? I know we follow this structure you have here elsewhere in the codebase, but I think setting the default and overriding is simpler and yields simpler logic here.

@rheiland
Copy link
Collaborator Author

Thanks for the feedback! Offhand, I'm OK with both of your suggestions: init cell_division_direction_function ascell_division_orientation, and normalizing the vector returned by the custom function (even if they already did) - a safer approach. I'll sit on it awhile in case others chime in. I'm also curious to hear if I've missed something more fundamental, as this topic came up in a Macklin lab mtg recently.

@drbergman
Copy link
Collaborator

I'm curious to hear as well...the only other thing that comes to mind is managing the final rand_vec orientation in a 2D sim to be in the xy-plane.

@rheiland
Copy link
Collaborator Author

Actually, that might be one argument for keeping the if-else logic on the cell_division_direction_function in divide(): we could explicitly check the user-supplied vector for being in the x-y plane for a 2D sim (which implies additional checks for 2D/3D sim and z ~= 0.0). Ugh.

@drbergman
Copy link
Collaborator

we could write a setter function that sends a default cell through the function assert these condition(s) hold. Normalization regardless. in xy-plane when in 2D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants