Commit 5450851a by Tobias WEBER

### calculations for setup 3

parent 119e4588
 ... @@ -73,7 +73,7 @@ INCS = -Isrc -Iext -Iext/takin \$(SYSINCS) ... @@ -73,7 +73,7 @@ INCS = -Isrc -Iext -Iext/takin \$(SYSINCS) all: prepare lib/skxmod.so lib/skxmod_grid.so \ all: prepare lib/skxmod.so lib/skxmod_grid.so \ bin/genskx bin/merge bin/convert bin/dump \ bin/genskx bin/merge bin/convert bin/dump \ bin/drawskx bin/dyn bin/weight \ bin/drawskx bin/dyn bin/weight \ #bin/heliphase bin/skx_gs bin/weight_sum # bin/heliphase bin/skx_gs bin/weight_sum clean: clean: find . -name "*.o" -exec rm -fv {} \; find . -name "*.o" -exec rm -fv {} \; ... ...
 /** /** * Calculates integrated weights/energies * Calculates the integrated weights/energies for setup 3 * @author Tobias Weber * @author Tobias Weber * @date jun-20 * @date jun-20 * @license GPLv2 (see 'LICENSE' file) * @license GPLv2 (see 'LICENSE' file) ... @@ -7,9 +7,9 @@ ... @@ -7,9 +7,9 @@ #include "core/heli.h" #include "core/heli.h" #include "core/skx.h" #include "core/skx.h" #include "tlibs2/libs/phys.h" #include #include #include #include #include namespace hist = boost::histogram; namespace hist = boost::histogram; ... @@ -22,16 +22,22 @@ const auto g_j = t_cplx(0,1); ... @@ -22,16 +22,22 @@ const auto g_j = t_cplx(0,1); #include "core/skx_default_gs.cxx" #include "core/skx_default_gs.cxx" const t_real g_T = 28.5; const t_real g_eps = 1e-5; #define E_BINS 200 #define E_BINS 200 #define NUM_ANGLES 512 #define COL_SIZE 15 void calc_disp( void calc_disp( t_real Gx, t_real Gy, t_real Gz, t_real Gx, t_real Gy, t_real Gz, t_real Bx, t_real By, t_real Bz, t_real Bx, t_real By, t_real Bz, t_real Px, t_real Py, t_real Pz, t_real Px, t_real Py, t_real Pz, t_real q, t_real q, int iProj=1) int iProj=1) { { Skx skx; Skx skx; Heli heli; std::vector> fourier_skx; std::vector> fourier_skx; fourier_skx.reserve(_skxgs_allcomps.size()/3); fourier_skx.reserve(_skxgs_allcomps.size()/3); ... @@ -40,22 +46,63 @@ void calc_disp( ... @@ -40,22 +46,63 @@ void calc_disp( fourier_skx.push_back(tl2::make_vec>({_skxgs_allcomps[comp], _skxgs_allcomps[comp+1], _skxgs_allcomps[comp+2]})); fourier_skx.push_back(tl2::make_vec>({_skxgs_allcomps[comp], _skxgs_allcomps[comp+1], _skxgs_allcomps[comp+2]})); skx.SetFourier(fourier_skx); skx.SetFourier(fourier_skx); skx.SetProjNeutron(iProj!=0); skx.SetProjNeutron(iProj!=0); heli.SetProjNeutron(iProj!=0); skx.SetT(-1000.); skx.SetT(-1000.); heli.SetT(g_T); skx.SetB(25.); skx.SetB(25.); heli.SetB(0.17); skx.GenFullFourier(); skx.GenFullFourier(); skx.SetFilterZeroWeight(1); skx.SetFilterZeroWeight(1); heli.SetFilterZeroWeight(1); skx.SetWeightEps(1e-6); skx.SetWeightEps(1e-6); heli.SetWeightEps(1e-6); skx.SetCoords(Bx,By,Bz, Px,Py,Pz); skx.SetCoords(Bx,By,Bz, Px,Py,Pz); heli.SetCoords(Bx,By,Bz); skx.SetG(Gx, Gy, Gz); skx.SetG(Gx, Gy, Gz); heli.SetG(Gx, Gy, Gz); t_real Erange = 0.1; t_real Erange = 0.1; t_real angle_begin = (-135 + 90) / 180.*tl2::pi; t_real angle_offs = 90/180.*M_PI; t_real angle_end = (135 + 90) / 180.*tl2::pi; t_real angle_begin = -135/180.*M_PI + angle_offs; t_real angle_delta = 2*tl2::pi/100.; t_real angle_end = 135/180.*M_PI + angle_offs; t_real angle_delta = 2*M_PI/t_real(NUM_ANGLES); auto histWeightsNSF = hist::make_histogram(hist::axis::regular(E_BINS, -Erange, Erange, "E")); auto histWeightsSF = hist::make_histogram(hist::axis::regular(E_BINS, -Erange, Erange, "E")); auto histWeightsHeliNSF = hist::make_histogram(hist::axis::regular(E_BINS, -Erange, Erange, "E")); auto histWeightsHeliSF = hist::make_histogram(hist::axis::regular(E_BINS, -Erange, Erange, "E")); std::ofstream ofstr_raw("weightsum_skx.dat"); std::ofstream ofstr_raw_heli("weightsum_heli.dat"); // write file header for(std::ostream* ostr : {&ofstr_raw, &ofstr_raw_heli}) { ostr->precision(8); (*ostr) << std::left << std::setw(COL_SIZE) << "# angle" << " " << std::left << std::setw(COL_SIZE) << "qh" << " " << std::left << std::setw(COL_SIZE) << "qk" << " " << std::left << std::setw(COL_SIZE) << "ql" << " " << std::left << std::setw(COL_SIZE) << "E" << " " << std::left << std::setw(COL_SIZE) << "wSF1" << " " << std::left << std::setw(COL_SIZE) << "wSF2" << " " << std::left << std::setw(COL_SIZE) << "wNSF" << "\n"; } auto histWeights = hist::make_histogram(hist::axis::regular(E_BINS, -Erange, Erange, "E")); for(t_real angle=angle_begin; angle*180. << ", Q = (" << Qx << ", " << Qy << ", " << Qz << ")\n"; std::cout << "# angle: " << angle/M_PI*180. << ", Q = (" << Qx << ", " << Qy << ", " << Qz << ")" << std::endl; auto [Es, wsUnpol, wsSF1, wsSF2, wsNSF] = skx.GetDisp(Qx, Qy, Qz, -Erange, Erange); { for(std::size_t i=0; ibin().lower() + 0.5*(iterNSF->bin().upper() - iterNSF->bin().lower()); t_real w_nsf = **iterNSF / t_real{E_BINS}; t_real E_h = iterHeliSF->bin().lower() + 0.5*(iterHeliSF->bin().upper() - iterHeliSF->bin().lower()); t_real w_h = **iterHeliSF / t_real{E_BINS}; t_real E_h_nsf = iterHeliNSF->bin().lower() + 0.5*(iterHeliNSF->bin().upper() - iterHeliNSF->bin().lower()); t_real w_h_nsf = **iterHeliNSF / t_real{E_BINS}; if(!tl2::float_equal(E, E_h, g_eps) || !tl2::float_equal(E, E_h_nsf, g_eps) || !tl2::float_equal(E, E_nsf, g_eps)) { std::cerr << "Energy binning mismatch: " << E << " != " << E_h << std::endl; break; } t_real bose = tl2::bose(E, g_T); ofstrBinned << std::left << std::setw(COL_SIZE) << E << " " << std::left << std::setw(COL_SIZE) << bose << " " << std::left << std::setw(COL_SIZE) << w << " " << std::left << std::setw(COL_SIZE) << w_nsf << " " << std::left << std::setw(COL_SIZE) << (w + w_nsf) << " " << std::left << std::setw(COL_SIZE) << (w + w_nsf)*bose << " " << std::left << std::setw(COL_SIZE) << w_h << " " << std::left << std::setw(COL_SIZE) << w_h_nsf << " " << std::left << std::setw(COL_SIZE) << (w_h + w_h_nsf) << " " << std::left << std::setw(COL_SIZE) << (w_h + w_h_nsf)*bose << std::endl; ++iterHeliSF; ++iterHeliNSF; ++iterNSF; } } } } int main() int main() { { std::cout.precision(5); // equivalent to the used setup around (000) t_real Gx = 1., Gy = 1., Gz = 0.; t_real Gx = 1., Gy = 1., Gz = 0.; t_real Bx = 0., By = 0., Bz = 1.; t_real Bx = 0., By = 0., Bz = 1.; t_real q = 0.0123; t_real q = 0.0123; ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!