void nmsim_pop_evolve
  ( nmsim_pop_state_t *pso,
    double DV_avg,
    double DV_dev,
    double I_avg,
    double I_dev,
    nmsim_neuron_parms_t *parm,
    nmsim_pop_state_t *psn
  )
  {
    /* The state of the new cohort of age zero: */
    nmsim_cohort_state_t csn_fire;
    nmsim_cohort_clear(&csn_fire);
    /* The state of the new cohort of age {np}: */
    nmsim_cohort_state_t csn_lump;

    int k;
    for (k = np; k > 0; k--)
      { /* Evolve cohort {S[k,t]} to time {t+1}: */
        nmsim_cohort_state_t *cso = &(ps->cs[k]);
        nmsim_cohort_state_t csn_k_fire;
        nmsim_cohort_state_t csn_k_fail;
        nmsim_cohort_evolve
	  ( cso, DV_avg, DV_dev, I_avg, I_dev,
	    parms, 
	    &csn_k_fire, &csn_k_fail
	  );

        /* Merge the part of the cohort that fired into {csn_fire}: */
        nmsim_cohort_merge(&csn_k_fire, &csn_fire);

        /* Store or merge the part of the cohort that did not fire: */
        if (k == np)
          { /* Save the new cohort {np+1} to merge later: */
            csn_lump = csn_k_fail; 
	  }
        else 
          { nmsim_cohort_state_t *csn = &(ps->cs[k+1]); 
            (*csn) = csn_k_fail;
            if (k == np-1) 
               { nmsim_cohort_merge(&csn_lump, csn); }
	  }
      }
   
   }

void nmsim_mf_network_evolve
  (
  )
  {
    /* Compute the total input that each neuron {i} 
    in the population received from all its input synapses betwen time {t}
    and time {t+1} is a normal random variable
    with mean {DV_avg} and deviation {DV_dev}.  This potential
    increment includes the pulses {X[j,t]} of each input neuron {j}
    in the network, modulated by its output gain factor {H[j,t]} and
    by the rested synaptic gain {wfix[j,i]}; but not
    yet modulated by the input gain {G[i,t]} of neuron {i}. */


    /*  to the state of the cohort of 
    neurons with age 0 (those that just fired).
    Namely, the fields {cs.V,cs.G,cs.H} are set
    to the reset values {V_R,G_R,H_R}, respectively.
    The fraction {cs.eta} is set to {rho}. */
  }
