Esempio n. 1
0
void Absorbator()
{
   int Z=14, A=28, Zi=2, Ai=3;
   long nstep=1000;
   float Ti=45., hmax=19.0;
   char list='n', inbuf[130];
   float Ek, h, I, c, Mir;
   
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   printf(" Give Z for the absorbating medium (%3d): ",Z);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Z);

   printf(" Give A for the absorbating medium (%3d): ",A);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&A);

   printf(" Give Z for the projectile (%3d): ",Zi);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Zi);

   printf(" Give A for the projectile (%3d): ",Ai);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Ai);

   printf(" Give the thickness (micrometer) (%4.1f): ",hmax);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&hmax);

   printf(" Give # integration step (%ld): ",nstep);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%ld",&nstep);

   printf(" Do you want energies for each integration step (y/n) (%c): ",list);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%c",&list);
   list=tolower(list);

   if(Rho(Z)*Mass(Ai)<0.0001) return;
   h   = hmax/(float)nstep*1.e-4;
   I   = 9.1*Z*(1+1.9*pow(Z,(-2./3.)))*1.e-6;
   c   = 0.30707*Rho(Z)*Z/(float)A*Zi*Zi;
   Mir = (Mass(Ai)-Zi*0.000549)*931.5016;

   printf(" Give energy of the projectile (-1 = stop) (%3.1f): ",Ti);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Ti);

   while (Ti!=-1)
   {
   Ek = Ti;
   Ek = Rk4(Ek, c, Mir, I, h, nstep, list);
   printf("\n The final energy is %7.3f MeV with energy loss of %7.3f MeV",
   Ek, Ti-Ek);
   printf("\n\n Give energy of the projectile (-1 = stop) (%3.1f): ",Ti);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Ti);
   }
}
Esempio n. 2
0
void Density()
{
   char inbuf[130];
   int Z = 13;
   
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   printf(" Give atomic mass number Z (%d): ",Z);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Z);

   if(Rho(Z)<0.00001)return;
   printf(" Density is:  %5.2f g/cm**3",Rho(Z));
   return;
}
Esempio n. 3
0
 void Meter()
{
   char inbuf[130];
   float tmg = 2.2;
   int Z = 13;
   
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   printf(" Give thickness in mg/cm**2 (%3.1f): ",tmg);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&tmg);

   printf(" Give atomic mass number Z (%d): ",Z);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Z);

   if(Rho(Z)<0.00001)return;
   printf("\n Thickness in micrometer is:  %5.2f",tmg*10./Rho(Z));
   return;
}
Esempio n. 4
0
void Gram()
{
   char inbuf[130];
   float tmicro = 19.;
   int Z = 13;

   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   printf(" Give thickness in micrometer (%3.1f): ",tmicro);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&tmicro);

   printf(" Give atomic mass number Z (%d): ",Z);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Z);

   if(Rho(Z)<0.00001)return;
   printf(" Thickness in mg/cm**2 is:  %5.2f",tmicro*Rho(Z)/10.);
   return;
}
Esempio n. 5
0
void Relkinematic()
{
   int Ai=3, Af=4, Ar=172;
   float Ti=45., Q=15., theta=45., thetar;
   float Mi, Mf, Mr, Ek;
   char inbuf[130];
   
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   printf(" Give A for the projectile (%3d): ",Ai);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Ai);

   printf(" Give A for the light-product (%3d): ",Af);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Af);

   printf(" Give A for the rest-nucleus (%3d): ",Ar);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Ar);

   printf(" Give the energy of the projectile (%3.1f): ",Ti);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Ti);

   printf(" Give Q-value for the reaction (%3.1f): ",Q);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Q);

   printf(" Give angle in degree (-1 = stop) (%3.1f): ",theta);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&theta);

   while(theta != -1)
   {
      thetar = theta*M_PI/180.;
      Mi = Mass(Ai);
      Mf = Mass(Af);
      Mr = Mass(Ar);
      if(Mr*Mf*Mi<0.0001)
        return;
      Ek = Relkin(Mi, Mf, Mr, Ti, Q, thetar);
      printf(" Kinetic energy of the light-product %6.3f",Ek);
      printf("\n\n Give angle in degree (-1 = stop) (%3.1f): ",theta);
      fgets_ignore(inbuf,sizeof(inbuf),stdin);
      sscanf(inbuf,"%f",&theta);
   }
}
Esempio n. 6
0
int main () 
{
	char    line[128];
    char    cdum[128];
    int     i;
    m_p   = m_p*c2   - 1.*m_e;                               // nuclear masses in MeV
    m_d   = m_d*c2   - 1.*m_e;
    m_3he = m_3he*c2 - 2.*m_e;
    m_4he = m_4he*c2 - 2.*m_e;

    printf("\n");
    printf("  _________________________________________ \r\n");
    printf(" |                                         |\r\n");
    printf(" |              A N M A G  1.0             |\r\n");
    printf(" |                                         |\r\n");
    printf(" |         Program to calculate the        |\r\n");
    printf(" |       I(A) and B(T) for a certain       |\r\n");
    printf(" |       particle type (p,d,3He,4He)       |\r\n");
    printf(" |  with a certain kinetic energy T(MeV)   |\r\n");
    printf(" |                                         |\r\n");
    printf(" |   Relativistic expressions are used:    |\r\n");
    printf(" |            T = E - mc^2 and             |\r\n");
    printf(" |         E^2= (pc)^2 + (mc^2)^2          |\r\n");
    printf(" |                                         |\r\n");
    printf(" | E-mail  : [email protected]   |\r\n");
    printf(" | Created : 25 Feb 2014                   |\r\n");
    printf(" | Modified: 08 Mar 2014                   |\r\n");
    printf(" |_________________________________________|\r\n");
    printf("                                           \r\n");

    fp = fopen("anmag_in.txt", "r");
    if(fp == NULL){
        printf("Could not open file anmag_in.txt, default values are used \n");
    }else{
        fgets_ignore(line,sizeof(line),fp);
        sscanf(line, " %d %f \n",  &type,&T);
    }
    fclose(fp);

    printf("\nParticle type (p,d,3He,4He) = (1,2,3,4):  <%1d>",type);
    fgets_ignore(line,sizeof(line),stdin);
    sscanf(line,"%d", &type);
    if(type==1){
        q   = 1.*e;
        mc2 = m_p;
    }
    if(type==2){
        q   = 1.*e;
        mc2 = m_d;
    }
    if(type==3){
        q   = 2.*e;
        mc2 = m_3he;
    }
    if(type==4){
        q   = 2.*e;
        mc2 = m_4he;
    }
        
    printf("\nParticle kinetic energy:             <%7.3f>", T);
    fgets_ignore(line,sizeof(line),stdin);
    sscanf(line,"%f", &T);
    
    printf("\nMass %7.3e,  charge %7.3e, type particle %d, and beam energy %6.3f",mc2,q,type,T);

    p = p_func( T,  mc2);
    B = B_func( p,  q,  r);
    I = a0 + a1 * B;
	
    printf("\nMomentum p %7.3e,  field B %7.3e, Coil currents (A) %f\n",p,B,I);
    
    
    fp = fopen("anmag_in.txt", "w");
    if(fp == NULL){
        printf("Could not open file anmag_in.txt \n");
    }else{
       fprintf(fp,"%d %f \n", type,T);
    }
    fclose(fp);
    
    fp = fopen("anmag_out.txt", "w");
    for(i=1;i<=500;i++){
        T=((float)i)/10.;
        p1=p_func(T,m_p);
        B1=B_func(p1,1.*e,r);
        I1 = a0 + a1 * B1;
        p2=p_func(T,m_d);
        B2=B_func(p2,1.*e,r);
        I2 = a0 + a1 * B2;
        p3=p_func(T,m_3he);
        B3=B_func(p3,2.*e,r);
        I3 = a0 + a1 * B3;
        p4=p_func(T,m_4he);
        B4=B_func(p4,2.*e,r);
        I4 = a0 + a1 * B4;
        fprintf(fp," %7.1f   %7.3f %7.2f    %7.3f %7.2f    %7.3f %7.2f    %7.3f %7.2f \n",T,B1,I1,B2,I2,B3,I3,B4,I4);
    }
    fclose(fp);
    return 0;
}
Esempio n. 7
0
void Ispin()
{
   int Ai=3, Af=4, At=163, Ar=162;
   float Ti=45., Tf = 20., Q=15., Ex, Theta=45., Thetar;
   float Mi, Mf, Mt, Mr, k1, k2, R1, R2, DSpin, CSpin;
   char inbuf[130];
   
   
   
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   
   printf(" Give Q-value for the reaction (%3.1f): ",Q);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Q);
      
   printf(" Give A for the projectile (%3d): ",Ai);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Ai);

   printf(" Give A for the light-product (%3d): ",Af);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Af);

   printf(" Give A for the target-nucleus (%3d): ",At);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&At);
   Ar=At+Ai-Af;

   printf(" Give the energy of the projectile (%3.1f): ",Ti);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Ti);

   printf(" Give the energy of the ejectile   (%3.1f): ",Tf);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Tf);
   Ex=Q+Ti-Tf;

   printf(" Give scattering angle in degrees  (%3.1f): ",Theta);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Theta);
   
/* Transfering values to MeV and fm. Atomic masses are used (incorrect!) */
   Thetar = 2.*3.1415927*Theta/360.;
   Mi = Mass(Ai)*931.502;
   Mf = Mass(Af)*931.502;
   Mr = Mass(Ar)*931.502;
   Mt = Mass(At)*931.502;
   
/* Finding the corresponding wavenumbers k in units of 1/fm */
   k1=(1./197.329)*sqrt(2.*Mi*Ti);  
   k2=(1./197.329)*sqrt(2.*Mf*Tf);
 
/* Finding average radius of the nucleus */
   R1=1.25*(pow(At,0.333333)+pow(Ai,0.333333));
   R2=1.25*(pow(Ar,0.333333)+pow(Af,0.333333));

/* Calculating the maximum spin transfer */
   DSpin=0.5*(R1+R2)*sqrt(k1*k1+k2*k2 -2.*k1*k2*cos(Thetar));
   CSpin=R1*k1 + R2*k2;
       
   printf(  " Maximum spintransfer for direct reaction at Ex= %6.3f is %6.3f",Ex,DSpin);
   printf("\n Maximum spintransfer for comp.  reaction at Ex= %6.3f is %6.3f",Ex,CSpin);   
 
}
Esempio n. 8
0
void Straggling()
{
   int Z=70, A=173, Zi=2, Ai=3, Zf=2, Af=4, Zr, Ar;
   long nstep =1000;
   float Ti=45., d=2., Q=15., Ex=0., theta=45., thetar;
   float I, c, Mi, Mf, Mr, Mir, Mfr;
   float d1, d2, E1s, E2s, h1, h2, dh1, dh2;
   float Ek1, Ek2, Ekf, dE;
   char inbuf[130];
   
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   printf(" Give Z for the absorbating medium (%3d): ",Z);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Z);

   printf(" Give A for the absorbating medium (%3d): ",A);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&A);

   printf(" Give Z for the projectile (%3d): ",Zi);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Zi);

   printf(" Give A for the projectile (%3d): ",Ai);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Ai);

   printf(" Give Z for the light-product (%3d): ",Zf);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Zf);

   printf(" Give A for the light-product (%3d): ",Af);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%d",&Af);

   printf(" Give energy of the projectile (%3.1f): ",Ti);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Ti);

   printf(" Give the thickness of target (mg/cm**2) (%3.1f): ",d);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&d);

   printf(" Give Q-value for the reaction (%3.1f): ",Q);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Q);

   printf(" Give exitation-energy for the nucleus (%3.1f): ",Ex);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&Ex);
   if(Rho(Z)*Mass(Ai)*Mass(Af)<0.0001) return;
   I = 9.1*Z*(1.+1.9*pow(Z,(-2./3.)))*1e-6;
   c  = 0.30707*Rho(Z)*Z/(float)A*Zi*Zi;
   Zr = Z + Zi - Zf;
   Ar = A + Ai - Af;
   Mi = Mass(Ai) - Zi*0.000549;
   Mf = Mass(Af) - Zf*0.000549;
   Mr = Mass(Ar) - Zr*0.000549;
   Mir = Mi*931.5016;
   Mfr = Mf*931.5016;

   printf(" Give angle in degree (-1 = stop) (%3.1f): ",theta);
   fgets_ignore(inbuf,sizeof(inbuf),stdin);
   sscanf(inbuf,"%f",&theta);
   while(theta!=-1)
   {
      thetar = 2*3.14159*theta/360.;
      d1  = d;
      d2  = d/cos(thetar);
      E1s = 18.*Zi*sqrt(d1);
      E2s = 18.*Zf*sqrt(d2);
      h1  = d1/Rho(Z)*1.e-5;
      h2  = d2/Rho(Z)*1.e-5;
      dh1 = h1/(float)nstep*100.;
      dh2 = h2/(float)nstep*100.;

      Ek1 = Ti;
      Ek2 = Ti;
      Ek1 = Rk4(Ek1,c,Mir,I,dh1,nstep,'n');
      Ek1 = Relkin(Mi,Mf,Mr,Ek1,Q,thetar);
      Ek2 = Relkin(Mi,Mf,Mr,Ek2,Q,thetar);
      Ek2 = Rk4(Ek2-Ex,c,Mfr,I,dh2,nstep,'n');
      Ekf = sqrt(.5*((Ek1-Ex)*(Ek1-Ex)+Ek2*Ek2));
      dE  = sqrt(((Ek1-Ex-Ek2)*1000.)*((Ek1-Ex-Ek2)*1000.) + 0.5*(E1s*E1s+E2s*E2s));
      printf("\n The final energy is %6.3f MeV  with FWHM %5.1f keV",Ekf,dE);
      printf(" \n\n Give angle in degree (-1 = stop) (%3.1f): ",theta);
      fgets_ignore(inbuf,sizeof(inbuf),stdin);
      sscanf(inbuf,"%f",&theta);
   }
}
int main()
{
	printf("\n");
	printf("  ______________________________________________________________ \r\n");
	printf(" |                                                              |\r\n");
	printf(" |               N O R M A L I Z A T I O N  1.5.2               |\r\n");
	printf(" |                                                              |\r\n");
	printf(" |  Program to normalize the gamma-ray strength function f(Eg)  |\r\n");
	printf(" |         to the total average radiation width Gamma           |\r\n");
	printf(" |                     measured at Bn or Bp                     |\r\n");
	printf(" |        (based on normalization.f by Andreas Schiller)        |\r\n");
  	printf(" |                                                              |\r\n");
	printf(" |  Input files: rhotmopaw.cnt    Output files: input.nrm       |\r\n");
	printf(" |               sigextpaw.cnt                  strength.nrm    |\r\n");
	printf(" |               spincut.cnt                    trans.nrm       |\r\n");
	printf(" |               sigpaw.cnt                     transext.nrm    |\r\n");
	printf(" |               (input.nrm)                    strength.cpp    |\r\n");
	printf(" |                                                              |\r\n");
	printf(" | E-mail  : [email protected]                        |\r\n");
	printf(" | Created : 14 Nov 2006                                        |\r\n");
	printf(" | Modified: 26 Mar 2014                                        |\r\n");
    printf(" | Modified: 28 Aug 2015 replace ? and deleting kumac files     |\r\n");
	printf(" |______________________________________________________________|\r\n");
	printf("                                                                 \r\n");
	
	/* ************************************************** */
	/* Reading calibration and dimensions from: rhosp.rsg */
	/* ************************************************** */
	printf("Reading calibration and dimensions from: rhosp.rsg\n");
	fp = fopen("rhosp.rsg", "r");
	if(fp == NULL){
		printf("No rhosp.rsg file found in your directory\n");
		exit(0);
	}
	else {
		fgets_ignore(line,sizeof(line),fp);
		fgets_ignore(line,sizeof(line),fp);
		fgets_ignore(line,sizeof(line),fp);
		fgets_ignore(line,sizeof(line),fp);
		fgets_ignore(line,sizeof(line),fp);
		fgets_ignore(line,sizeof(line),fp);
		fgets_ignore(line,sizeof(line),fp);
		sscanf(line,"%13s %7s %f %s %f",cdum, cdum, &a0, cdum, &a1);
		fgets_ignore(line,sizeof(line),fp);	
		fgets_ignore(line,sizeof(line),fp);
		sscanf(line,"%s %d %s %d",cdum, &dimx, cdum, &dimy);
		fgets_ignore(line,sizeof(line),fp);
		fclose(fp);
	}
  	printf("Dimension (0 : %d, 0 : %d) and calibration (a0, a1) = (%8.2f,%8.3f)\n",dimx,dimy,a0,a1);

	/* ***************************************** */
	/* Reading default values from previous runs */
	/* ***************************************** */
	fp = fopen("input.nrm", "r");
	if(fp == NULL){
		printf("\nCould not open file input.nrm, default values are used \n");
	}
	else {
		fgets_ignore(line,sizeof(line),fp);
		sscanf(line, " %d %f %f\n", &ell, &Bn, &It);
		fgets_ignore(line,sizeof(line),fp);
		sscanf(line, " %f %f \n", &D0, &G0);
		fgets_ignore(line,sizeof(line),fp);
		sscanf(line, " %f %f \n", &D1, &G1);
		fclose(fp);
	}
	
	/* ***************************************** */
	/* Reading default values from previous runs */
	/* ***************************************** */
	fp = fopen("input.cnt", "r");
	if(fp == NULL){
		printf("\nCould not open file input.cnt, default Bn value is used \n");
	}
	else {
		fgets_ignore(line,sizeof(line),fp);
		sscanf(line, " %f %f %f %f %f \n", &dum, &dum, &BnOld, &dum, &dum);
		if(Bn == BN0)Bn = BnOld;
		fclose(fp);
	}
  
	/* *********************** */
	/* Asking for input values */
	/* *********************** */
	
	printf("s- (l=0) or p- (l=1) wave neutron/proton capture               <%1d>:",ell);
	fgets_ignore(line,sizeof(line),stdin);
	sscanf(line,"%d", &ell);
	if(ell == 0){
		D   = D0;
		G	= G0;
	}
	else{
		D   = D1;
		G	= G1;
	}
	
	printf("Neutron or proton binding energy (Bn or Bp) (MeV)         <%6.3f>:",Bn);
	fgets_ignore(line,sizeof(line),stdin);
	sscanf(line,"%f", &Bn);
	
	printf("Target spin in (n,g) or (p,g) reaction (for the A-1 nucleus). Use\n");
	printf("values 0.0, 1.0,... for even and 0.5, 1.5,... for odd spins <%4.1f>:",It);

	fgets_ignore(line,sizeof(line),stdin);
	sscanf(line,"%f", &It);
		
	printf("Neutron resonance spacing parameter D (eV)                <%6.1f>:",D);
	fgets_ignore(line,sizeof(line),stdin);
	sscanf(line,"%f", &D);
  
	printf("Average total radiative resonance width G (meV)           <%6.1f>:",G);
	fgets_ignore(line,sizeof(line),stdin);
	sscanf(line,"%f", &G);

	/* ***********************************/
	/* Number of channels up to Bn or Bp */
	/* ***********************************/
    Bn_keV = Bn*1000.;
	Nch = 1 + (int)(((Bn_keV-a0)/a1)+0.5);
	
	/* ***************************************************************** */
	/* Reading data of experimental nuclear level density: rhotmopaw.cnt */
	/* ***************************************************************** */
	printf("\nReading data of experimental nuclear level density: rhotmopaw.cnt\n");
	fp = fopen("rhotmopaw.cnt", "r");
	if(fp == NULL){
		printf("No rhotmopaw.cnt file found in your directory\n");
		exit(0);
	}
	i = 0 ;
	while( i < Nch){
      if(fgets(line,sizeof(line),fp) != NULL){sscanf(line,"%f", &rho[i]);}
	   i++; 
	}
	fclose(fp);
	
	/* ******************************************************************* */
	/* Reading data of extrapolated transmision coefficient: sigextpaw.cnt */
	/* ******************************************************************* */
	printf("Reading data of experimental transmision coefficient: sigextpaw.cnt\n");
	fp = fopen("sigextpaw.cnt", "r");
	if(fp == NULL){
		printf("No sigextpaw.cnt file found in your directory\n");
		exit(0);
	}
	i = 0 ;
	while(i < Nch){           //*10, to be sure long enough search for data
		if(fgets(line,sizeof(line),fp) != NULL){
            sscanf(line,"%f", &sigext[i]);
            }
		i++; 
	}
	fclose(fp);
	
	/* *************************************************************************** */
	/* Reading data and errors of experimental transmision coefficient: sigpaw.cnt */
	/* *************************************************************************** */
	printf("Reading data and errors of experimental transmision coefficient: sigpaw.cnt\n");
	fp = fopen("sigpaw.cnt", "r");
	if(fp == NULL){
		printf("No sigpaw.cnt file found in your directory\n");
		exit(0);
	}
	i = 0 ;
	while(i < MAXDIM && fgets(line,sizeof(line),fp) != NULL){   //*10, to be sure long enough search for data
		sscanf(line,"%f", &sigpaw[i]);
		i++;
	}
	fclose(fp);
	dim = i/2;
	
	/* **************************************************** */
	/* Finding L1 and L2 limits for region with data points */
	/* **************************************************** */
	L1 = 0.;
	L2 = dim;
	for(i = 0; i < dim; i++){
		if (sigpaw[i] > 10.*eps && L1 == 0) L1=i;
		if (sigpaw[i] < 10.*eps && i > dim/2 && L2 == dim ) L2=i-1;
	}
	
	/* ****************************************** */
	/* Reading spincutoff parameters: spincut.cnt */
	/* ****************************************** */
	printf("Reading spincutoff parameters: spincut.cnt\n");
	fp = fopen("spincut.cnt", "r");
	if(fp == NULL){
		printf("No spincut.cnt file found in your directory\n");
		exit(0);
	}
	i = 0 ;
	while(i < Nch){
      if(fgets(line,sizeof(line),fp) != NULL){sscanf(line,"%f", &spincut[i]);}
		spincut[i]=2.*spincut[i]*spincut[i];
	   i++; 
	}
	fclose(fp);
	
	/* ************************ */
	/* Printing input functions */
	/* ************************ */
	printf("\n No Ex(keV) Rho(1/MeV)  2*Spincut**2  Eg(keV)    Sigext      Sigpaw      dSigpaw  \n");
	for(i = 0 ; i < Nch; i++){
		printf("%3d  %6.1f %10.3e %8.2f %12.1f %12.3e %12.3e (%10.3e)\n",i,a0+a1*(float)i,rho[i],spincut[i],a0+a1*(float)i, sigext[i],sigpaw[i],sigpaw[i+dim]);
	}
        
/*    printf("\n No Ex(keV) Rho(1/MeV)  2*Spincut**2  Eg(keV)    Sigext      Sigpaw      dSigpaw  \n");
	for(i = 0 ; i < Nch; i++){
        ex=a0+a1*(float)i;
		printf("%3d  %6.1f %10.3e %8.2f %12.1f %12.3e %12.3e (%10.3e)\n",i,ex,rho_ex(ex),sig_ex(ex),ex, T_eg(ex),sigpaw[i],sigpaw[i+dim]);
	}

    
    ex=a0 + a1*11.5 ;
    printf("ex= %f   rho = %e\n",ex,rho_ex(ex ) );
    printf("ex= %f   sig= %e\n",ex,sig_ex(ex ) );
    printf("eg= %f   T_eg = %e\n",ex,T_eg(ex ) );
    
    ex=-368.1 ;
    printf("ex= %f   rho = %e\n",ex,rho_ex(ex ) );
    printf("ex= %f   sig= %e\n",ex,sig_ex(ex ) );
    printf("eg= %f   T_eg = %e\n",ex,T_eg(ex ) );
    
    ex=5488 ;
    printf("ex= %f   rho = %e\n",ex,rho_ex(ex ) );
    printf("ex= %f   sig= %e\n",ex,sig_ex(ex ) );
    printf("eg= %f   T_eg = %e\n",ex,T_eg(ex ) );
    
    exit(0);
*/
    
	/* *************************************** */
	/* Calculating integral, fasten seat-belts */
	/* *************************************** */
	if( ell == 0){				/* s-wave (l=0) capture */ 
		if(It == 0.0){			/*I_i = 1/2 => I_f = 1/2, 3/2 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = x1 + x2;
		}
		if(It == 0.5){			/*I_i = 0, 1 => I_f = 0, 1, 2 */
			while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
                x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-0.) / sig_ex(ex)) * exp(-(It-0.)*(It-0.) / sig_ex(ex));
                x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
                x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = x1 + 2.*x2 + x3;
		}
		if(It == 1.0){			/*I_i = 1/2, 3/2 => I_f = 1/2, 3/2, 5/2 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-0.) / sig_ex(ex)) * exp(-(It-0.)*(It-0.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = 2.*x1 + 2.*x2 + x3;
		}
		if(It > 1.0){			/*I_i = It+1/2, It-1/2 => I_f = It-3/2, It-1/2, It+1/2, It+3/2 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
                x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-1.) / sig_ex(ex)) * exp(-(It-1.)*(It-1.) / sig_ex(ex));
                x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It-0.) / sig_ex(ex)) * exp(-(It-0.)*(It-0.) / sig_ex(ex));
                x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
                x4 = x4 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
                
//                delta_x1= T_eg(eg)*rho_ex(ex) * ((It-1.) / sig_ex(ex)) * exp(-(It-1.)*(It-1.) / sig_ex(ex));
//                printf("eg = %6.1f  ex = %6.1f T_eg = %10.3e rho_ex= %10.3e sig_ex= %7.2f delta_x1= %10.3e\n",eg,ex,T_eg(eg),rho_ex(ex),sig_ex(ex),delta_x1 );
                
                eg = eg + de;
			}
			Int = x1 + 2.*x2 + 2.*x3 + x4;
		}
	}

	if( ell == 1){				/* p-wave (l=1) capture */ 
		if(It == 0.0){			/*I_i = 1/2, 3/2 => I_f = 1/2, 3/2, 5/2 */
			while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+3.) / sig_ex(ex)) * exp(-(It+3.)*(It+3.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = 2.*x1 + 2.*x2 + x3;
		}
		if(It == 0.5){			/*I_i = 0, 1, 2 => I_f = 0, 1, 2, 3 */
			while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-0.) / sig_ex(ex)) * exp(-(It-0.)*(It-0.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
				x4 = x4 + T_eg(eg)*rho_ex(ex) * ((It+3.) / sig_ex(ex)) * exp(-(It+3.)*(It+3.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = x1 + 3.*x2 + 2.*x3 + x4;
		}
		if(It == 1.0){			/*I_i = 1/2, 3/2, 5/2 => I_f = 1/2, 3/2, 5/2, 7/2 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-0.) / sig_ex(ex)) * exp(-(It-0.)*(It-0.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
				x4 = x4 + T_eg(eg)*rho_ex(ex) * ((It+3.) / sig_ex(ex)) * exp(-(It+3.)*(It+3.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = 2.*x1 + 3.*x2 + 2.*x3 + x4;
		}
		if(It == 1.5){			/*I_i = 0, 1, 2, 3 => I_f = 0, 1, 2, 3, 4 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-1.) / sig_ex(ex)) * exp(-(It-1.)*(It-1.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+0.) / sig_ex(ex)) * exp(-(It+0.)*(It+0.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x4 = x4 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
				x5 = x5 + T_eg(eg)*rho_ex(ex) * ((It+3.) / sig_ex(ex)) * exp(-(It+3.)*(It+3.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = 1.*x1 + 3.*x2 + 3.*x3 + 2.*x4 + x5;
		}
		if(It == 2.0){			/*I_i = 1/2, 3/2, 5/2, 7/2 => I_f = 1/2, 3/2, 5/2, 7/2, 9/2 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-1.) / sig_ex(ex)) * exp(-(It-1.)*(It-1.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It+0.) / sig_ex(ex)) * exp(-(It+0.)*(It+0.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x4 = x4 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
				x5 = x5 + T_eg(eg)*rho_ex(ex) * ((It+3.) / sig_ex(ex)) * exp(-(It+3.)*(It+3.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = 2.*x1 + 3.*x2 + 3.*x3 + 2.*x4 + x5;
		}
		if(It > 2.0){			/*I_i = It-3/2, It-1/2, It+1/2, It+3/2 => I_f = It-5/2, It-3/2, It-1/2, It+1/2, It+3/2, It+5/2 */
            while (eg < Bn_keV+Eres){
                ex = Bn_keV - eg;
				x1 = x1 + T_eg(eg)*rho_ex(ex) * ((It-2.) / sig_ex(ex)) * exp(-(It-2.)*(It-2.) / sig_ex(ex));
				x2 = x2 + T_eg(eg)*rho_ex(ex) * ((It-1.) / sig_ex(ex)) * exp(-(It-1.)*(It-1.) / sig_ex(ex));
				x3 = x3 + T_eg(eg)*rho_ex(ex) * ((It+0.) / sig_ex(ex)) * exp(-(It+0.)*(It+0.) / sig_ex(ex));
				x4 = x4 + T_eg(eg)*rho_ex(ex) * ((It+1.) / sig_ex(ex)) * exp(-(It+1.)*(It+1.) / sig_ex(ex));
				x5 = x5 + T_eg(eg)*rho_ex(ex) * ((It+2.) / sig_ex(ex)) * exp(-(It+2.)*(It+2.) / sig_ex(ex));
				x6 = x6 + T_eg(eg)*rho_ex(ex) * ((It+3.) / sig_ex(ex)) * exp(-(It+3.)*(It+3.) / sig_ex(ex));
                eg = eg + de;
			}
			Int = x1 + 2.*x2 + 3.*x3 + 3.*x4 + 2.*x5 + x6;
		}
	}
    Int = Int * de;
	Fac = Int * D / G;									/* Units = a1*D/G = keV*eV/(MeV*meV) = 1 */
	
			
	/* ************* */
	/* Final results */
	/* ************* */
	printf("\nNormalization integral = %14.7e\n",Int);
	printf("Normalization factor =   %14.7e\n",Fac);
 
 	/* **************************************************** */
	/* Storing default values for the next run in input.nrm */
	/* **************************************************** */
	fp = fopen("input.nrm", "w");
	if(fp == NULL){
		printf("Could not open file input.nrm \n");
		exit(0);
	}
	else {
	if(ell == 0){
		D0  = D;
		G0	= G;
	}
	else{
		D1  = D;
		G1  = G;
	}
		fprintf(fp, " %d %f %f\n", ell, Bn, It);
        fprintf(fp, " %f %f \n", D0, G0);
		fprintf(fp, " %f %f \n", D1, G1);
        fprintf(fp, " %e \n", Fac);
	}
	fclose(fp);

	/* ******************************************************** */
	/* Normalized gamma strength function f(Eg) written to disk */
	/* ******************************************************** */
	fp = fopen("strength.nrm", "w");
	if(fp == NULL){
		printf("Could not open file strength.nrm \n");
		exit(0);
	}
	
	else {
		for (i = 0; i < dim; i++){
			Eg = (a0 + a1*(float)i)/1000.;
            strength[i] = 0;
			if(Eg > 0.) strength[i] = sigpaw[i]/(Fac*pow(Eg,3.0));
			if(strength[i] < eps ) strength[i] = 0;
			fprintf(fp, " %14.7e \n", strength[i]);
		}
		for (i = dim; i < 2*dim; i++){
			Eg = (a0 + a1*(float)(i-dim))/1000.;
            strength[i] = 0;
			if(Eg > 0.)strength[i] = sigpaw[i]/(Fac*pow(Eg,3.0));
			if(strength[i] < eps ) strength[i] = 0;
            if(strength[i-dim] < eps ) strength[i] = 0;
			fprintf(fp, " %14.7e \n", strength[i]);
		}
	}
	fclose(fp);	
	printf("File strength.nrm (0:%d) written to disk, (a0,a1)=(%8.2f,%8.3f)\n",2*dim-1,a0,a1);
	
	/* *************************************************************** */
	/* Normalized gamma-transmission coefficient T(Eg) written to disk */
	/* *************************************************************** */
	fp = fopen("trans.nrm", "w");
	if(fp == NULL){
		printf("Could not open file trans.nrm \n");
		exit(0);
	}
	else {
		for (i = 0; i < dim; i++){
			trans[i] = 2.*PI*sigpaw[i]/Fac;
			if(trans[i] < eps ) trans[i] = 0;
			fprintf(fp, " %14.7e \n", trans[i]);
		}
		for (i = dim; i < 2*dim; i++){
			trans[i] = 2.*PI*sigpaw[i]/Fac;
			if(trans[i] < eps ) trans[i] = 0;
			fprintf(fp, " %14.7e \n", trans[i]);
		}
	}
	fclose(fp);	
	printf("File trans.nrm (0:%d) written to disk, (a0,a1)=(%8.2f,%8.3f)\n",2*dim-1,a0,a1);
	
	/* ************************************************************************ */
	/* Writing normalized extended gamma-transmission coefficient T(Eg) to disk */
	/* ************************************************************************ */
	fp = fopen("transext.nrm", "w");
	if(fp == NULL){
		printf("Could not open file transext.nrm \n");
		exit(0);
	}
	else {
		for (i = 0; i < Nch; i++){
			transext[i] = 2.*PI*sigext[i]/Fac;
            if(transext[i] < eps ) transext[i] = 0;
			fprintf(fp, " %14.7e \n", transext[i]);
		}
	}
	fclose(fp);	
	printf("File transext.nrm (0:%d) written to disk, (a0,a1)=(%8.2f,%8.3f)\n",Nch-1,a0,a1);
	
	makeroot1();
	return(0);
}