<?xml version='1.0' encoding='UTF-8'?>
<MorpheusModel version="4">
    <Description>
        <Title>Wave-Pinning Model of Rac Activation</Title>
        <Details>Model ID:	https://identifiers.org/morpheus/M2073
  File type:	Supplementary model
  Software:	Morpheus (open source). Download from: https://morpheus.gitlab.io
Full title:	Neutrophil Reorientation via Local Feedback and PIP3-Driven Delay
Authors:	J. Algorta, J. P. Town, O. D. Weiner, L. Edelstein-Keshet
Submitter:	J. Algorta
Curator:	L. Brusch
Date:	15.05.2025
Reference:	This model is the original used in the publication, up to technical updates:
	J. Algorta, J. P. Town, O. D. Weiner, L. Edelstein-Keshet: Investigating local negative feedback of Rac activity by mathematical models and cell-motility simulations. iScience 29 (2): 114641, 2026.
	https://doi.org/10.1016/j.isci.2026.114641
Comment:  
This model simulates Rac activation and polarity via wave-pinning under a spatial gradient stimulus (U), which dynamically changes or varies along the y-axis.
    </Details>
  </Description>

    <Global>
        <Constant symbol="ts1" name="Time to *end* first light stimulus from &quot;time = 0&quot;" value="0"/>
        <Constant symbol="ts2" name="Time to *starts* second light stimulus from &quot;time = ts2&quot;" value="10"/>
        <Constant symbol="L" name="Angular size of the light stimulus" value="pi/3"/>
        <Variable symbol="A" value="0.0"/>
        <Variable symbol="B" value="0.0"/>
        <Field symbol="prot" value="0.0"/>
        <Variable symbol="ts3" value="1000000"/>
        <Field symbol="U" value="noisy(1*l.y / lattice.y)">
            <Diffusion rate="0.0"/>
        </Field>
        <Event trigger="on-change" time-step="1">
            <Condition>time>=200</Condition>
            <Rule symbol-ref="U">
                <Expression>noisy(0.5)</Expression>
            </Rule>
        </Event>
        <Event trigger="on-change" time-step="1">
            <Condition>time>=250</Condition>
            <Rule symbol-ref="U">
                <Expression>noisy((lattice.y-l.y) / lattice.y)</Expression>
            </Rule>
        </Event>
        <Constant symbol="noise" value="0"/>
        <Function symbol="noisy">
            <Parameter symbol="v" name="value"/>
            <Expression>max(0,(v+rand_norm(0,noise)))</Expression>
        </Function>
        <Constant symbol="middle_temp" value="rand_uni(pi/4,2*pi-pi/4)"/>
        <Constant symbol="lengthscale" value="2*pi/(2*pi*sqrt(2000/pi))"/>
        <Variable symbol="vol_target" value="2000"/>
        <!--    <Disabled>
        <Variable symbol="vol_target" value="rand_norm(2000.142, 683.505) "/>
    </Disabled>
-->
        <Constant symbol="middle" value="middle_temp"/>
        <!--    <Disabled>
        <Constant symbol="middle" value="3*pi/2"/>
    </Disabled>
-->
    </Global>

    <Space>
        <Lattice class="square">
            <Size symbol="lattice" value="350, 1050, 0"/>
            <BoundaryConditions>
                <Condition type="periodic" boundary="x"/>
                <Condition type="noflux" boundary="y"/>
            </BoundaryConditions>
            <NodeLength value="1.0"/>
            <Neighborhood>
                <Distance>2.0</Distance>
            </Neighborhood>
        </Lattice>
        <SpaceSymbol symbol="l"/>
        <MembraneLattice>
            <Resolution symbol="memsize" value="100"/>
            <SpaceSymbol symbol="m"/>
        </MembraneLattice>
    </Space>

    <Time>
        <StartTime value="0"/>
        <StopTime value="300"/>
        <SaveInterval value="0"/>
        <TimeSymbol symbol="time"/>
    </Time>

    <CellTypes>
        <CellType name="cells" class="biological">
            <VolumeConstraint target="vol_target" strength="1"/>
            <SurfaceConstraint target="1.46" strength="1" mode="aspherity"/>
            <MembraneProperty symbol="A" name="Active form of protein" value="rand_uni(1.5,2.5)">
                <Diffusion rate="0.080/lengthscale^2"/>
            </MembraneProperty>
            <MembraneProperty symbol="B" name="Inactive form of protein" value="7.78">
                <Diffusion rate="0.51/lengthscale^2"/>
            </MembraneProperty>
            <MembraneProperty symbol="s" name="signal" value="0">
                <Diffusion rate="0"/>
            </MembraneProperty>

            <System time-scaling="1" name="WavePinning" solver="Euler [fixed, O(1)]">
                <Constant symbol="k_0" value="rand_norm(0.035, 0.001530)"/>
                <Constant symbol="s_1" value="rand_norm(0.12, 0.007653)"/>
                <Constant symbol="gamma" value="rand_norm(1.31, 0.025510)"/>
                <Constant symbol="delta" value="rand_norm(2.70, 0.028061)"/>
                <Constant symbol="K" value="rand_norm(2.75, 0.048469)"/>
                <Constant symbol="n" name="Hill coefficient" value="2"/>
                <Intermediate symbol="u_damp" value="max(0.001,u_inte)"/>
                <Intermediate symbol="F" value="1*(B*(k_0+ s_1*(0.4*s/u_damp+0.93) + (gamma*A^n) / (K^n + A^n) ) - delta*A)"/>
                <DiffEqn symbol-ref="A">
                    <Expression>F</Expression>
                </DiffEqn>
                <DiffEqn symbol-ref="B">
                    <Expression>-F</Expression>
                </DiffEqn>
            </System>

            <PropertyVector symbol="p" name="polarity" value="0.0, 0.0, 0.0"/>
            <MotilityReporter time-step="10" name="Velocity extraction">
                <Velocity symbol-ref="p"/>
            </MotilityReporter>
            <StarConvex membrane="A" strength="30" name="Protrusive domain identification"/>
            <Protrusion strength="10" field="prot" name="Protrusion persistence" maximum="2500"/>
            <Mapper name="Light direction">
                <Input value="U"/>
                <Polarity symbol-ref="p1"/>
            </Mapper>
            <PropertyVector symbol="p1" name="polarity1" value="0.0, 0.0, 0.0"/>
            <ConnectivityConstraint name=""/>
            <Property symbol="u_inte" name="Intermediate variable" value="0.0"/>
            <Mapper name="Sensing the field">
                <Input value="U"/>
                <Output symbol-ref="s" mapping="average"/>
            </Mapper>
            <Mapper>
                <Input value="s"/>
                <Output symbol-ref="u_inte" mapping="sum"/>
            </Mapper>
        </CellType>
    </CellTypes>

    <CPM>
        <Interaction default="0.0"/>
        <MonteCarloSampler stepper="edgelist">
            <MCSDuration value="0.07"/>
            <Neighborhood>
                <Order>2</Order>
            </Neighborhood>
            <MetropolisKinetics yield="0.05" temperature="0.3"/>
        </MonteCarloSampler>
        <ShapeSurface scaling="norm">
            <Neighborhood>
                <Order>6</Order>
            </Neighborhood>
        </ShapeSurface>
    </CPM>

    <CellPopulations>
        <Population type="cells" size="0">
            <InitCellObjects mode="distance">
                <Arrangement repetitions="1, 1, 0" displacements="1, 1, 0">
                    <Sphere center="175 50 0" radius="21"/>
                </Arrangement>
            </InitCellObjects>
        </Population>
    </CellPopulations>

    <Analysis>
        <Gnuplotter time-step="5" decorate="false">
            <Terminal name="png" size="450, 1050, 0"/>
            <Plot title="Active Protein &amp; Gradient Stimulus">
                <Cells flooding="true" value="cell.type">
                    <ColorMap>
                        <Color color="maroon" value="1"/>
                    </ColorMap>
                </Cells>
                <Field symbol-ref="U" max="1" min="0">
                    <ColorMap>
                        <Color color="yellow" value="0"/>
                        <Color color="orange" value="1"/>
                    </ColorMap>
                </Field>
            </Plot>
        </Gnuplotter>
        <CellTracker time-step="1" format="ISBI 2012 (XML)"/>
        <Logger time-step="5">
            <Input>
                <Symbol symbol-ref="m.phi"/>
                <Symbol symbol-ref="A"/>
                <Symbol symbol-ref="B"/>
                <Symbol symbol-ref="s"/>
                <Symbol symbol-ref="p.phi"/>
            </Input>
            <Output>
                <TextOutput/>
            </Output>
            <Plots>
                <Plot time-step="5">
                    <Style style="points"/>
                    <Terminal terminal="png"/>
                    <X-axis maximum="6.283">
                        <Symbol symbol-ref="m.phi"/>
                    </X-axis>
                    <Y-axis minimum="0.0" maximum="7">
                        <Symbol symbol-ref="B"/>
                        <Symbol symbol-ref="A"/>
                        <Symbol symbol-ref="s"/>
                    </Y-axis>
                    <Range>
                        <Time mode="current"/>
                    </Range>
                </Plot>
            </Plots>
        </Logger>
        <ModelGraph include-tags="#untagged" format="dot" reduced="false"/>
    </Analysis>
</MorpheusModel>
