
    if (Steps(m)==0) && m.globalDynamicProps.doinit  % Initialisation code.
        % increase growth around the edge of the canvas to force it to buckle
        m = leaf_mgen_edge( m, 'id_rim',1);
        [id_rim_i,id_rim_p,id_rim_a,id_rim_l] = getMgenLevels( m, 'ID_RIM' );
        % assign a morphogen down the middle of the y axis
        id_mid_p((m.nodes(:,2)<0.2)&(m.nodes(:,2)>-0.2))=1;
        
        % To cut the mesh, set a temporary morphogen to 1 in places to cut
        seams=zeros(size(P));
        seams(id_mid_p>0.5)=1;
        m=leaf_set_seams(m,seams);
    end
    STOP_GROWING_TIME=50;
    if realtime<STOP_GROWING_TIME % Grow
        kapar_p(id_rim_p==0)=5;
        kbpar_p(id_rim_p==0)=0.5;
        kaper_p(id_rim_p==0)=5;
        kbper_p(id_rim_p==0)=0.5;
        knor_p =0;
    elseif realtime>=STOP_GROWING_TIME && realtime<STOP_GROWING_TIME+dt % dissect, explode and flatten 
        kapar_p=0;
        kbpar_p=0;
        kaper_p=0;
        kbper_p=0;
        knor_p =0;
    end