Bsoft 2.1.4
Bernard's software package
scatter.cpp File Reference

Functions for calculating electron scattering profiles. More...

#include "scatter.h"
#include "rwmodel_param.h"

Functions

double signal_integrated (double emu, double imu, double ke, double ki, int ef)
 
double signal_integrated_new (double emu, double imu, double k, int ef)
 
vector< string > all_elements (map< string, Bcomptype > &types)
 
JSvalue js_all_elements (map< string, Bcomptype > &types)
 
JSvalue js_composition (vector< string > &vs)
 
JSvalue js_composition (string s)
 
vector< double > calculate_scattering_curve (Bcomptype &ct, double ds, double scut)
 Calculates an elastic electron scattering profile for a component type. More...
 
map< string, vector< double > > calculate_scattering_curves (JSvalue &el, map< string, Bcomptype > &types, double ds, double scut)
 Calculates elastic electron scattering profiles for a subset of component types. More...
 
map< string, vector< double > > calculate_scattering_curves (map< string, Bcomptype > &types, double ds, double scut)
 
double scatter_curve_integral (Bcomptype &ct)
 Calculates the integral of the whole curve. More...
 
vector< double > calculate_potential_curve (Bcomptype &ct, double dr, double rmax)
 Calculates the atomic potential for elastic electron scattering for a component type. More...
 
map< string, vector< double > > calculate_potential_curves (JSvalue &el, map< string, Bcomptype > &types, double dr, double rmax)
 Calculates potential profiles for a subset of component types. More...
 
double elastic_cross_section (Bcomptype &ct, double volt)
 Calculates the full elastic cross section (no aperture). More...
 
double elastic_cross_section_integrated (Bcomptype &ct, CTFparam &ctf)
 Integrates the elastic scattering curve up to the aperture cutoff. More...
 
double elastic_cross_section (map< string, Bcomptype > &types, double volt)
 Calculates the combined elastic cross section for a defined composition. More...
 
double elastic_cross_section_integrated (map< string, Bcomptype > &types, CTFparam &ctf)
 Calculates the combined elastic cross section for a defined composition. More...
 
double inelastic_cross_section_langmore (long Z, double volt)
 Calculates the inelastic cross section for an component type. More...
 
double inelastic_cross_section_langmore (map< string, Bcomptype > &types, double volt)
 Calculates the combined inelastic cross section for a defined composition. More...
 
double cross_section (map< string, Bcomptype > &types, double volt)
 Calculates the combined total cross section for a defined composition. More...
 
double cross_section_integrated (map< string, Bcomptype > &types, CTFparam &ctf)
 Calculates the combined total cross section for a defined composition. More...
 
double cross_section_half_maximal_frequency (Bcomptype &ct)
 Calculates the half-maximal frequency for a component type. More...
 
double cross_section_half_maximal_frequency (map< string, Bcomptype > &types)
 Calculates the half-maximal frequency for an component type. More...
 
Bmaterial material_combine (vector< Bmaterial > &mlist, vector< double > fractions)
 Creates a newAssembles a component composition from a set of materials with fractional contributions. More...
 
Bmaterial material_ice (map< string, Bcomptype > &types)
 Returns vitreous ice as material. More...
 
double ice_cross_section (map< string, Bcomptype > &types, double volt)
 Calculates the total cross section for ice up to the aperture cutoff. More...
 
double effective_mean_free_path (Bmaterial &material, CTFparam &ctf)
 Calculates the average effective mean free path. More...
 
double effective_mean_free_path (vector< Bmaterial > &materials, vector< double > fractions, CTFparam &ctf)
 Calculates the expected intensity given a thickness of vitreous ice. More...
 
double ice_intensity (map< string, Bcomptype > &types, double thickness, CTFparam &ctf)
 Calculates the expected intensity given a thickness of vitreous ice. More...
 
double signal_intensity (Bmaterial &material, double thickness, CTFparam &ctf)
 Calculates the expected intensity given a thickness of vitreous ice. More...
 
vector< double > signal_intensity (Bmaterial &material, double thick_step, double thick_max, CTFparam &ctf)
 Calculates the expected intensity vs thickness of vitreous ice. More...
 
int write_scattering_curves (Bstring &paramfile, Bstring &outfile, Bstring &selection, double resolution)
 Calculates and writes atomic scattering profiles to a file. More...
 
int write_potential_curves (Bstring &paramfile, Bstring &outfile, Bstring &selection, double radius)
 Calculates and writes atomic scattering profiles to a file. More...
 

Variables

int verbose
 
auto string_is_empty
 

Detailed Description

Functions for calculating electron scattering profiles.

Author
Bernard Heymann
Date
Created: 20190521
Modified: 20210514

Function Documentation

◆ all_elements()

vector< string > all_elements ( map< string, Bcomptype > &  types)

◆ calculate_potential_curve()

vector< double > calculate_potential_curve ( Bcomptype ct,
double  dr,
double  rmax 
)

Calculates the atomic potential for elastic electron scattering for a component type.

Parameters
&ctcomponent type.
drradius increment.
rmaxmaximum radius.
Returns
vector<double> array with potential profile.

◆ calculate_potential_curves()

map< string, vector< double > > calculate_potential_curves ( JSvalue el,
map< string, Bcomptype > &  types,
double  dr,
double  rmax 
)

Calculates potential profiles for a subset of component types.

Parameters
&elelements to calculate curves for.
&typescomponent type.
drradius increment.
rmaxmaximum radius.
Returns
map<string, vector<double>> array with potential profile.

◆ calculate_scattering_curve()

vector< double > calculate_scattering_curve ( Bcomptype ct,
double  ds,
double  scut 
)

Calculates an elastic electron scattering profile for a component type.

Parameters
&ctcomponent type.
dsfrequency space sampling increment.
scutmaximum spacial frequency.
Returns
vector<double> array with scattering profile.

◆ calculate_scattering_curves() [1/2]

map< string, vector< double > > calculate_scattering_curves ( JSvalue el,
map< string, Bcomptype > &  types,
double  ds,
double  scut 
)

Calculates elastic electron scattering profiles for a subset of component types.

Parameters
&elelements to calculate curves for.
&typescomponent type.
dsfrequency space sampling increment.
scutmaximum spacial frequency.
Returns
map<string, vector<double>> array with scattering profile.

◆ calculate_scattering_curves() [2/2]

map< string, vector< double > > calculate_scattering_curves ( map< string, Bcomptype > &  types,
double  ds,
double  scut 
)

◆ cross_section()

double cross_section ( map< string, Bcomptype > &  types,
double  volt 
)

Calculates the combined total cross section for a defined composition.

Parameters
&typescomponent types.
voltacceleration voltage.
Returns
double integral.

◆ cross_section_half_maximal_frequency() [1/2]

double cross_section_half_maximal_frequency ( Bcomptype ct)

Calculates the half-maximal frequency for a component type.

Parameters
&ctcomponent type.
Returns
double half-maximal frequency.

◆ cross_section_half_maximal_frequency() [2/2]

double cross_section_half_maximal_frequency ( map< string, Bcomptype > &  types)

Calculates the half-maximal frequency for an component type.

Parameters
&typescomponent types.
Returns
double half-maximal frequency.

◆ cross_section_integrated()

double cross_section_integrated ( map< string, Bcomptype > &  types,
CTFparam ctf 
)

Calculates the combined total cross section for a defined composition.

Parameters
&typescomponent types.
&ctfCTF and microscope parameters.
Returns
double integral.
If the slit width is specified, the energy filter is assumed to be used
and only the elastic cross section is returned.

◆ effective_mean_free_path() [1/2]

double effective_mean_free_path ( Bmaterial material,
CTFparam ctf 
)

Calculates the average effective mean free path.

Parameters
&materialmaterial with types.
&ctfmicroscope parameters.
Returns
double EMFP average.

◆ effective_mean_free_path() [2/2]

double effective_mean_free_path ( vector< Bmaterial > &  materials,
vector< double >  fractions,
CTFparam ctf 
)

Calculates the expected intensity given a thickness of vitreous ice.

Parameters
&materialslist of materials with types.
&fractionsfractional contributions.
&ctfmicroscope parameters.
Returns
double effective mean free path.

◆ elastic_cross_section() [1/2]

double elastic_cross_section ( Bcomptype ct,
double  volt 
)

Calculates the full elastic cross section (no aperture).

Parameters
&ctcomponent type.
voltacceleration voltage.
Returns
double integral.

◆ elastic_cross_section() [2/2]

double elastic_cross_section ( map< string, Bcomptype > &  types,
double  volt 
)

Calculates the combined elastic cross section for a defined composition.

Parameters
&typescomponent types.
voltacceleration voltage.
Returns
double integral.

◆ elastic_cross_section_integrated() [1/2]

double elastic_cross_section_integrated ( Bcomptype ct,
CTFparam ctf 
)

Integrates the elastic scattering curve up to the aperture cutoff.

Parameters
&ctcomponent type.
ctfCTF and microscope parameters.
Returns
double integral.

◆ elastic_cross_section_integrated() [2/2]

double elastic_cross_section_integrated ( map< string, Bcomptype > &  types,
CTFparam ctf 
)

Calculates the combined elastic cross section for a defined composition.

Parameters
&typescomponent types.
ctfCTF and microscope parameters.
Returns
double integral.

◆ ice_cross_section()

double ice_cross_section ( map< string, Bcomptype > &  types,
double  volt 
)

Calculates the total cross section for ice up to the aperture cutoff.

Parameters
&typescomponent types.
voltacceleration voltage.
Returns
double cross section.

◆ ice_intensity()

double ice_intensity ( map< string, Bcomptype > &  types,
double  thickness,
CTFparam ctf 
)

Calculates the expected intensity given a thickness of vitreous ice.

Parameters
thicknesscomponent types.
&typescomponent types.
ctfmicroscope parameters.
Returns
double intensity.

◆ inelastic_cross_section_langmore() [1/2]

double inelastic_cross_section_langmore ( long  Z,
double  volt 
)

Calculates the inelastic cross section for an component type.

Parameters
Zatomic number.
voltacceleration voltage.
Returns
double integral.

◆ inelastic_cross_section_langmore() [2/2]

double inelastic_cross_section_langmore ( map< string, Bcomptype > &  types,
double  volt 
)

Calculates the combined inelastic cross section for a defined composition.

Parameters
&typescomponent types.
voltacceleration voltage.
Returns
double integral.

◆ js_all_elements()

JSvalue js_all_elements ( map< string, Bcomptype > &  types)

◆ js_composition() [1/2]

JSvalue js_composition ( string  s)

◆ js_composition() [2/2]

JSvalue js_composition ( vector< string > &  vs)

◆ material_combine()

Bmaterial material_combine ( vector< Bmaterial > &  mlist,
vector< double >  fractions 
)

Creates a newAssembles a component composition from a set of materials with fractional contributions.

Parameters
&mlistlist of materials.
&fractionsfractional contributions.
Returns
Bmaterial new combined material.

◆ material_ice()

Bmaterial material_ice ( map< string, Bcomptype > &  types)

Returns vitreous ice as material.

Parameters
typesreference parameters.
Returns
double density in molecules/A3.

◆ scatter_curve_integral()

double scatter_curve_integral ( Bcomptype ct)

Calculates the integral of the whole curve.

Parameters
&ctcomponent type.
Returns
double integral.
Burge & Smith (1962) formula

◆ signal_integrated()

double signal_integrated ( double  emu,
double  imu,
double  ke,
double  ki,
int  ef 
)

◆ signal_integrated_new()

double signal_integrated_new ( double  emu,
double  imu,
double  k,
int  ef 
)

◆ signal_intensity() [1/2]

vector< double > signal_intensity ( Bmaterial material,
double  thick_step,
double  thick_max,
CTFparam ctf 
)

Calculates the expected intensity vs thickness of vitreous ice.

Parameters
&materialmaterial with types.
thick_stepspecimen tickness step size (angstrom).
thick_maxmaximum specimen thickness (angstrom).
&ctfmicroscope parameters.
Returns
vector<double> array of intensities.

◆ signal_intensity() [2/2]

double signal_intensity ( Bmaterial material,
double  thickness,
CTFparam ctf 
)

Calculates the expected intensity given a thickness of vitreous ice.

Parameters
&materialmaterial with types.
thicknessspecimen thickness.
ctfmicroscope parameters.
Returns
double intensity.

◆ write_potential_curves()

int write_potential_curves ( Bstring paramfile,
Bstring outfile,
Bstring selection,
double  radius 
)

Calculates and writes atomic scattering profiles to a file.

Parameters
&paramfilefile with scattering coefficients.
&outfilefile to write curves to.
&selectionelement selection.
radiusmaximum radius.
Returns
int 0.
The scattering coefficients are obtained from an input parameter file.

◆ write_scattering_curves()

int write_scattering_curves ( Bstring paramfile,
Bstring outfile,
Bstring selection,
double  resolution 
)

Calculates and writes atomic scattering profiles to a file.

Parameters
&paramfilefile with scattering coefficients.
&outfilefile to write curves to.
&selectionelement selection.
resolutionresolution limit.
Returns
int 0.
The scattering coefficients are obtained from an input parameter file.

Variable Documentation

◆ string_is_empty

auto string_is_empty
Initial value:
= []( const std::string &s )
{
return s.size() < 1;
}

◆ verbose

int verbose
extern