Bsoft 2.1.4
Bernard's software package
mg_multislice.h File Reference

Generates and manipulates projects for multislice calculations. More...

#include "mg_processing.h"
#include "rwimg.h"
#include "rwmolecule.h"

Functions

Bimageimg_calc_wave_propagator (Vector3< long > size, Vector3< double > sam, double thickness, double volt)
 Calculates the wave propagation function between slices. More...
 
Bimageimg_calc_multi_slice (Bimage *pgrate, double thickness, double volt)
 Simulates the electron imaging process using a multi-slice approach. More...
 
Bimageimg_calc_multi_slice_correct (Bimage *pgrate, double thickness, double volt)
 
Bimageimg_calc_potential (Bmolgroup *molgroup, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, double thickness, double resolution, double Bfactor, Bstring &paramfile, int type)
 Calculates the atomic potential. More...
 
int img_calc_phase_grating (Bimage *p, double volt)
 Calculates the phase grating approximation from the atomic potential. More...
 
int img_apply_complex_CTF (Bimage *p, CTFparam &cp)
 Applies a complex CTF function to a Fourier transform. More...
 
Bprojectproject_generate (int nfield, int nmg, int npart, Vector3< double > pixel_size, double img_origin, CTFparam &cp, double def_min, double def_max, double dose, double tsigma, Bstring &fieldbase, Bstring &mgbase, Bstring &partbase, int fieldnumber, int mgnumber, int partnumber)
 Generates a project for multislice simulations. More...
 
Bprojectproject_generate_asu (Bstring &symmetry_string, Vector3< double > pixel_size, double img_origin, double theta_step, double phi_step, CTFparam &cp, double defocus, double dose, Bstring &mgbase, Bstring &partbase)
 Generates a project for multislice calculations of an asymmetric unit. More...
 
int project_generate_potential (Bmolgroup *molgroup, Bmolgroup *water, Bproject *project, Bstring &fieldname, Bstring &mgname, int partselect, Vector3< long > size, double thickness, double resolution, double Bfactor, int pottype, Bstring &paramfile)
 Generates potential images using a multislice calculation. More...
 
int project_generate_image (Bproject *project, double thickness, double resolution)
 Generates final images from a multislice calculation. More...
 
int project_apply_distortions (Bproject *project, int poisson, double gauss, double kmtf)
 Applies imaging distortions to the final images from a multislice calculation. More...
 

Detailed Description

Generates and manipulates projects for multislice calculations.

Author
Bernard Heymann
Date
Created: 20030805
Modified: 20221024

Function Documentation

◆ img_apply_complex_CTF()

int img_apply_complex_CTF ( Bimage p,
CTFparam cp 
)

Applies a complex CTF function to a Fourier transform.

Parameters
*pcomplex Fourier transform (modified).
&cpCTF parameters.
Returns
int 0.
The CTF is applied as a multiplication with a complex number.
Both input and output are complex transforms.

◆ img_calc_multi_slice()

Bimage * img_calc_multi_slice ( Bimage pgrate,
double  thickness,
double  volt 
)

Simulates the electron imaging process using a multi-slice approach.

Parameters
*pgratephase grating multi-image.
thicknessslice thickness (in angstrom).
voltacceleration voltage (volt).
Returns
Bimage* simulated projection image transform.
The passage of the electron beam is simulated as the interaction of
a planar wave with successive planar phase gratings spaced at regular 
intervals, with the wave propagated between the 2D gratings. The
phase gratings are derived from slabs of the atomic potential 
calculated from the atomic structure using scattering profiles.
Note: The final product is a 2D transform of the exit wave.
Reference: Cowley, J. M. (1995) Diffraction Physics. 3rd Rev. Ed. 
    Elsevier Science, Amsterdam.

◆ img_calc_multi_slice_correct()

Bimage * img_calc_multi_slice_correct ( Bimage pgrate,
double  thickness,
double  volt 
)

◆ img_calc_phase_grating()

int img_calc_phase_grating ( Bimage p,
double  volt 
)

Calculates the phase grating approximation from the atomic potential.

Parameters
*patomic potential image (modified).
voltacceleration voltage (volt).
Returns
int 0.
All calculations are complex.

◆ img_calc_potential()

Bimage * img_calc_potential ( Bmolgroup molgroup,
Vector3< long >  size,
Vector3< double >  origin,
Vector3< double >  sam,
double  thickness,
double  resolution,
double  Bfactor,
Bstring paramfile,
int  type 
)

Calculates the atomic potential.

Parameters
*molgroupset of molecules.
sizesize of projection image (z = 1).
originorigin in x and y.
samvoxel size.
thicknessslice thickness (in angstrom).
resolutionresolution limit (angstrom).
Bfactoroverall temperature factor.
&paramfileparameter file for atomic scattering coefficients.
typetype of potential calculation: 0=reciprocal space, 1=real space, 2=gaussian
Returns
Bimage* complex potential image.

◆ img_calc_wave_propagator()

Bimage * img_calc_wave_propagator ( Vector3< long >  size,
Vector3< double >  sam,
double  thickness,
double  volt 
)

Calculates the wave propagation function between slices.

Parameters
sizesize of projection image (z = 1).
sampixel size in x and y, slice thickness in z.
thicknessslice thickness (in angstrom).
voltacceleration voltage (volt).
Returns
Bimage* wave propagation function image.

◆ project_apply_distortions()

int project_apply_distortions ( Bproject project,
int  poisson,
double  gauss,
double  kmtf 
)

Applies imaging distortions to the final images from a multislice calculation.

Parameters
*projectproject structure with parameters.
poissonflag to add Poisson noise.
gausswidth of gaussian noise to add (0=no noise).
kmtfmass transfer decay constant (0=no decay).
Returns
int 0.

◆ project_generate()

Bproject * project_generate ( int  nfield,
int  nmg,
int  npart,
Vector3< double >  pixel_size,
double  img_origin,
CTFparam cp,
double  def_min,
double  def_max,
double  dose,
double  tsigma,
Bstring fieldbase,
Bstring mgbase,
Bstring partbase,
int  fieldnumber,
int  mgnumber,
int  partnumber 
)

Generates a project for multislice simulations.

Parameters
nfieldnumber of fields-of-view.
nmgnumber of micrographs per field-of-view.
npartnumber of particles per micrograph.
pixel_sizemicrograph pixel size.
img_originimage origin within the simulation box.
cpCTF parameters).
def_mindefocus minimum (angstrom).
def_maxdefocus maximum (angstrom).
doseelectron dose (e/angstrom^2).
tsigmatranslation standard deviation (pixels).
&fieldbasefield base name.
&mgbasemicrograph base name.
&partbaseparticle image base name.
fieldnumberfield-of-view number.
mgnumbermicrograph number.
partnumberparticle number.
Returns
Bproject* project structure.

◆ project_generate_asu()

Bproject * project_generate_asu ( Bstring symmetry_string,
Vector3< double >  pixel_size,
double  img_origin,
double  theta_step,
double  phi_step,
CTFparam cp,
double  defocus,
double  dose,
Bstring mgbase,
Bstring partbase 
)

Generates a project for multislice calculations of an asymmetric unit.

Parameters
&symmetry_stringsymmetry designation.
pixel_sizemicrograph pixel size.
img_originimage origin within the simulation box.
theta_stepstep size in theta (radians).
phi_stepstep size in phi (radians).
cpCTF parameters).
defocusdefocus minimum (angstrom).
doseelectron dose (e/angstrom^2).
&mgbasemicrograph base name.
&partbaseparticle image base name.
Returns
Bproject* project structure.

◆ project_generate_image()

int project_generate_image ( Bproject project,
double  thickness,
double  resolution 
)

Generates final images from a multislice calculation.

Parameters
*projectproject structure with parameters.
thicknessthickness of slices for the multislice calculation (angstrom).
resolutionresolution for the multislice calculation (angstrom).
Returns
int 0.

◆ project_generate_potential()

int project_generate_potential ( Bmolgroup molgroup,
Bmolgroup water,
Bproject project,
Bstring fieldname,
Bstring mgname,
int  partselect,
Vector3< long >  size,
double  thickness,
double  resolution,
double  Bfactor,
int  pottype,
Bstring paramfile 
)

Generates potential images using a multislice calculation.

Parameters
*molgroupmolecule group structure.
*waterblock of water as solvent.
*projectproject structure with parameters.
&fieldnameselected field name (if "" do all).
&mgnameselected micrograph (if "" do all).
partselectselected particle ( if <1 do all).
sizesize of simulation block (angstrom).
thicknessthickness of slices for the multislice calculation (angstrom).
resolutionresolution for the multislice calculation (angstrom).
BfactorB-factor to apply to the multislice calculation (angstrom^2).
pottypetype of potential to calculate (???).
&paramfileparameter file for scattering curves (???).
Returns
int 0.