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); }
	  }
      }
   
   }

