File: ReMesocrystal.h

package info (click to toggle)
bornagain 23.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,956 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 356; ruby: 173; xml: 130; makefile: 45; ansic: 24
file content (91 lines) | stat: -rw-r--r-- 3,249 bytes parent folder | download | duplicates (3)
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
//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Resample/Particle/ReMesocrystal.h
//! @brief     Defines class ReMesocrystal.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifdef SWIG
#error no need to expose this header to Swig
#endif // SWIG
#ifndef BORNAGAIN_RESAMPLE_PARTICLE_REMESOCRYSTAL_H
#define BORNAGAIN_RESAMPLE_PARTICLE_REMESOCRYSTAL_H

#include "Resample/Option/SimulationOptions.h"
#include "Resample/Particle/IReParticle.h"
#include "Sample/Lattice/Lattice3D.h"
#include "Sample/Particle/Mesocrystal.h"
#include <functional>

class ReParticle;

//! A reprocessed Mesocrystal.

class ReMesocrystal : public IReParticle {
public:
    ReMesocrystal(const std::optional<size_t>& i_layer, const Lattice3D& lattice,
                  const IReParticle& basis, const ReParticle& outer_shape,
                  const MesoOptions& meso_options, double position_variance = 0.0);
    ~ReMesocrystal() override;

#ifndef SWIG
    ReMesocrystal* clone() const override;
#endif // SWIG

    void setAmbientMaterial(const Material& material) override
    {
        m_basis->setAmbientMaterial(material);
    }

    double radialExtension() const override;

    Span zSpan() const override;

    complex_t theFF(const WavevectorInfo& wavevectors) const override;
    SpinMatrix thePolFF(const WavevectorInfo& wavevectors) const override;

    void setBasisIndexes(const ShapeIndexes& shape_indexes);

    const Lattice3D& lattice() const { return m_lattice; }

    const IReParticle* basis() const { return m_basis.get(); }

    const ReParticle* outerShape() const { return m_outer_shape.get(); }

    double positionVariance() const { return m_position_variance; }

    bool consideredEqualTo(const IReParticle& ire) const override;
    const R3* position() const override;

private:
    complex_t structureFactor(const WavevectorInfo& wavevectors) const;

    complex_t realSpaceSum(const WavevectorInfo& wavevectors) const;
    SpinMatrix realSpaceSumPol(const WavevectorInfo& wavevectors) const;

    complex_t reciprocalSpaceSum(const WavevectorInfo& wavevectors) const;
    SpinMatrix reciprocalSpaceSumPol(const WavevectorInfo& wavevectors) const;

    void calculateLargestReciprocalDistance();
    complex_t debyeWallerFactor(const R3& q_i) const;

    std::function<complex_t(const WavevectorInfo&)> m_compute_FF = nullptr;
    std::function<SpinMatrix(const WavevectorInfo&)> m_compute_FF_pol = nullptr;

    Lattice3D m_lattice;
    std::unique_ptr<IReParticle> m_basis;
    std::unique_ptr<ReParticle> m_outer_shape; //!< The outer shape of this mesocrystal
    double m_position_variance;
    MesoOptions m_meso_options;
    double m_max_rec_length;
    ShapeIndexes m_shape_indexes; //!< Info about the lattice points inside the outer shape
};

#endif // BORNAGAIN_RESAMPLE_PARTICLE_REMESOCRYSTAL_H