diff --git a/src/BEMEWS/_ext/BEMEWS.cpp b/src/BEMEWS/_ext/BEMEWS.cpp index 1776bdf..9ad843c 100644 --- a/src/BEMEWS/_ext/BEMEWS.cpp +++ b/src/BEMEWS/_ext/BEMEWS.cpp @@ -175,7 +175,7 @@ vector > > > Run(InputDataBEMEWS ID) kV = vector >(NE); HfV=vector,NF,NF> > >(NM,vector,NF,NF> >(NE)); - // vectors of energies at infinity and vacuum eigenvalues at infinity + // vectors of energies at infinity and vacuum eigenvalues at infinity for(i=0;i<=NE-1;i++) { if(NE>1){ E[i] = ((NE-1.-i)*Emin + i*Emax) / (NE-1.);} else{ E[i] = Emin;} @@ -202,7 +202,7 @@ vector > > > Run(InputDataBEMEWS ID) // vaccum mixing matrices and Hamiltonians at infinity Evaluate_UV(); - Evaluate_HfV(); + Evaluate_HfV(); // ***************************************************** // quantities evaluated at inital point @@ -223,7 +223,7 @@ vector > > > Run(InputDataBEMEWS ID) U0 = vector,NF,NF> > >(NM,vector,NF,NF> >(NE)); // mixing angles to MSW basis at initial point - for(i=0;i<=NE-1;i++) + for(i=0;i<=NE-1;i++) { Hf0=HfV[nu][i]+VfMSW0; k0=k(Hf0); deltak0=deltak(k0); @@ -284,12 +284,12 @@ vector > > > Run(InputDataBEMEWS ID) lasttime = false; // take into account the density jump from vacuum into Earth - #pragma omp parallel for schedule(static) + #pragma omp parallel for schedule(static) for(i=0;i<=NE-1;i++){ for(state m=nu;m<=antinu;m++){ Scumulative[m][i] = Adjoint(U0[m][i])*UV[m]; } - } + } // loop through the domains for(int d=0;d<=ND-1;d++) @@ -303,25 +303,25 @@ vector > > > Run(InputDataBEMEWS ID) // initialize at beginning of every domain lambda=lambdamin; dlambda=1e-3*cgs::units::cm; deltalambdamin=4.*lambda*numeric_limits::epsilon(); - #pragma omp parallel for schedule(static) + #pragma omp parallel for schedule(static) for(i=0;i<=NE-1;i++){ for(state m=nu;m<=antinu;m++){ Y[m][i][0]=M_PI/2.; - Y[m][i][1]=M_PI/2.; - Y[m][i][2]=M_PI/2.; - Y[m][i][3]=M_PI/2.; + Y[m][i][1]=M_PI/2.; + Y[m][i][2]=M_PI/2.; + Y[m][i][3]=M_PI/2.; Y[m][i][4]=0.; Y[m][i][5]=M_PI/2.; - Y[m][i][6]=M_PI/2.; + Y[m][i][6]=M_PI/2.; Y[m][i][7]=0; Y[m][i][8]=1.; Y[m][i][9]=0.; - Y[m][i][10]=0.; - Y[m][i][11]=0.; - } - } + Y[m][i][10]=0.; + Y[m][i][11]=0.; + } + } finish = false; counterout=1; @@ -361,8 +361,8 @@ vector > > > Run(InputDataBEMEWS ID) for(i=0;i<=NE-1;i++){ for(state m=nu;m<=antinu;m++){ for(int j=0;j<=NY-1;j++){ Y[m][i][j] += BB[1][0] * Ks[0][m][i][j];} - } - } + } + } K(lambda,dlambda,Y,Ks[1]); // remaining steps @@ -372,11 +372,11 @@ vector > > > Run(InputDataBEMEWS ID) #pragma omp parallel for schedule(static) for(i=0;i<=NE-1;i++){ for(state m = nu; m <= antinu; m++){ - for(int j=0;j<=NY-1;j++){ - for(int l=0;l<=k-1;l++){ Y[m][i][j] += BB[k][l] * Ks[l][m][i][j];} - } - } - } + for(int j=0;j<=NY-1;j++){ + for(int l=0;l<=k-1;l++){ Y[m][i][j] += BB[k][l] * Ks[l][m][i][j];} + } + } + } K(lambda,dlambda,Y,Ks[k]); } @@ -387,11 +387,11 @@ vector > > > Run(InputDataBEMEWS ID) for(state m=nu;m<=antinu;m++){ for(int j=0;j<=NY-1;j++){ Y[m][i][j]=Y0[m][i][j]; - Yerror[m][i][j]=0.; - for(int k=0;k<=NRK-1;k++){ + Yerror[m][i][j]=0.; + for(int k=0;k<=NRK-1;k++){ Y[m][i][j]+=CC[k]*Ks[k][m][i][j]; - Yerror[m][i][j]+=(CC[k]-DD[k])*Ks[k][m][i][j]; - } + Yerror[m][i][j]+=(CC[k]-DD[k])*Ks[k][m][i][j]; + } } } } @@ -401,7 +401,7 @@ vector > > > Run(InputDataBEMEWS ID) for(state m=nu;m<=antinu;m++){ for(i=0;i<=NE-1;i++){ for(int j=0;j<=NY-1;j++){ maxerror = max( maxerror, fabs(Yerror[m][i][j]) );} - } + } } // decide whether to accept step, if not adjust step size @@ -425,29 +425,29 @@ vector > > > Run(InputDataBEMEWS ID) resetflag = false; // test that the S matrix is close to diagonal - if( norm(SS[0][0])+0.1,NF,NF>( SS*Scumulative[m][i] ); Y[m][i][0]=Y[m][i][1]=Y[m][i][2]=Y[m][i][3]=M_PI/2.; Y[m][i][4]=0.; Y[m][i][5]=Y[m][i][6]=M_PI/2.; Y[m][i][7]=0.; - Y[m][i][8]=1.; + Y[m][i][8]=1.; Y[m][i][9]=Y[m][i][10]=Y[m][i][11]=0.; } else{ // take modulo 2 pi of phase angles - Y[m][i][4]=fmod(Y[m][i][4],M_2PI); - Y[m][i][7]=fmod(Y[m][i][7],M_2PI); - - double ipart; - Y[m][i][9]=modf(Y[m][i][9],&ipart); - Y[m][i][10]=modf(Y[m][i][10],&ipart); - Y[m][i][11]=modf(Y[m][i][11],&ipart); - } - } + Y[m][i][4]=fmod(Y[m][i][4],M_2PI); + Y[m][i][7]=fmod(Y[m][i][7],M_2PI); + + double ipart; + Y[m][i][9]=modf(Y[m][i][9],&ipart); + Y[m][i][10]=modf(Y[m][i][10],&ipart); + Y[m][i][11]=modf(Y[m][i][11],&ipart); + } + } } if(counterout==step){ if(ID.outputflag==true){ output=true;} else{ output=false;}; counterout=1;} else{ counterout++;}