 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
21 double ke,
double ki,
int ef)
23 double sig(1), f(1), mu(ke*emu), pmu(1);
24 if ( !ef ) mu += ki*imu;
26 for (
long n=1; n<=10; ++n ) {
40 double sig(0), f(1), pmu(1);
43 for (
long n=1; n<=10; ++n ) {
50 sig = (1 + k*sig)*exp(-emu-imu);
52 sig = 1 - (1 - k)*sig*exp(-emu-imu);
66 double ds,
double scut)
68 if ( ds < 1e-10 ) ds = 0.01;
70 long i, j, imax(scut/ds + 0.5);
71 double s2, ds2(ds*ds/4);
75 cout <<
"DEBUG calculate_scattering_curve: z = " << at->
z << endl;
79 for ( i=0; i<imax; i++ ) {
81 scat.push_back(at->
sfc);
83 scat[i] += at->
sfa[j]*exp(-at->
sfb[j]*s2);
98 Batomtype* atompar,
double ds,
double scut)
102 map<string, vector<double>> scat;
104 for ( at = atompar; at; at = at->
next ) {
107 cout <<
"Calculating scattering curve for " << at->
el << endl;
109 scat[at->
el] = scat1;
126 for ( i=0; i<5; ++i )
127 for ( j=0; j<5; ++j )
143 double b2 =
beta2(volt);
147 cs *= 4*
M_PI*hf*hf/b2;
163 double ds(0.01), f, cs(0);
170 for (
auto it = scat.begin(); it != scat.end(); ++it, ++i ) {
175 cs *= 2*
M_PI*hf*hf*ds*ds/b2;
192 for ( at = atompar; at; at = at->
next )
211 for ( at = atompar; at; at = at->
next )
226 double b2 =
beta2(volt);
229 (sqrt(Z)/b2)*log(2*b2*
232 if ( Z == 1 ) cs *= 0.154;
249 for ( at = atompar; at; at = at->
next )
271 cout <<
"Elastic cross section: " << ecs <<
" A2" << endl;
272 cout <<
"Inelastic cross section: " << ics <<
" A2" << endl;
294 cout <<
"Elastic cross section: " << ecs <<
" A2" << endl;
295 cout <<
"Inelastic cross section: " << ics <<
" A2" << endl;
299 else return ecs + ics;
310 double ds(0.001), f, csi(0);
314 for (
auto it = scat.begin(); it != scat.end() && csi < 0.5*cs; ++it, ++i ) {
330 double c, n(0), k(0);
332 for ( ; at; at = at->
next )
353 double wdens(mdens/18);
356 cout <<
"Ice:" << endl;
357 cout <<
"Density: " << dens <<
" g/cm3" << endl;
358 cout <<
"Density: " << mdens <<
" Da/A3" << endl;
359 cout <<
"Density: " << wdens <<
" molecules/A3" << endl;
393 if ( thickness < 1 ) thickness = 1000;
398 double ke = sc*sc/(sc*sc+sm*sm);
400 double ki = sc/(sc+0.2);
406 double emu = ecs*d*thickness;
407 double imu = ics*d*thickness;
408 double mfp = 1/(d*(ecs+ics));
410 double lam = -thickness/log(i);
413 cout <<
"Mean free path: " << mfp <<
" A" << endl;
414 cout <<
"Half_maximal frequency: " << sm <<
" 1/Å" << endl;
415 cout <<
"Frequency cutoff: " << sc <<
" 1/Å" << endl;
416 cout <<
"Aperture effect: " << ke <<
tab << ki << endl;
417 cout <<
"Thickness: " << thickness <<
" A" << endl;
418 cout <<
"Intensity: " << i << endl;
419 cout <<
"Lambda: " << lam << endl;
435 if ( thickness < 1 ) thickness = 1000;
443 return intensity(el, d, thickness, atompar, ctf);
457 if ( thick_step < 1 ) thick_step = 100;
458 if ( thick_max < 1 ) thick_max = 5000;
468 double ke = sc*sc/(sc*sc+sm*sm);
469 double ki = sc/(sc+0.054);
475 double t, emu, imu, i, mfp;
481 cout <<
"t(A)\tI\tlambda" << endl;
482 for ( t=thick_step; t<=thick_max; t+=thick_step ) {
489 cout << t <<
tab << i <<
tab << mfp << endl;
503 double thick_step(100), thick_max(5000), t(thick_step), lam_avg(0);
505 vector<double> I =
ice_intensity(thick_step, thick_max, atompar, ctf);
507 for (
long i=0; i<I.size(); ++i, t+=thick_step )
508 lam_avg += -t/log(I[i]);
double cross_section_integrated(JSvalue &el, Batomtype *atompar, CTFparam &ctf)
Calculates the combined total cross section for a defined composition.
double cross_section(JSvalue &el, Batomtype *atompar, double volt)
Calculates the combined total cross section for a defined composition.
double elastic_cross_section(Batomtype *at, double volt)
Calculates the full elastic cross section (no aperture).
double ice_lambda(Batomtype *atompar, CTFparam &ctf)
Calculates the average lambda proportionality parameter for vitreous ice.
Functions for calculating electron scattering profiles.
double signal_integrated(double emu, double imu, double ke, double ki, int ef)
double elastic_cross_section_integrated(Batomtype *at, CTFparam &ctf)
Integrates the elastic scattering curve up to the aperture cutoff.
double ice_cross_section(Batomtype *atompar, double volt)
Calculates the total cross section for ice up to the aperture cutoff.
double cross_section_half_maximal_frequency(Batomtype *at)
Calculates the half-maximal frequency for an atom type.
double ice_density()
Returns vitreous ice density.
map< string, vector< double > > calculate_scattering_curves(JSvalue &el, Batomtype *atompar, double ds, double scut)
Calculates elastic electron scattering profiles for a subset of atom types.
double inelastic_cross_section_langmore(long Z, double volt)
Calculates the inelastic cross section for an atom type.
ostream & tab(ostream &out)
double intensity(JSvalue &el, double d, double thickness, Batomtype *atompar, CTFparam &ctf)
Calculates the expected intensity given a thickness of vitreous ice.
double frequency_cutoff()
double ice_intensity(double thickness, Batomtype *atompar, CTFparam &ctf)
Calculates the expected intensity given a thickness of vitreous ice.
double signal_integrated_new(double emu, double imu, double k, int ef)
double beta2(double volt)
Calculates the square of the relative electron velocity.
vector< double > calculate_scattering_curve(Batomtype *at, double ds, double scut)
Calculates an elastic electron scattering profile for an atom type.
double scatter_curve_integral(Batomtype *at)
Calculates the integral of the whole curve.