forked from CY-Zhang/MultisliceCPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincostem.hpp
More file actions
125 lines (82 loc) · 4.19 KB
/
incostem.hpp
File metadata and controls
125 lines (82 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* incostem.hpp
------------------------------------------------------------------------
Copyright 1998-2015 Earl J. Kirkland
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
---------------------- NO WARRANTY ------------------
THIS PROGRAM IS PROVIDED AS-IS WITH ABSOLUTELY NO WARRANTY
OR GUARANTEE OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR DAMAGES RESULTING FROM THE USE OR INABILITY TO USE THIS
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
ANY OTHER PROGRAM).
------------------------------------------------------------------------
header file for incostem.cpp
class with member subroutines to
calculate images in the incoherent STEM approximation
put the partial cross section (integrated over the ADF detector
angles) at a single pixels (position of the corresponding atom)
and convolve with the point spread function (focused probe intensity)
reference:
[1] E. Kirkland, "Advanced Computing in Electron Microscopy",
Plenum 1998, 2nd edit. Springer 2010
this file is formatted for a tab size of 4 char
started separate incostem class .hpp file c20-apr-2013 E. Kirkland
consolodate makeProbe() and prbSize() in probe.cpp and call it from
here to avoid duplicating code 05-jul-2013 ejk
convert message() to use string data 5-sep-2013 ejk
add Pnoise() 29-oct-2014 ejk
switch to my ranPoisson() for compilers without c++11 on 27-sep-2015 ejk
*/
#ifndef INCOSTEM_HPP // only include this file if its not already
#define INCOSTEM_HPP // remember that this has been included
#include <cstdio> /* standard ANSI libraries */
#include <cstdlib>
#include <cmath>
#include <ctime> // to init RNG seed
//#include <random> // for Poission RNG: requires -std=c++11 option in gcc/g++
using namespace std;
#include "cfpix.hpp" // complex image handler with FFT
#include "slicelib.hpp" // misc. routines for multislice
//------------------------------------------------------------------
class incostem{
public:
incostem( ); // constructor functions
~incostem(); // destructor function
//void calculate( cfpix &pix, float param[], int multiMode, int natom,
// int Znum[], float x[], float y[], float z[], float occ[], float wobble[] );
void calculate2D( cfpix &pix, float param[], int multiMode, int natom,
int Znum[], float x[], float y[], float occ[] );
int addNoise( cfpix &pix, int nx, int ny, double probeI, double dwellTime );
private:
int NZMAX, FCNatomf, FCNfemr, FCNfemi;
double twopi, sigmae, wavl;
double atomf( double t, double p[] );
double atomsignal( int zatom, double keV, double thetamin, double thetamax );
double BJ0( double x );
void feMoliere( double k, int zatom, double *rfe, double *ife );
double femi( double r, double p[] );
double femr( double r, double p[] );
double fint( int FCN, double r, double p[] );
//double integrate45( double (*fint)(double x, double p[]), double p[],
double integrate45( int fcn, double p[],
double xmin, double xmax, double maxerror, int maxsteps );
void invert2D( float** pix, long nx, long ny );
void messageIN( std::string &smsg, int level = 0 ); // common error message handler
std::string sbuff;
int Pnoise( cfpix &pix, cfpix &pixout, int nx, int ny, int imean );
unsigned long iseedp;
}; // end incostem::
#endif