IFormFactor.h 2.63 KB
Newer Older
1
//  ************************************************************************************************
2
//
3
//  BornAgain: simulate and fit reflection and scattering
4
//
5
//! @file      Sample/Particle/IFormFactor.h
6
//! @brief     Defines interface IDecoratableBorn.
7
//!
8
//! @homepage  http://www.bornagainproject.org
9
//! @license   GNU General Public License v3 or higher (see COPYING)
10
11
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12
//
13
//  ************************************************************************************************
14

15
16
#ifndef BORNAGAIN_SAMPLE_PARTICLE_IFORMFACTOR_H
#define BORNAGAIN_SAMPLE_PARTICLE_IFORMFACTOR_H
17

18
#include "Sample/Scattering/ISampleNode.h"
Wuttke, Joachim's avatar
Wuttke, Joachim committed
19
20
#include <heinz/Complex.h>
#include <heinz/Vectors3D.h>
21

Wuttke, Joachim's avatar
Wuttke, Joachim committed
22
// not forward declared because of SWIG:
23
#include "Base/Spin/SpinMatrix.h"
Wuttke, Joachim's avatar
Wuttke, Joachim committed
24
#include "Base/Spin/Spinor.h"
Wuttke, Joachim's avatar
Wuttke, Joachim committed
25

Wuttke, Joachim's avatar
Wuttke, Joachim committed
26
class IRotation;
27
class IShape3D;
Wuttke, Joachim's avatar
Wuttke, Joachim committed
28
class Span;
Wuttke, Joachim's avatar
Wuttke, Joachim committed
29
class WavevectorInfo;
Wuttke, Joachim's avatar
sort    
Wuttke, Joachim committed
30

31
//! Abstract base class for Born form factors.
32
//!
33
//! In contrast to the generic IReParticle, a Born form factor does not depend
34
35
//! on the incoming and outgoing wave vectors ki and kf, except through their
//! difference, the scattering vector q=ki-kf.
36

37
class IFormFactor : public ISampleNode {
38
public:
39
40
41
    IFormFactor();
    IFormFactor(const std::vector<double>& PValues);
    ~IFormFactor() override;
42

43
    IFormFactor* clone() const override = 0;
44

45
46
47
48
49
    virtual double volume() const;
    //! Returns the (approximate in some cases) radial size of the particle of this
    //! form factor's shape. This is used for SSCA calculations
    virtual double radialExtension() const = 0;

Wuttke, Joachim's avatar
Wuttke, Joachim committed
50
    virtual Span spanZ(const IRotation* rotation) const;
Wuttke, Joachim's avatar
Wuttke, Joachim committed
51

52
    //! Creates the Python constructor of this class (or derived classes)
53
    std::string pythonConstructor() const;
54

55
    //! Default implementation only allows rotations along z-axis
Wuttke, Joachim's avatar
Wuttke, Joachim committed
56
    virtual bool canSliceAnalytically(const IRotation* rot) const;
57

58
59
60
    complex_t theFF(const WavevectorInfo& wavevectors) const;
    SpinMatrix thePolFF(const WavevectorInfo& wavevectors) const;

61
    //! Returns scattering amplitude for complex scattering wavevector q=k_i-k_f in case
62
    //! of matrix interactions. Default implementation calls formfactor(q) and
63
    //! multiplies with the unit matrix.
64
65
    SpinMatrix formfactor_pol(C3 q) const;

66
    virtual complex_t formfactor(C3 q) const = 0;
67

68
protected:
69
    //! IShape3D object, used to retrieve vertices (which may be approximate in the case
Van Herck, Walter's avatar
Van Herck, Walter committed
70
    //! of round shapes). For soft particles, this will be a hard mean shape.
Wuttke, Joachim's avatar
Wuttke, Joachim committed
71
    mutable std::unique_ptr<IShape3D> m_shape3D;
72
73
};

74
#endif // BORNAGAIN_SAMPLE_PARTICLE_IFORMFACTOR_H