#include "peg_pic.h"


/* Calculation of parameters for charged-neutral particle collisions     */
/* sctane[k][i] and scatang[i][k] are used for calculation of scattering */
/* angles in e + neutral and ion + neutral collisions. e + neutral       */
/* collisions: k=0 - elastic, k=1 - exitation and k=2 - ionization       */
/* Ion + neutral (elastic) collisions: k - ion, i - neutral.             */

void mccpar() {
	int    i, k;                                                        

	Nex = 0;
	
	if (ecollisional) {
		// Update while implementing new excitation collisions
		for (i=0; i < Nnum; i++) {
			if (Hydex[i]) {
				if (Hydex[i]==4) {
					// O_2
					Nex= 10;           // + 1 = Max number of possible excit. coll. types 
				}
			}
		}

		extengy0= (float **)malloc((Nex+1)*sizeof(float *));
		
		for (i=0; i <= Nex; i++) {
			extengy0[i] = (float *)malloc(Nnum*sizeof(float));
		}
	}

	for (i=0; i < Nnum; i++) {
		if (ecollisional) {
			if (Hydion[i]) {
				// Ionization parameters
				if (Hydion[i]<4) {
					// H, D, T
					ionengy0[i] = 13.6;
					
					for (k=0; k<3; k++) {
						sctane[k][i] = 1.;       // anizotropic scattering
					}
				} else if (Hydion[i]==4) {
					// O_2 
					ionengy0[i] = 12.06;
					
					for (k=0; k<3; k++) {
						sctane[k][i] = 0.;	// izotropic scattering
					}
				}
			}

			if (Hydex[i]) {
				// Excitation parameters
				if (Hydex[i]<4) {
					// H, D, T
					Nexel[i] = 0;   //  + 1 = Number of excitaion collision types
					extengy0[0][i] = 11.0;   // Total excitation

					for (k=0; k<3; k++) {
						sctane[k][i] = 1.;       // anizotropic scattering
					}
				} else if (Hydex[i]==4) {
					// O_2
					Nexel[i] = 10;   //  + 1 = Number of excitaion collision types
					extengy0[0][i] = 0.19;  // v=1 excitation
					extengy0[1][i] = 8.4;   // O2(3P)+O2(1D) dissociation
					extengy0[2][i] = 0.38;  // v=2 excitation
					extengy0[3][i] = 6.0;   // O(3P)+O(3P) dissociation
					extengy0[4][i] = 9.97;  // O(1D)+O(1D) dissociation
					extengy0[5][i] = 4.5;   // Metastable excit. (c1Sigma^-_u,A3Sigma^+_u)
					extengy0[6][i] = 0.977; // Metastable excit. (a1Delta_g)
					extengy0[7][i] = 14.7;  // O2(?)+O2(3p^3P) dissociative excit.
					extengy0[8][i] = 1.627; // Metastable excit. (b^1sigma_g^+)
					extengy0[9][i] = 0.02;  // Rotational excitation
					extengy0[10][i] = 16.1; // O(3P)+O(3p^5P) dissociative excit.

					for (k=0; k<3; k++) {
						sctane[k][i] = 0.;     // izotropic scattering
					}
				}
			} else {
				Nexel[i] = 0;
				extengy0[0][i] = ext0[i];
				
				for (k=0; k<3; k++) {
					sctane[k][i] = 1.;       // anizotropic scattering
				}
			}
		}  // end of if (ecollisional) loop

		for (k=0; k < Nnum; k++) {
			if (icollisional[i][k]) {
				nimiu[i][k]= mn[k]/(m[icolsp[i]] + mn[k]);

				if (HH[i][k]==1)        sctang[i][k]= 1.5e5;      /* HH collision */
				else if (HH[i][k]==2)   sctang[i][k]= 3.0e5;      /* DD collision */
				else if (HH[i][k]==3)   sctang[i][k]= 3*1.5e5;    /* TT collision */
				else if (HH[i][k]==4)   sctang[i][k]= 4/3*1.5e5;  /* HD collision */
				else if (HH[i][k]==5)   sctang[i][k]= 1.5*1.5e5;  /* HT collision */
				else if (HH[i][k]==6)   sctang[i][k]= 2.4*1.5e5;  /* DT collision */
				else if (HH[i][k]==7)   sctang[i][k]= 1.;  	  /* O_2O_2 collision */

				/* izotropic for low (<1 eV) and anizotropic for high energies (E>100 eV)*/
				else                    sctang[i][k]= 1.;  
			}
		}
	}  /* end of for (i=0; i < nsp; i++) loop */

}   /* End of mccpar()  */

/***************************************************************/
