BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ReMesocrystal Class Reference

Description

A reprocessed MesoCrystal.

Definition at line 29 of file ReMesocrystal.h.

Inheritance diagram for ReMesocrystal:
[legend]
Collaboration diagram for ReMesocrystal:
[legend]

Public Member Functions

 ReMesocrystal (const Lattice3D &lattice, const IReParticle &basis, const ReParticle &outer_shape, double position_variance=0.0)
 
 ~ReMesocrystal () override
 
double bottomZ (const IRotation *rotation) const override
 Returns the z-coordinate of the lowest point in this shape after a given rotation. More...
 
ReMesocrystalclone () const override
 
double radialExtension () const override
 Returns the (approximate in some cases) radial size of the particle of this form factor's shape. This is used for SSCA calculations. More...
 
void setAmbientMaterial (const Material &material) override
 Passes the material in which this particle is embedded. More...
 
complex_t theFF (const WavevectorInfo &wavevectors) const override
 Returns scattering amplitude for complex wavevectors ki, kf. More...
 
SpinMatrix thePolFF (const WavevectorInfo &wavevectors) const override
 Returns scattering amplitude for matrix interactions. More...
 
double topZ (const IRotation *rotation) const override
 Returns the z-coordinate of the lowest point in this shape after a given rotation. More...
 
virtual void transferToCPP ()
 Used for Python overriding of clone (see swig/tweaks.py) More...
 
double volume () const override
 Returns the total volume of the particle of this form factor's shape. More...
 

Private Member Functions

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

Private Attributes

IReParticlem_basis
 
Lattice3D m_lattice
 
double m_max_rec_length
 
ReParticlem_outer_shape
 The outer shape of this mesocrystal. More...
 
double m_position_variance
 

Constructor & Destructor Documentation

◆ ReMesocrystal()

ReMesocrystal::ReMesocrystal ( const Lattice3D lattice,
const IReParticle basis,
const ReParticle outer_shape,
double  position_variance = 0.0 
)

Definition at line 21 of file ReMesocrystal.cpp.

23  : m_lattice(lattice)
24  , m_basis(basis.clone())
25  , m_outer_shape(outer_shape.clone())
26  , m_position_variance(position_variance)
27 {
29 }
IReParticle * clone() const override=0
void calculateLargestReciprocalDistance()
Lattice3D m_lattice
Definition: ReMesocrystal.h:59
double m_position_variance
Definition: ReMesocrystal.h:62
IReParticle * m_basis
Definition: ReMesocrystal.h:60
ReParticle * m_outer_shape
The outer shape of this mesocrystal.
Definition: ReMesocrystal.h:61
ReParticle * clone() const override
Definition: ReParticle.cpp:40

References calculateLargestReciprocalDistance().

Referenced by clone().

Here is the call graph for this function:

◆ ~ReMesocrystal()

ReMesocrystal::~ReMesocrystal ( )
override

Definition at line 31 of file ReMesocrystal.cpp.

32 {
33  delete m_basis;
34  delete m_outer_shape;
35 }

References m_basis, and m_outer_shape.

Member Function Documentation

◆ bottomZ()

double ReMesocrystal::bottomZ ( const IRotation rotation) const
overridevirtual

Returns the z-coordinate of the lowest point in this shape after a given rotation.

Implements IReParticle.

Definition at line 47 of file ReMesocrystal.cpp.

48 {
49  return m_outer_shape->bottomZ(rotation);
50 }
double bottomZ(const IRotation *rotation) const override
Returns the z-coordinate of the lowest point in this shape after a given rotation.
Definition: ReParticle.cpp:134

References ReParticle::bottomZ(), and m_outer_shape.

Here is the call graph for this function:

◆ calculateLargestReciprocalDistance()

void ReMesocrystal::calculateLargestReciprocalDistance ( )
private

Definition at line 101 of file ReMesocrystal.cpp.

102 {
103  R3 a1 = m_lattice.basisVectorA();
104  R3 a2 = m_lattice.basisVectorB();
105  R3 a3 = m_lattice.basisVectorC();
106 
107  m_max_rec_length = std::max(M_PI / a1.mag(), M_PI / a2.mag());
108  m_max_rec_length = std::max(m_max_rec_length, M_PI / a3.mag());
109 }
#define M_PI
Definition: Constants.h:44
R3 basisVectorB() const
Returns basis vector b.
Definition: Lattice3D.h:46
R3 basisVectorC() const
Returns basis vector c.
Definition: Lattice3D.h:49
R3 basisVectorA() const
Returns basis vector a.
Definition: Lattice3D.h:43
double m_max_rec_length
Definition: ReMesocrystal.h:63

References Lattice3D::basisVectorA(), Lattice3D::basisVectorB(), Lattice3D::basisVectorC(), m_lattice, m_max_rec_length, and M_PI.

Referenced by ReMesocrystal().

Here is the call graph for this function:

◆ clone()

ReMesocrystal* ReMesocrystal::clone ( ) const
inlineoverridevirtual

Implements IReParticle.

Definition at line 35 of file ReMesocrystal.h.

36  {
38  }
ReMesocrystal(const Lattice3D &lattice, const IReParticle &basis, const ReParticle &outer_shape, double position_variance=0.0)

References ReMesocrystal(), m_basis, m_lattice, m_outer_shape, and m_position_variance.

Here is the call graph for this function:

◆ debyeWallerFactor()

complex_t ReMesocrystal::debyeWallerFactor ( const R3 &  q_i) const
private

Definition at line 111 of file ReMesocrystal.cpp.

112 {
113  auto q2 = q_i.mag2();
114  return std::exp(-q2 * m_position_variance / 2.0);
115 }

References m_position_variance.

Referenced by theFF(), and thePolFF().

◆ radialExtension()

double ReMesocrystal::radialExtension ( ) const
overridevirtual

Returns the (approximate in some cases) radial size of the particle of this form factor's shape. This is used for SSCA calculations.

Implements IReParticle.

Definition at line 42 of file ReMesocrystal.cpp.

43 {
45 }
double radialExtension() const override
Returns the (approximate in some cases) radial size of the particle of this form factor's shape....
Definition: ReParticle.cpp:85

References m_outer_shape, and ReParticle::radialExtension().

Here is the call graph for this function:

◆ setAmbientMaterial()

void ReMesocrystal::setAmbientMaterial ( const Material )
inlineoverridevirtual

Passes the material in which this particle is embedded.

Reimplemented from IReParticle.

Definition at line 40 of file ReMesocrystal.h.

41  {
42  m_basis->setAmbientMaterial(material);
43  }
virtual void setAmbientMaterial(const Material &)
Passes the material in which this particle is embedded.
Definition: IReParticle.h:47

References m_basis, and IReParticle::setAmbientMaterial().

Here is the call graph for this function:

◆ theFF()

complex_t ReMesocrystal::theFF ( const WavevectorInfo wavevectors) const
overridevirtual

Returns scattering amplitude for complex wavevectors ki, kf.

Implements IReParticle.

Definition at line 57 of file ReMesocrystal.cpp.

58 {
59  // retrieve reciprocal lattice vectors within reasonable radius
60  C3 q = wavevectors.getQ();
61  double radius = 2.1 * m_max_rec_length;
62  std::vector<R3> rec_vectors = m_lattice.reciprocalLatticeVectorsWithinRadius(q.real(), radius);
63 
64  // perform convolution on these lattice vectors
65  complex_t result(0.0, 0.0);
66  for (const auto& rec : rec_vectors) {
67  auto dw_factor = debyeWallerFactor(rec);
68  WavevectorInfo basis_wavevectors(R3(), -rec, wavevectors.vacuumLambda());
69  complex_t basis_factor = m_basis->theFF(basis_wavevectors);
70  WavevectorInfo meso_wavevectors(C3(), rec.complex() - q, wavevectors.vacuumLambda());
71  complex_t meso_factor = m_outer_shape->theFF(meso_wavevectors);
72  result += dw_factor * basis_factor * meso_factor;
73  }
74  // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3
75  // is canceled by the convolution of Fourier transforms :
76  return result / m_lattice.unitCellVolume();
77 }
virtual complex_t theFF(const WavevectorInfo &wavevectors) const =0
Returns scattering amplitude for complex wavevectors ki, kf.
double unitCellVolume() const
Returns the volume of the unit cell.
Definition: Lattice3D.cpp:56
std::vector< R3 > reciprocalLatticeVectorsWithinRadius(R3 q, double dq) const
Returns a list of reciprocal lattice vectors within distance dq of a vector q.
Definition: Lattice3D.cpp:75
complex_t debyeWallerFactor(const R3 &q_i) const
complex_t theFF(const WavevectorInfo &wavevectors) const override
Returns scattering amplitude for complex wavevectors ki, kf.
Definition: ReParticle.cpp:100
Holds all wavevector information relevant for calculating form factors.
double vacuumLambda() const
C3 getQ() const

References debyeWallerFactor(), WavevectorInfo::getQ(), m_basis, m_lattice, m_max_rec_length, m_outer_shape, Lattice3D::reciprocalLatticeVectorsWithinRadius(), IReParticle::theFF(), ReParticle::theFF(), Lattice3D::unitCellVolume(), and WavevectorInfo::vacuumLambda().

Here is the call graph for this function:

◆ thePolFF()

SpinMatrix ReMesocrystal::thePolFF ( const WavevectorInfo wavevectors) const
overridevirtual

Returns scattering amplitude for matrix interactions.

Reimplemented from IReParticle.

Definition at line 79 of file ReMesocrystal.cpp.

80 {
81  // retrieve reciprocal lattice vectors within reasonable radius
82  C3 q = wavevectors.getQ();
83  double radius = 2.1 * m_max_rec_length;
84  std::vector<R3> rec_vectors = m_lattice.reciprocalLatticeVectorsWithinRadius(q.real(), radius);
85 
86  // perform convolution on these lattice vectors
87  SpinMatrix result;
88  for (const auto& rec : rec_vectors) {
89  auto dw_factor = debyeWallerFactor(rec);
90  WavevectorInfo basis_wavevectors(R3(), -rec, wavevectors.vacuumLambda());
91  SpinMatrix basis_factor = m_basis->thePolFF(basis_wavevectors);
92  WavevectorInfo meso_wavevectors(C3(), rec.complex() - q, wavevectors.vacuumLambda());
93  complex_t meso_factor = m_outer_shape->theFF(meso_wavevectors);
94  result += dw_factor * basis_factor * meso_factor;
95  }
96  // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3
97  // is canceled by the convolution of Fourier transforms :
98  return result / m_lattice.unitCellVolume();
99 }
virtual SpinMatrix thePolFF(const WavevectorInfo &wavevectors) const
Returns scattering amplitude for matrix interactions.
Definition: IReParticle.cpp:20

References debyeWallerFactor(), WavevectorInfo::getQ(), m_basis, m_lattice, m_max_rec_length, m_outer_shape, Lattice3D::reciprocalLatticeVectorsWithinRadius(), ReParticle::theFF(), IReParticle::thePolFF(), Lattice3D::unitCellVolume(), and WavevectorInfo::vacuumLambda().

Here is the call graph for this function:

◆ topZ()

double ReMesocrystal::topZ ( const IRotation rotation) const
overridevirtual

Returns the z-coordinate of the lowest point in this shape after a given rotation.

Implements IReParticle.

Definition at line 52 of file ReMesocrystal.cpp.

53 {
54  return m_outer_shape->topZ(rotation);
55 }
double topZ(const IRotation *rotation) const override
Returns the z-coordinate of the lowest point in this shape after a given rotation.
Definition: ReParticle.cpp:146

References m_outer_shape, and ReParticle::topZ().

Here is the call graph for this function:

◆ transferToCPP()

virtual void ICloneable::transferToCPP ( )
inlinevirtualinherited

Used for Python overriding of clone (see swig/tweaks.py)

Definition at line 32 of file ICloneable.h.

◆ volume()

double ReMesocrystal::volume ( ) const
overridevirtual

Returns the total volume of the particle of this form factor's shape.

Reimplemented from IReParticle.

Definition at line 37 of file ReMesocrystal.cpp.

38 {
39  return m_outer_shape->volume();
40 }
double volume() const override
Returns the total volume of the particle of this form factor's shape.
Definition: ReParticle.cpp:80

References m_outer_shape, and ReParticle::volume().

Here is the call graph for this function:

Member Data Documentation

◆ m_basis

IReParticle* ReMesocrystal::m_basis
private

Definition at line 60 of file ReMesocrystal.h.

Referenced by ~ReMesocrystal(), clone(), setAmbientMaterial(), theFF(), and thePolFF().

◆ m_lattice

Lattice3D ReMesocrystal::m_lattice
private

Definition at line 59 of file ReMesocrystal.h.

Referenced by calculateLargestReciprocalDistance(), clone(), theFF(), and thePolFF().

◆ m_max_rec_length

double ReMesocrystal::m_max_rec_length
private

Definition at line 63 of file ReMesocrystal.h.

Referenced by calculateLargestReciprocalDistance(), theFF(), and thePolFF().

◆ m_outer_shape

ReParticle* ReMesocrystal::m_outer_shape
private

The outer shape of this mesocrystal.

Definition at line 61 of file ReMesocrystal.h.

Referenced by ~ReMesocrystal(), bottomZ(), clone(), radialExtension(), theFF(), thePolFF(), topZ(), and volume().

◆ m_position_variance

double ReMesocrystal::m_position_variance
private

Definition at line 62 of file ReMesocrystal.h.

Referenced by clone(), and debyeWallerFactor().


The documentation for this class was generated from the following files: