public static void end_current_run() {
    if (anim_stopped) {
      running = false;
    }
    if (incomplete && (output_analysis_type == BATCH_MEANS) && (!anim_stopped)) {
      // A termination condition of interval accuracy is being used
      running = true;
    } else {
      // Allow all entities to exit their body method
      Sim_entity ent;
      int entities_size = entities.size();
      for (int i=0; i < entities_size; i++) {
        ent = (Sim_entity)entities.get(i);
        if (ent.get_state() != Sim_entity.FINISHED) {
          ent.restart();
        }
      }
      // Wait for all entities to complete
      for (int i=0; i < entities_size; i++) {
        onecompleted.p();
      }
      if (incomplete && (!anim_stopped)) {
        // In the case of independent replications and an incomplete run we reset the simulation
        reset();
      }
    }
  }