示例#1
0
文件: game.c 项目: evktalo/lacewing
void begin_game(void)
{
 int i;

 counter = 0;

 init_structs_etc();

 for (i = 0; i < NO_ACTORS; i ++)
 {
  actor[i].in_play = 0;
 }

 player[0].score = 0;
 player[1].score = 0;

 if (game.type == GAME_SINGLE)
 {
  game.users = 1;

  actor[0].in_play = 0;
  player[game.single_player].actor_controlled = 0;
//  player[0].ships_left = 3;
  game.ships_left = 3;
  actor[0].controller = game.single_player;
  init_actor(0, player[game.single_player].ship); //ACTORTYPE_SHIP);
 }
  else
   {
    game.users = 2;

    actor[0].in_play = 0;
    player[0].actor_controlled = 0;
//    player[0].ships_left = 3;
    actor[0].controller = 0;
    init_actor(0, player[0].ship); //ACTORTYPE_SHIP);
 
    actor[1].in_play = 0;
    player[1].actor_controlled = 1;
//    player[1].ships_left = 3;
    actor[1].controller = 1;
    init_actor(1, player[1].ship); //ACTORTYPE_SHIP);
    game.ships_left = 6;
   }
   
 init_bullets();
 init_clouds();
 init_enemies();
 prepare_display();

 game.drag = 0.013;//955;//9999;
/*
 arena.max_x = 894000;
 arena.max_y = 895000;
*/

 arena.level = 0;

 init_level();


}
示例#2
0
文件: game.c 项目: evktalo/overgod
void begin_game(void)
{
 int i;

 counter = 0;

 init_structs_etc();

 for (i = 0; i < NO_ACTORS; i ++)
 {
  actor[i].in_play = 0;
 }

 player[0].score = 0;
 player[1].score = 0;

 if (game.type == GAME_SINGLE || game.type == GAME_TIME_ATTACK)
 {
  game.users = 1;

  actor[0].in_play = 0;
  player[game.single_player].actor_controlled = 0;
//  player[0].ships_left = 3;
  game.ships_left = 3;
  actor[0].controller = game.single_player;
  init_actor(0, player[game.single_player].ship); //ACTORTYPE_SHIP);
 }

 if (game.type == GAME_COOP || game.type == GAME_DUEL || game.type == GAME_TIME_ATTACK_COOP)
 {
    game.users = 2;

    actor[0].in_play = 0;
    player[0].actor_controlled = 0;
//    player[0].ships_left = 3;
    actor[0].controller = 0;
    init_actor(0, player[0].ship); //ACTORTYPE_SHIP);
 
    actor[1].in_play = 0;
    player[1].actor_controlled = 1;
//    player[1].ships_left = 3;
    actor[1].controller = 1;
    init_actor(1, player[1].ship); //ACTORTYPE_SHIP);
    game.ships_left = 6;
 }
 
   
 init_bullets();
 init_clouds();
// init_stars();
 init_enemies();
 prepare_display();

 game.drag = 0.013;//955;//9999;
/*
 arena.max_x = 894000;
 arena.max_y = 895000;
*/

 arena.level = 0;
 game.symbols_given = 0;

 init_level();

 long_slacktime = 0;
 arena.waver_on_level = 0;

}
示例#3
0
void setup_SF_related(int mySFi)
 /*
  *             |         RHOth indep. of Z               |       RHOth dep. on Z
  *  ==========================================================================================================
  *             |                                         |                                                  |
  *             | A calc. RHOth using Mth @ a given       | F calculate RHOth using the given Mth for each Z |
  *             |   Z using metal cooling                 |                                                  |
  *             |                                         |                                                  |
  *  RHOth from |   ................................      |                                                  |
  *  parameters |                                         |                                                  |
  *             | B calc. RHOth using Mth not using       |                                                  |
  *             |   the metal cooling                     |                                                  |
  *  ==========================================================================================================
  *             |                                         |                                                  |
  *             | C calc. Mth @ a given metallicity       | G calculate Mth @                                |
  *             |   keep Mth for all Z                    |   a given Z                                      |
  *  RHOth set  |   ...............................       |         \                                        |
  *  to a given | D calc. Mth not using the metal cool    |           --> keep Mth for all Z --> calc. RHOth |
  *  value      | --------------------------------------  |         /                                        |
  *             |                                         | H set Mth to a  given value                      |
  *             | E set Mth to a given value for all Z    |                                                  |
  * ===========================================================================================================
  *
  */
{
  int IMFi, j, k, filecount, set;

  double num_snII;

  double myPhysDensTh, myFEVP, m;

  double left, right;

  double feedbackenergyinergs;

  double *dummies, dummy, frac;

  int PATH;

  int exist_eff_model_file;

  char buffer[200];

  IMFi = SFs[mySFi].IMFi;
  IMFp = &IMFs[IMFi];

  if(SFs[mySFi].MaxSfrTimescale_rescale_by_densityth > 1)
    SFs[mySFi].MaxSfrTimescale /= 1.2 * sqrt(SFs[mySFi].MaxSfrTimescale_rescale_by_densityth);
  if(SFs[mySFi].MaxSfrTimescale_rescale_by_densityth < 1
     && SFs[mySFi].MaxSfrTimescale_rescale_by_densityth > 0)
    SFs[mySFi].MaxSfrTimescale *= 0.8 * sqrt(SFs[mySFi].MaxSfrTimescale_rescale_by_densityth);


  if(SFs[mySFi].egyShortLiv_MassTh > 0)
    /*
     *  Mth has been specified, check that it stays
     *  within boundaries.
     *  then translate it in a time threshold and calculate
     *  beta and egyspecSN.
     */
    {
      /* checks that the defined mass th does not fall in a BH mass range */
      j = not_in_BHrange(IMFi, &SFs[mySFi].egyShortLiv_MassTh);
      if(j == 0)
	{
	  if(ThisTask == 0)
	    {
	      fprintf(FdWarn, "incorrect IRA limit set by your parameters: out of range\n"
		      "  your inf IRA mass is %9.7g vs [%9.7g : %9.7g] Msun limits for the IMF\n"
		      "  better to stop here\n", SFs[mySFi].egyShortLiv_MassTh, IMFs[IMFi].Mm, IMFs[IMFi].MU);
	      fflush(FdWarn);
	      printf("incorrect IRA limit set by your parameters: out of range\n"
		     "  your inf IRA mass is %9.7g vs [%9.7g : %9.7g] Msun limits for the IMF\n"
		     "  better to stop here\n", SFs[mySFi].egyShortLiv_MassTh, IMFs[IMFi].Mm, IMFs[IMFi].MU);
	      fflush(stdout);
	    }
	  endrun(19001);
	}
      else if(j < 0)
	{
	  j *= -1;

	  if(IMFs[IMFi].N_notBH_ranges > j)
	    SFs[mySFi].metShortLiv_MassTh = IMFs[IMFi].notBH_ranges.inf[j];
	  else
	    SFs[mySFi].metShortLiv_MassTh = IMFs[IMFi].notBH_ranges.sup[j - 1];

	  if(ThisTask == 0)
	    {
	      fprintf(FdWarn, "The Short-Living mass limit has been set to %g in order to match"
		      " the non-BH range %d\n", SFs[mySFi].egyShortLiv_MassTh, j);
	      fflush(FdWarn);
	      printf("The Short-Living mass limit has been set to %g in order to match"
		     " the non-BH range %d\n", SFs[mySFi].egyShortLiv_MassTh, j);
	      fflush(stdout);
	    }
	}
      /* set the time th accordingly */
      SFs[mySFi].egyShortLiv_TimeTh = lifetime(SFs[mySFi].egyShortLiv_MassTh);

      calculate_ShortLiving_related((SF_Type *) & SFs[mySFi], 1);
    }

  if(SFs[mySFi].SFTh_Zdep == 1)
    /*
     * if metallicity dependence is on, check whether the
     * thresholds' file does exist
     */
    {
#ifdef LT_METAL_COOLING
      if(ThisTask == 0)
	{
	  exist_eff_model_file = 0;
	  if(RestartFlag == 2)
	    {
	      filecount = atoi(All.InitCondFile + strlen(All.InitCondFile) - 3);
	      exist_eff_model_file = read_eff_model(filecount, mySFi);
	    }
	  if(exist_eff_model_file == 0)
	    /* if restartflag is 2 but the eff model file for the snapshot is not
	     * present (j = 0), the code try again searching for the initial file */
	    exist_eff_model_file = read_eff_model(-1, mySFi);

	  if(exist_eff_model_file == 0)
	    {
	      reading_thresholds_for_thermal_instability();
	      for(j = 0; j < ZBins; j++)
		{
		  ThInst_onset[j] = pow(10, ThInst_onset[j]);
		  SFs[mySFi].FEVP[j] = All.TempSupernova / ThInst_onset[j];
		}
	    }
	}

      /* in case that the threshold file does not exist, the array will however be set to zero */
      MPI_Bcast((void *) &exist_eff_model_file, 1, MPI_INT, 0, MPI_COMM_WORLD);
      MPI_Bcast((void *) &SFs[mySFi].PhysDensThresh[0], ZBins * sizeof(double), MPI_BYTE, 0, MPI_COMM_WORLD);
      MPI_Bcast((void *) &SFs[mySFi].FEVP[0], ZBins * sizeof(double), MPI_BYTE, 0, MPI_COMM_WORLD);
      MPI_Bcast((void *) ThInst_onset, ZBins * sizeof(double), MPI_BYTE, 0, MPI_COMM_WORLD);
#endif
    }
  else
    {
      ThInst_onset[0] = 1e5;
      //      SFs[mySFi].FEVP = &All.FactorEVP;
      SFs[mySFi].FEVP[0] = All.TempSupernova / ThInst_onset[0];
    }

  PATH = (SFs[mySFi].SFTh_Zdep == 1);

  PATH |= ((SFs[mySFi].egyShortLiv_MassTh > 0) << 1);

  PATH |= ((SFs[mySFi].PhysDensThresh[0] > 0) << 2);

  if(PATH < 2)
    {
      printf
	("neither the Mass Threshold for the energy release nor the Density Threshold for the Star Formation have been specified..\n"
	 "I do feel difficult to continue. Better to think about a bit more..\n");
      endrun(LT_ERR_NOT_ENOUGH_PARAM_FOR_SF);
    }

  if(PATH < 4)
    /*
     * egyShortLiv_MassTh is specified
     * PhysDensThresh is not specified
     */
    {
      if(SFs[mySFi].SFTh_Zdep == 1)	/* PATH = 3 */
	{
	  /*
	   * metal dependence is on but the thresholds' file does not
	   * exist.
	   */
	  MPI_Barrier(MPI_COMM_WORLD);
	  init_clouds_cm(2, SFs[mySFi].PhysDensThresh, SFs[mySFi].FEVP,
			 SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
			 ZBins, &CoolZvalue[0]);
	}
      else			/* PATH = 2 */
	{
	  init_clouds(2, SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
		      SFs[mySFi].referenceZ_toset_SF_DensTh, SFs[mySFi].PhysDensThresh, SFs[mySFi].FEVP);
	}

      PATH = 8;
    }

  if(PATH < 6)
    /*
     * egyShortLiv_MassTh is not specified
     * PhysDensThresh is specified
     */
    {
      /* initial guess for Mth */
      SFs[mySFi].egyShortLiv_MassTh = All.Mup * 1.1;

      set = IMFs[IMFi].YSet;
      SD.Zbin = 0;
      SD.MArray = IIMbins[set];
      SD.Mdim = IIMbins_dim[set];
      SD.Y = SnIIEj[set];

      get_Egy_and_Beta(SFs[mySFi].egyShortLiv_TimeTh, &SFs[mySFi].EgySpecSN, &SFs[mySFi].FactorSN,
		       &SFs[mySFi]);
      init_clouds(2, SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
		  SFs[mySFi].referenceZ_toset_SF_DensTh, &myPhysDensTh, &myFEVP);

      while((fabs(myPhysDensTh - SFs[mySFi].PhysDensThresh[0]) / SFs[mySFi].PhysDensThresh[0] > 1e-2) &&
	    SFs[mySFi].egyShortLiv_MassTh > All.Mup &&
	    SFs[IMFi].egyShortLiv_MassTh < IMFs[IMFi].notBH_ranges.sup[0])
	/* note: because of using get_Egy_an_Beta, this calculations automatically
	 * exclude BH ranges
	 */
	{
	  if((myPhysDensTh - SFs[mySFi].PhysDensThresh[0]) < 0)
	    {
	      left = SFs[mySFi].egyShortLiv_TimeTh;
	      if(right == 0)
		SFs[mySFi].egyShortLiv_MassTh *= 0.8;
	      else
		SFs[mySFi].egyShortLiv_MassTh = (SFs[mySFi].egyShortLiv_MassTh + right) / 2;
	    }
	  else
	    {
	      right = SFs[mySFi].egyShortLiv_MassTh;
	      if(left == 0)
		SFs[mySFi].egyShortLiv_MassTh *= 1.2;
	      else
		SFs[mySFi].egyShortLiv_MassTh = (SFs[mySFi].egyShortLiv_MassTh + left) / 2;
	    }

	  if(SFs[mySFi].egyShortLiv_MassTh < All.Mup)
	    SFs[mySFi].egyShortLiv_MassTh = All.Mup;
	  else if(SFs[mySFi].egyShortLiv_MassTh > IMFs[IMFi].notBH_ranges.sup[0])
	    /* this prevent to fall in the last BH range: if it extend up to MU,
	     * we would obtain zero energy. If the energy is still not sufficient,
	     * the cycle will interrupt anyway due to the 3rd head condition */
	    SFs[mySFi].egyShortLiv_MassTh = IMFs[IMFi].notBH_ranges.sup[0];

	  get_Egy_and_Beta(SFs[mySFi].egyShortLiv_MassTh, &SFs[mySFi].EgySpecSN, &SFs[mySFi].FactorSN,
			   &SFs[mySFi]);

	  init_clouds(2, SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
		      SFs[mySFi].referenceZ_toset_SF_DensTh, &myPhysDensTh, &myFEVP);
	}

      /* checks that found mass does not fall in a BH mass range */
      for(j = 0;
	  (j < IMFs[IMFi].N_notBH_ranges) &&
	  (SFs[mySFi].egyShortLiv_MassTh <= IMFs[IMFi].notBH_ranges.inf[j]); j++)
	;
      if(j < IMFs[IMFi].N_notBH_ranges)
	if(SFs[mySFi].egyShortLiv_MassTh > IMFs[IMFi].notBH_ranges.sup[j])
	  /* this case can arise only when at least 1 BH interval lives
	   * between 2 nom-BH intervals: then, j shold be > 0.
	   */
	  SFs[mySFi].egyShortLiv_MassTh = IMFs[IMFi].notBH_ranges.sup[j - 1];


      if((myPhysDensTh - SFs[mySFi].PhysDensThresh[0]) / SFs[mySFi].PhysDensThresh[0] > 1e-2 && ThisTask == 0)
	{
	  if(SFs[mySFi].egyShortLiv_MassTh == All.Mup)
	    {
	      fprintf(FdWarn, "  . warning: the needed Mass Threshold for a star to be\n"
		      "             short--living would be lower that %5.3f Msun.\n"
		      "             we set it to %5.3f Msun; pls check sfrrate.txt\n", All.Mup, All.Mup);
	      fflush(stdout);
	    }
	  else if(SFs[mySFi].egyShortLiv_MassTh == IMFs[IMFi].MU)
	    {
	      fprintf(FdWarn, "  . warning: the needed Mass Threshold for a star to be\n"
		      "             short--living would be larger that %5.3f Msun.\n"
		      "             we set it to %5.3f Msun; pls check sfrrate.txt\n",
		      IMFs[IMFi].MU, IMFs[IMFi].MU);
	      fflush(stdout);
	    }
	  else
	    {
	      fprintf(FdWarn, "  . warning: Mass Threshold for a star to be short-living is\n"
		      "             %5.3f Msun; this would set a physical density threshold for\n"
		      "             the star formation different than that you set in paramfile.\n"
		      "             pls, check sfrrate.txt\n", SFs[mySFi].egyShortLiv_MassTh);
	      fflush(stdout);
	    }
	}

      calculate_ShortLiving_related(&SFs[mySFi], 1);

      PATH |= 2;
    }


  if(PATH == 7)
    /* if PATH == 6 nothing is left to be done */
    /*
     * egyShortLiv_MassTh is specified
     * PhysDensThresh is specified
     */
    {

      if(SFs[mySFi].SFTh_Zdep == 1 &&	/* PATH = 7 */
	 exist_eff_model_file == 0)	/* assume that the variable has been set */
	{
	  dummies = (double *) mymalloc("dummies", ZBins * sizeof(double));
	  dummy = SFs[mySFi].PhysDensThresh[0];

	  /* calculate expected thresholds for all metallicities, given the mass EgyMassTh */
	  MPI_Barrier(MPI_COMM_WORLD);
	  init_clouds_cm(2, dummies, SFs[mySFi].FEVP,
			 SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
			 ZBins, &CoolZvalue[0]);

	  /* now apply relative variations due to metallicities to the specified rho_threshold */

	  if(ZBins > 1)
	    {
	      for(j = ZBins - 1; (j > 0) && (SFs[mySFi].referenceZ_toset_SF_DensTh < CoolZvalue[j]); j--)
		;

	      if(j == ZBins - 1)
		j--;

	      if(SFs[mySFi].referenceZ_toset_SF_DensTh > CoolZvalue[j] * (1 + 0.01) ||
		 SFs[mySFi].referenceZ_toset_SF_DensTh < CoolZvalue[j] * (1 - 0.01))
		frac = (SFs[mySFi].referenceZ_toset_SF_DensTh - CoolZvalue[j]) *
		  (dummies[j + 1] - dummies[j]) / (CoolZvalue[j + 1] - CoolZvalue[j]);
	      else
		frac = dummy / dummies[j];

	      for(j = 0; j < ZBins; j++)
		{
		  if(SFs[mySFi].referenceZ_toset_SF_DensTh > CoolZvalue[j] * (1 + 0.01) ||
		     SFs[mySFi].referenceZ_toset_SF_DensTh < CoolZvalue[j] * (1 - 0.01))
		    SFs[mySFi].PhysDensThresh[j] = dummies[j] * frac;
		  else
		    SFs[mySFi].PhysDensThresh[j] = dummy;
		}

	    }
	  myfree(dummies);
	}
    }

#ifndef LT_WIND_VELOCITY
#ifdef LT_ALL_SNII_EGY_INWINDS
      feedbackenergyinergs =
	SFs[mySFi].TOT_erg_per_g / All.UnitMass_in_g * (All.UnitEnergy_in_cgs * SOLAR_MASS);
      SFs[mySFi].WindEnergy =
	sqrt(2 * SFs[mySFi].WindEnergyFraction * SFs[mySFi].TOT_erg_per_g / SFs[mySFi].WindEfficiency);
#else
      feedbackenergyinergs =
	SFs[mySFi].IRA_erg_per_g / All.UnitMass_in_g * (All.UnitEnergy_in_cgs * SOLAR_MASS);
      SFs[mySFi].WindEnergy =
	sqrt(2 * SFs[mySFi].WindEnergyFraction * SFs[mySFi].IRA_erg_per_g / SFs[mySFi].WindEfficiency);
#endif
#else
      feedbackenergyinergs = All.FeedbackEnergy / All.UnitMass_in_g * (All.UnitEnergy_in_cgs * SOLAR_MASS);
      SFs[mySFi].WindEnergy = LT_WIND_VELOCITY;
#ifdef LT_ALL_SNII_EGY_INWINDS
      SFs[mySFi].WindEnergyFraction =
	SFs[mySFi].WindEnergy * SFs[mySFi].WindEnergy * SFs[mySFi].WindEfficiency / (2 *
										     SFs
										     [mySFi].TOT_erg_per_g);
#else
      SFs[mySFi].WindEnergyFraction =
	SFs[mySFi].WindEnergy * SFs[mySFi].WindEnergy * SFs[mySFi].WindEfficiency / (2 *
										     SFs
										     [mySFi].IRA_erg_per_g);
#endif
#endif

      if(ThisTask == 0)
	{
	  printf("Energy Fraction in Winds= %g\n", SFs[mySFi].WindEnergyFraction);
	  printf("Winds Mass load efficiency= %g\n", SFs[mySFi].WindEfficiency);
	  printf("PhysDensThresh= %g (internal units)\n", SFs[mySFi].PhysDensThresh[0]);

	  fprintf(FdSnInit, "\n[Winds]\nEnergy Fraction in Winds= %g \n", SFs[mySFi].WindEnergyFraction);
	  fprintf(FdSnInit, "Winds Mass load efficiency= %g\n", SFs[mySFi].WindEfficiency);
	  fprintf(FdSnInit, "\n[SF Rho Threshold]\nPhysDensThresh= %g (internal units)\n",
		  SFs[mySFi].PhysDensThresh[0]);
	}

#ifndef LT_METAL_COOLING_WAL
  if(ThisTask == 0)
    printf("determining Kennicutt law%c..\n", (SFs[mySFi].SFTh_Zdep ? 's' : ' '));
  fflush(stdout);


  if(SFs[mySFi].SFTh_Zdep == 0)
    {

      //SFs[mySFi].FEVP = &All.FactorEVP;
      if(ThisTask == 0)
	{
	  sfrrate_filenum = mySFi;
	  init_clouds(0, SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
		      SFs[mySFi].referenceZ_toset_SF_DensTh, SFs[mySFi].PhysDensThresh, SFs[mySFi].FEVP);
	}
    }
  else
    {
      init_clouds_cm(0, SFs[mySFi].PhysDensThresh, SFs[mySFi].FEVP,
		     SFs[mySFi].EgySpecSN, SFs[mySFi].FactorSN, SFs[mySFi].MaxSfrTimescale,
		     ZBins, &CoolZvalue[0]);
      if(ThisTask == 0)
	write_eff_model(-1, mySFi);
    }
#endif

  MPI_Barrier(MPI_COMM_WORLD);

  if(ThisTask == 0)
    {
      printf("Feedback energy per formed solar mass in stars= %g  ergs\n"
	     "Wind Velocity= %g Km/s\n", feedbackenergyinergs, SFs[mySFi].WindEnergy);

      fprintf(FdSnInit, "Feedback energy per formed solar mass in stars= %g  ergs\n"
	      "Wind Velocity= %g Km/s\n", feedbackenergyinergs, SFs[mySFi].WindEnergy);
    }

  m = max(IMFs[IMFi].Mm, All.Mup);

  if(SFs[mySFi].metShortLiv_MassTh <= m)
    SFs[mySFi].metShortLiv_MassTh = m;
  else if(SFs[mySFi].metShortLiv_MassTh > IMFs[IMFi].MU)
    SFs[mySFi].metShortLiv_MassTh = IMFs[IMFi].MU;

  /* checks that the defined mass th does not fall in a BH mass range */
  for(j = 0;
      (j < IMFs[IMFi].N_notBH_ranges) &&
      (SFs[mySFi].metShortLiv_MassTh <= IMFs[IMFi].notBH_ranges.inf[j]); j++)
    ;

  if(j < IMFs[IMFi].N_notBH_ranges)
    if(SFs[mySFi].metShortLiv_MassTh > IMFs[IMFi].notBH_ranges.sup[j])
      {
	if(j == 0)
	  /* if the mass th falls ini the upper BH range, and that BH range reaches
	   *  MU, then it's impossible to correctly adjust the mass th
	   */
	  {
	    if(ThisTask == 0)
	      {
		printf("The Short-Living mass limit for metal release that you defined is not\n"
		       "compatible with the BH ranges that you defined. Pls check all that in\n"
		       "param file and in IMF file\n");
		endrun(LT_ERR_MISMATCH_ShL_TH_BHranges);
	      }
	  }
	else
	  {
	    SFs[mySFi].metShortLiv_MassTh = IMFs[IMFi].notBH_ranges.inf[j - 1];
	    fprintf(FdWarn,
		    "The Short-Living mass limit for metal release has been set to %g in order to match"
		    " with the non-BH range %d\n", SFs[mySFi].egyShortLiv_MassTh, j);
	  }
      }

  SFs[mySFi].metShortLiv_TimeTh = lifetime(SFs[mySFi].metShortLiv_MassTh);

  if(ThisTask == 0)
    {
      if(SFs[mySFi].metShortLiv_MassTh < IMFs[IMFi].MU)
	printf(":: metal IRA is active in the range [%9.7g - %9.7g]Msun <> [%9.7g - %9.7g]Gyr\n",
	       IMFs[IMFi].MU, SFs[mySFi].metShortLiv_MassTh, IMFs[IMFi].inf_lifetime,
	       SFs[mySFi].metShortLiv_TimeTh);
      else
	printf(":: metal IRA is not active\n");
    }

  if(SFs[mySFi].metShortLiv_MassTh < IMFs[IMFi].MU)
    {
      /* mass fraction involved in SnII */
      SFs[mySFi].MassFrac_inIRA =
	IntegrateIMF_byMass(SFs[mySFi].metShortLiv_MassTh, IMFs[IMFi].MU, &IMFs[IMFi], INC_BH);
      /* expected number of SnII per initial stellar population mass in units of solar masses IN IRA RANGE */
      SFs[mySFi].NumFrac_inIRA =
	IntegrateIMF_byNum(SFs[mySFi].metShortLiv_MassTh, IMFs[IMFi].MU, &IMFs[IMFi], EXC_BH);
      /* expected number of SnII per initial stellar population mass in units of solar masses */
      num_snII = IntegrateIMF_byNum(max(All.Mup, IMFs[IMFi].Mm), IMFs[IMFi].MU, &IMFs[IMFi], EXC_BH);

      if(ThisTask == 0)
	printf("    %.3lg%% of mass in metal IRA tail\n", SFs[mySFi].MassFrac_inIRA * 100);

      /* ...........: calculates the restored fraction :................... */
      if(ThisTask == 0)
	printf("   metal IRA, calculating restored fraction..\n");



/* ...........: calculates the effective yields :................... */

      if(ThisTask == 0)
	printf(":: calculating effective yields for Short-Living Stars..\n");


      SD.Yset = IMFs[IMFi].YSet;

      sprintf(buffer, "SnII_ShortLiv_Yields_%2d", mySFi);
      SnII_ShortLiv_Yields[mySFi] = (double **) mymalloc(buffer, LT_NMet * sizeof(double *));
      for(k = 0; k < LT_NMet; k++)
	{
	  sprintf(buffer, "SnII_ShortLiv_Yields_%2d_%d", mySFi, k);
	  SnII_ShortLiv_Yields[mySFi][k] = (double *) mymalloc(buffer, IIZbins_dim[SD.Yset] * sizeof(double));
	}

/* #if defined (UM_CHEMISTRY) && defined (UM_METAL_COOLING) */
/*       IIShLv_AvgFillNDens[IMFi] = (double*)calloc(IIZbins_dim[SD.Yset], sizeof(double)); */
/* #endif */

      SFs[mySFi].nonZeroIRA = calculate_effective_yields(SFs[mySFi].metShortLiv_MassTh, IMFs[IMFi].MU, IMFi);

      for(j = 0; j < IIZbins_dim[SD.Yset]; j++)
	{
	  if(j == 0)
	    {
	      SD.Zbin = j;
	      SD.MArray = IIMbins[SD.Yset];
	      SD.Mdim = IIMbins_dim[SD.Yset];
	      SD.Y = SnIIYields[SD.Yset][FillEl];
	      SFs[mySFi].metFactorSN = calculate_FactorSN(SFs[mySFi].metShortLiv_MassTh, IMFs[IMFi].MU, &IMFs[IMFi]);	/* restored by IRA SnII */
	    }

	  if(ThisTask == 0)
	    {
	      fprintf(FdSnInit, "\n[Effective Yields for Short-Living stars :: set %03d - Z %8.6g]\n",
		      SD.Yset, (IIZbins_dim[SD.Yset] > 1) ? IIZbins[SD.Yset][j] : 0);
	      fprintf(FdSnInit, " %3s  %6s   %10s %10s\n", "IMF", "Z", "name", "Yield");
	      printf(" %3s  %6s   %10s %10s\n", "IMF", "Z", "name", "Yield");
	      for(k = 0; k < LT_NMet; k++)
		{
		  printf(" [%3d][%8.6g]   %10s %10.7lg\n",
			 IMFi, (IIZbins_dim[SD.Yset] > 1) ? IIZbins[SD.Yset][j] : 0,
			 MetNames[k], SnII_ShortLiv_Yields[mySFi][k][j]);
		  fprintf(FdSnInit, " [%3d][%8.6g] %10s %10.7lg\n",
			  SD.Yset, (IIZbins_dim[SD.Yset] > 1) ? IIZbins[SD.Yset][j] : 0,
			  MetNames[k], SnII_ShortLiv_Yields[mySFi][k][j]);
		}
	    }
	}
    }
  else
    {
      SFs[mySFi].MassFrac_inIRA = 0;
      SFs[mySFi].NumFrac_inIRA = 0;
      SFs[mySFi].nonZeroIRA = 0;
      num_snII = 0;
      SnII_ShortLiv_Yields[mySFi] = 0x0;
      SFs[mySFi].metFactorSN = 0;
      if(ThisTask == 0)
	{
	  printf(":: No metals are supposed to be promptly ejected..\n");
	  fprintf(FdSnInit, "\n[Effective Yields for IRA part]\n"
		  "No metals are supposed to be promptly ejected..\n");
	}
    }

  if(ThisTask == 0)
    printf("\n\n");


}