| Bsoft 2.0.5 Bernard's software package

Functions | Variables
mg_multislice.cpp File Reference

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

`#include "mg_processing.h"`
`#include "mg_ctf.h"`
`#include "molecule_to_map.h"`
`#include "mol_transform.h"`
`#include "mol_edit.h"`
`#include "Complex.h"`
`#include "Vector3.h"`
`#include "linked_list.h"`
`#include "random_numbers.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Functions
Bimage * | img_calc_wave_propagator (Vector3< long > size, Vector3< double > sam, double thickness, double volt, double resolution)
| Calculates the wave propagation function between slices. More...
Bimage * | img_calc_multi_slice (Bimage *pgrate, double thickness, double volt, double resolution)
| Simulates the electron imaging process using a multi-slice approach. More...
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. 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, double def_avg, double def_dev, double ast_angle, double volts, double Cs, double Cc, double amp_shift, double alpha, double energy_spread)
| Applies a complex CTF function to a Fourier transform. More...
Bproject * | project_generate (int nfield, int nmg, int npart, double pixel_size, double img_origin, double volt, double Cs, double Cc, double alpha, double energy_spread, double amp_shift, 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...
Bproject * | project_generate_asu (Bstring &symmetry_string, double pixel_size, double img_origin, double theta_step, double phi_step, double volt, double Cs, double Cc, double alpha, double energy_spread, double amp_shift, 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...

## Variables
int | verbose

## Detailed Description

Generates and manipulates projects for multislice calculations.

Author
  Bernard Heymann

Date
  Created: 20030805
  Modified: 20160604

Definition in file mg_multislice.cpp.

## Function Documentation

## ◆ img_apply_complex_CTF()

int img_apply_complex_CTF | ( | Bimage * | p,
|  | double | def_avg,
|  | double | def_dev,
|  | double | ast_angle,
|  | double | volts,
|  | double | Cs,
|  | double | Cc,
|  | double | amp_shift,
|  | double | alpha,
|  | double | energy_spread
| ) |  |

Applies a complex CTF function to a Fourier transform.

Parameters

  *p | complex Fourier transform (modified).
  def_avg | defocus minimum (angstrom).
  def_dev | defocus maximum (angstrom).
  ast_angle | astigmatism angle (radians).
  volts | acceleration voltage (volts).
  Cs | spherical aberration (angstrom).
  Cc | chromatic aberration (angstrom).
  amp_shift | amplitude contrast phase shift (radian).
  alpha | beam source size (radians).
  energy_spread | effective energy spread (fraction: typically 10^-5)

Returns
  int 0.

    The CTF is applied as a multiplication with a complex number:
        new_datum.re = datum.re*amp_fac*cos(dphi) - datum.im*phi_fac*sin(dphi)
        new_datum.re = datum.re*phi_fac*sin(dphi) + datum.im*amp_fac*cos(dphi)
    Both input and output are complex transforms.

Definition at line 252 of file mg_multislice.cpp.

## ◆ img_calc_multi_slice()

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

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

Parameters

  *pgrate | phase grating multi-image.
  thickness | slice thickness (in angstrom).
  volt | acceleration voltage (volt).
  resolution | resolution limit (angstrom).

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.

Definition at line 89 of file mg_multislice.cpp.

## ◆ img_calc_phase_grating()

int img_calc_phase_grating | ( | Bimage * | p,
|  | double | volt
| ) |  |

Calculates the phase grating approximation from the atomic potential.

    All calculations are complex.

Parameters

  *p | atomic potential image (modified).
  volt | acceleration voltage (volt).

Returns
  int 0.

Definition at line 206 of file mg_multislice.cpp.

## ◆ 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

  *molgroup | set of molecules.
  size | size of projection image (z = 1).
  origin | origin in x and y.
  sam | voxel size.
  thickness | slice thickness (in angstrom).
  resolution | resolution limit (angstrom).
  Bfactor | overall temperature factor.
  &paramfile | parameter file for atomic scattering coefficients.
  type | type of potential calculation: 0=reciprocal space, 1=real space, 2=gaussian

Returns
  Bimage* complex potential image.

Definition at line 139 of file mg_multislice.cpp.

## ◆ img_calc_wave_propagator()

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

Calculates the wave propagation function between slices.

Parameters

  size | size of projection image (z = 1).
  sam | pixel size in x and y, slice thickness in z.
  thickness | slice thickness (in angstrom).
  volt | acceleration voltage (volt).
  resolution | resolution limit (angstrom).

Returns
  Bimage* wave propagation function image.

Definition at line 32 of file mg_multislice.cpp.

## ◆ 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

  *project | project structure with parameters.
  poisson | flag to add Poisson noise.
  gauss | width of gaussian noise to add (0=no noise).
  kmtf | mass transfer decay constant (0=no decay).

Returns
  int 0.

Definition at line 674 of file mg_multislice.cpp.

## ◆ project_generate()

Bproject* project_generate | ( | int | nfield,
|  | int | nmg,
|  | int | npart,
|  | double | pixel_size,
|  | double | img_origin,
|  | double | volt,
|  | double | Cs,
|  | double | Cc,
|  | double | alpha,
|  | double | energy_spread,
|  | double | amp_shift,
|  | 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

  nfield | number of fields-of-view.
  nmg | number of micrographs per field-of-view.
  npart | number of particles per micrograph.
  pixel_size | micrograph pixel size.
  img_origin | image origin within the simulation box.
  volt | acceleration voltage (volts).
  Cs | spherical aberration coefficient (angstrom).
  Cc | chromatic aberration coefficient (angstrom).
  alpha | beam divergence angle (radians).
  energy_spread | energy spread (relative units).
  amp_shift | amplitude contribution phase shift (radian).
  def_min | defocus minimum (angstrom).
  def_max | defocus maximum (angstrom).
  dose | electron dose (e/angstrom^2).
  tsigma | translation standard deviation (pixels).
  &fieldbase | field base name.
  &mgbase | micrograph base name.
  &partbase | particle image base name.
  fieldnumber | field-of-view number.
  mgnumber | micrograph number.
  partnumber | particle number.

Returns
  Bproject* project structure.

Definition at line 344 of file mg_multislice.cpp.

## ◆ project_generate_asu()

Bproject* project_generate_asu | ( | Bstring & | symmetry_string,
|  | double | pixel_size,
|  | double | img_origin,
|  | double | theta_step,
|  | double | phi_step,
|  | double | volt,
|  | double | Cs,
|  | double | Cc,
|  | double | alpha,
|  | double | energy_spread,
|  | double | amp_shift,
|  | double | defocus,
|  | double | dose,
|  | Bstring & | mgbase,
|  | Bstring & | partbase
| ) |  |

Generates a project for multislice calculations of an asymmetric unit.

Parameters

  &symmetry_string | symmetry designation.
  pixel_size | micrograph pixel size.
  img_origin | image origin within the simulation box.
  theta_step | step size in theta (radians).
  phi_step | step size in phi (radians).
  volt | acceleration voltage (volts).
  Cs | spherical aberration coefficient (angstrom).
  Cc | chromatic aberration coefficient (angstrom).
  alpha | beam divergence angle (radians).
  energy_spread | energy spread (relative units).
  amp_shift | amplitude contribution (fraction).
  defocus | defocus minimum (angstrom).
  dose | electron dose (e/angstrom^2).
  &mgbase | micrograph base name.
  &partbase | particle image base name.

Returns
  Bproject* project structure.

Definition at line 441 of file mg_multislice.cpp.

## ◆ project_generate_image()

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

Generates final images from a multislice calculation.

Parameters

  *project | project structure with parameters.
  thickness | thickness of slices for the multislice calculation (angstrom).
  resolution | resolution for the multislice calculation (angstrom).

Returns
  int 0.

Definition at line 602 of file mg_multislice.cpp.

## ◆ 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

  *molgroup | molecule group structure.
  *water | block of water as solvent.
  *project | project structure with parameters.
  &fieldname | selected field name (if "" do all).
  &mgname | selected micrograph (if "" do all).
  partselect | selected particle ( if <1 do all).
  size | size of simulation block (angstrom).
  thickness | thickness of slices for the multislice calculation (angstrom).
  resolution | resolution for the multislice calculation (angstrom).
  Bfactor | B-factor to apply to the multislice calculation (angstrom^2).
  pottype | type of potential to calculate (???).
  &paramfile | parameter file for scattering curves (???).

Returns
  int 0.

Definition at line 502 of file mg_multislice.cpp.

## Variable Documentation

## ◆ verbose

int verbose