Minor Changes
This commit is contained in:
@@ -6,10 +6,15 @@
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include "functions.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
double calc_vecAbs(blitz::TinyVector<double,3> vec) {
|
||||
using namespace std;
|
||||
|
||||
|
||||
double calc_vecAbs(vec3 vec) {
|
||||
return( sqrt( pow(vec[0],2) + pow(vec[1],2) + pow(vec[2],2)) );
|
||||
}
|
||||
|
||||
@@ -72,7 +77,7 @@ double calc_beta_from_gamma(double gamma) {
|
||||
return( sqrt(1 - pow(gamma,-2)) );
|
||||
}
|
||||
|
||||
blitz::TinyVector<double,3> calc_Newdirection(blitz::TinyVector<double,3> direction_old, double theta_change,double phi_change) {
|
||||
vec3 calc_Newdirection(vec3 direction_old, double theta_change,double phi_change) {
|
||||
// Transformation of direction following Plante and Cucinotta
|
||||
double theta_old = acos(direction_old[2]/calc_vecAbs(direction_old));
|
||||
double phi_old = atan2(direction_old[1],direction_old[0]);
|
||||
@@ -109,18 +114,18 @@ endloops:
|
||||
}
|
||||
throw ("Interaction::getElaNewDir: phi1 not found.");
|
||||
}
|
||||
return(blitz::TinyVector<double,3>(sin(theta_new)*cos(phi_new) , sin(theta_new)*sin(phi_new) , cos(theta_new)));
|
||||
return(vec3(sin(theta_new)*cos(phi_new) , sin(theta_new)*sin(phi_new) , cos(theta_new)));
|
||||
}
|
||||
|
||||
blitz::TinyVector<double,3> roll_uniform_direction(ranlib::Uniform<double> *rngUni) {
|
||||
blitz::TinyVector<double,3> dir;
|
||||
vec3 roll_uniform_direction(ranlib::Uniform<double> *rngUni) {
|
||||
vec3 dir;
|
||||
double phi = 2*Constants::pi*rngUni->random();
|
||||
double theta = Constants::pi*rngUni->random();
|
||||
dir = sin(theta)*cos(phi) , sin(theta)*sin(phi) , cos(theta);
|
||||
return(dir);
|
||||
}
|
||||
|
||||
double roll_MB_Energy(double Temp_K,double mass_eV,ranlib::NormalUnit<double> *rngNormal) {
|
||||
double roll_MBEnergy(double Temp_K,double mass_eV,ranlib::NormalUnit<double> *rngNormal) {
|
||||
|
||||
double C = Constants::kb_eVK*Temp_K/mass_eV;
|
||||
double beta = 0;
|
||||
@@ -133,8 +138,8 @@ double roll_MB_Energy(double Temp_K,double mass_eV,ranlib::NormalUnit<double> *r
|
||||
return((calc_gamma_from_beta(beta)-1)*mass_eV);
|
||||
}
|
||||
|
||||
/*
|
||||
double doRejectionMethod(double (*pdf)(double), double xmin, double xmax, double pmax, ranlib::Uniform<double> *rngUni) {
|
||||
|
||||
double roll_Rejectionmethod(double (*pdf)(double), double xmin, double xmax, double pmax, ranlib::Uniform<double> *rngUni) {
|
||||
// get Energy distribution using Rejection Method
|
||||
double xcan,eta1,eta2;
|
||||
do {
|
||||
@@ -144,4 +149,4 @@ double doRejectionMethod(double (*pdf)(double), double xmin, double xmax, double
|
||||
} while( eta2*pmax > pdf(xcan) );
|
||||
return(xcan);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user