File: AutocorrelationModels.h

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (128 lines) | stat: -rw-r--r-- 5,426 bytes parent folder | download | duplicates (2)
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
126
127
128
//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Sample/Interface/AutocorrelationModels.h
//! @brief     Define AutocorrelationModel classes.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2024
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_SAMPLE_INTERFACE_AUTOCORRELATIONMODELS_H
#define BORNAGAIN_SAMPLE_INTERFACE_AUTOCORRELATIONMODELS_H

#include "Base/Type/ICloneable.h"
#include "Param/Node/INode.h"

//! Base class for autocorrelation function models.
class AutocorrelationModel : public ICloneable, public INode {
public:
    void setMaxSpatialFrequency(double val) { m_max_spatial_frequency = val; }
    double maxSpatialFrequency() const { return m_max_spatial_frequency; }

    std::vector<ParaMeta> parDefs() const override { return {{"MaxSpatialFrequency", "1/nm"}}; }

#ifndef SWIG
    AutocorrelationModel* clone() const override = 0;

    //! Used to create the Python constructor of this class
    virtual std::string pythonArguments() const;

protected:
    std::vector<std::string> validationErrs() const;
    AutocorrelationModel(double maxSpatFrequency);
    double m_max_spatial_frequency; //! upper limit for spatial frequency of roughness (nm^-1)
#endif
};

//! The model is described e.g. in the article "Roughness spectrum and surface width of self-affine
//! fractal surfaces via the K-correlation model" by G. Palasantzas, Physical Review B 48,
//! 14472-14478 (1993)
class SelfAffineFractalModel : public AutocorrelationModel {
public:
    SelfAffineFractalModel(double sigma, double hurst, double lateralCorrLength,
                           double maxSpatFrequency = 0.5);
    std::string className() const override { return "SelfAffineFractalModel"; }
    std::vector<ParaMeta> parDefs() const final;
    std::string validate() const override;

    //! Returns power spectral density of the surface roughness
    double spectralFunction(double spatial_f) const;

    //! Returns rms of roughness
    double rms() const;

    void setSigma(double sigma) { m_sigma = sigma; }
    double sigma() const { return m_sigma; }

    void setHurstParameter(double hurstParameter) { m_hurst_parameter = hurstParameter; }
    double hurst() const { return m_hurst_parameter; }

    void setLatteralCorrLength(double lateralCorrLen) { m_lateral_corr_length = lateralCorrLen; }
    double lateralCorrLength() const { return m_lateral_corr_length; }

#ifndef SWIG
    SelfAffineFractalModel* clone() const override;

    std::string pythonArguments() const override;

private:
    double m_sigma;           //!< height scale of the roughness
    double m_hurst_parameter; //!< Hurst parameter which describes how jagged the interface, 0<H<=1
    double m_lateral_corr_length; //!< lateral correlation length of the roughness
#endif
};

//! The model is described e.g. in the article "Stochastic model for thin film growth and erosion"
//! by D. G. Stearns, Applied Physics Letters 62, 1745–1747 (1993) and extended in e.g.
//! Stearns, D. G. & Gullikson, E. M. "Nonspecular scattering from extreme ultraviolet multilayer
//! coatings", Physica B: Condensed Matter 283, 1–3, p. 84-91 (2000)
class LinearGrowthModel : public AutocorrelationModel {
public:
    LinearGrowthModel(double particle_volume, double damp1, double damp2, double damp3,
                      double damp4, double maxSpatFrequency = 0.5);
    std::string className() const override { return "LinearGrowthModel"; }
    std::vector<ParaMeta> parDefs() const final;
    std::string validate() const override;

    //! Returns power spectral density of the surface roughness
    double spectralFunction(double spectrum_below, double thickness, double spatial_f) const;

    double crosscorrSpectrum(double spectrum_below, double thickness, double spatial_f) const;

    void setClusterVolume(double particle_volume) { m_cluster_volume = particle_volume; }
    double clusterVolume() const { return m_cluster_volume; }

    void setDamp1(double damp1) { m_damp1 = damp1; }
    double damp1() const { return m_damp1; }

    void setDamp2(double damp2) { m_damp2 = damp2; }
    double damp2() const { return m_damp2; }

    void setDamp3(double damp3) { m_damp3 = damp3; }
    double damp3() const { return m_damp3; }

    void setDamp4(double damp4) { m_damp4 = damp4; }
    double damp4() const { return m_damp4; }

#ifndef SWIG
    LinearGrowthModel* clone() const override;

    std::string pythonArguments() const override;

private:
    double damping(double spatial_f) const;

    double m_cluster_volume; //!< volume of particles, incoming to the surface during growth
    double m_damp1;          //!< damping exponent for spatial frequency raised to the power of 1
    double m_damp2;          //!< damping exponent for spatial frequency raised to the power of 2
    double m_damp3;          //!< damping exponent for spatial frequency raised to the power of 3
    double m_damp4;          //!< damping exponent for spatial frequency raised to the power of 4
#endif
};

#endif // BORNAGAIN_SAMPLE_INTERFACE_AUTOCORRELATIONMODELS_H