Main biogeographic loop
Establish starting positions for Lineage 0
- Until the allowed number of starting spaces (
Cfg.nStartSpaces) for lineage 0 have been chosen...
- If i) space has not already been chosen, ii) area is > 0, i.e., there is land, and iii) it is an allowed start spot, set that start space for lineage 0.
Main loop from time 0 to present
- For each period (
t) up until the penultimate one (because actions cause changes in state at
- Exclude those lineages not alive at period
- (Optionally test for fossils: if there is a fossil in a place and no lineage in that place, this causes a failure)
- Where there is a lineage in a space at a time (set either from initialization or from the previous run)...
- Test for dispersal to each other space (that is not the same one and has Area > 0). If a randomly chosen 0...1 is less than the distance-dependent prob of dispersal, set the (potential) lineage in that space in
Survival and dispersal
- Test for survival in place. If a randomly chosen 0...1 is less than the area-dependent prob of survival, set the (potential) lineage as alive in 'own' space in
- (If no existences of this lineage make it to
t+1, end this run because the simulation cannot not make a match to the existing distribution)
Switch from parent to daughter lineages 'if it is time'
- Test for existence of lineage in
t+1. If it is to die...
- Calculate how many spaces (
z) it would have been in. (If it is only in one place, then speciation must be sympatric, i.e., two or more daughter lineages exist together in the single space at
t+1. If it is in several places, then speciation could be sympatric or allopatric.)
- For each daughter lineage (0...
- Pick a random number (0...
z). If that place has not been filled, use that place for the new lineage. If that place has been filled, and all places have been filled just use that place for the new lineage, but if all places have not been filled, try again. This algorithm generates sympatry with
places=1, allopatry with
l = 2 and
places=2 and a mixture with other combinations.
- If the loop did not bail out due to a dying lineage, we have a fully simulated lineage.
Check for conformation of simulated taxa distribution to extant
- Loop through lineages and spaces at present and count the number of differences between simulated and onserved distribution
- If there is no difference in simulated and observed distribution, we record the route taken through space-time