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

Description

A reprocessed simple particle, with shape m_ff.

Definition at line 33 of file ReParticle.h.

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

Public Member Functions

 ReParticle (const IFormFactor &ff)
 
 ~ReParticle () override
 
double bottomZ (const IRotation *rotation) const override
 Returns the z-coordinate of the lowest point in this shape after a given rotation. More...
 
ReParticleclone () const override
 
const IFormFactorformfactor_at_bottom () const
 
virtual complex_t formfactor_at_bottom (C3 q) const
 
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 &ambient_material) override
 Sets the ambient material. More...
 
void setMaterial (const Material &material)
 Sets the material of the scatterer. More...
 
void setPosition (const R3 &position)
 
void setRotMatrix (const RotMatrix &rotMatrix)
 
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...
 

Static Public Member Functions

static ReParticlecreateTransformedFormFactor (const IFormFactor &formfactor, const IRotation *rot, R3 translation)
 

Protected Member Functions

 ReParticle (IFormFactor *ff, const Material *material, const Material *ambient_material, const R3 *position, const RotMatrix *rotMatrix)
 

Protected Attributes

std::unique_ptr< const Materialm_ambient_material
 
std::unique_ptr< const IFormFactorm_ff
 
std::unique_ptr< const Materialm_material
 
std::unique_ptr< const R3 > m_position
 
std::unique_ptr< const RotMatrixm_rotMatrix
 

Constructor & Destructor Documentation

◆ ReParticle() [1/2]

ReParticle::ReParticle ( const IFormFactor ff)

Definition at line 33 of file ReParticle.cpp.

34  : ReParticle(ff.clone(), nullptr, nullptr, nullptr, nullptr)
35 {
36 }
ReParticle(const IFormFactor &ff)
Definition: ReParticle.cpp:33

Referenced by clone(), and createTransformedFormFactor().

◆ ~ReParticle()

ReParticle::~ReParticle ( )
overridedefault

◆ ReParticle() [2/2]

ReParticle::ReParticle ( IFormFactor ff,
const Material material,
const Material ambient_material,
const R3 *  position,
const RotMatrix rotMatrix 
)
protected

Definition at line 23 of file ReParticle.cpp.

25  : m_ff(std::move(ff))
26  , m_material(std::move(material))
27  , m_ambient_material(std::move(ambient_material))
28  , m_position(std::move(position))
29  , m_rotMatrix(std::move(rotMatrix))
30 {
31 }
std::unique_ptr< const RotMatrix > m_rotMatrix
Definition: ReParticle.h:77
std::unique_ptr< const Material > m_material
Definition: ReParticle.h:74
std::unique_ptr< const IFormFactor > m_ff
Definition: ReParticle.h:68
std::unique_ptr< const Material > m_ambient_material
Definition: ReParticle.h:75
std::unique_ptr< const R3 > m_position
Definition: ReParticle.h:76

Member Function Documentation

◆ bottomZ()

double ReParticle::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 134 of file ReParticle.cpp.

135 {
136  RotMatrix transform = rotation ? rotation->rotMatrix() : RotMatrix();
137  if (m_rotMatrix)
138  transform = transform * *m_rotMatrix;
139  std::unique_ptr<const IRotation> total_rotation(IRotation::createRotation(transform));
140  double result = m_ff->bottomZ(total_rotation.get());
141  if (m_position)
142  result += (rotation ? rotation->transformed(*m_position) : *m_position).z();
143  return result;
144 }
virtual RotMatrix rotMatrix() const =0
Returns transformation.
R3 transformed(const R3 &v) const
Definition: Rotations.cpp:42
static IRotation * createRotation(const RotMatrix &transform)
Definition: Rotations.cpp:28
Rotation matrix in three dimensions. Represents group SO(3). Internal parameterization based on quate...
Definition: RotMatrix.h:25

References IRotation::createRotation(), m_ff, m_position, m_rotMatrix, IRotation::rotMatrix(), and IRotation::transformed().

Referenced by ReMesocrystal::bottomZ().

Here is the call graph for this function:

◆ clone()

ReParticle * ReParticle::clone ( ) const
overridevirtual

Implements IReParticle.

Definition at line 40 of file ReParticle.cpp.

41 {
42  return new ReParticle(m_ff->clone(), m_material ? new Material(*m_material) : nullptr,
44  m_position ? new R3(*m_position) : nullptr,
45  m_rotMatrix ? new RotMatrix(*m_rotMatrix) : nullptr);
46 }
A wrapper for underlying material implementation.
Definition: Material.h:35

References ReParticle(), m_ambient_material, m_ff, m_material, m_position, and m_rotMatrix.

Here is the call graph for this function:

◆ createTransformedFormFactor()

ReParticle * ReParticle::createTransformedFormFactor ( const IFormFactor formfactor,
const IRotation rot,
R3  translation 
)
static

Definition at line 49 of file ReParticle.cpp.

51 {
52  auto* result = new ReParticle(formfactor);
53  if (rot && !rot->isIdentity())
54  result->setRotMatrix(rot->rotMatrix());
55  if (translation != R3())
56  result->setPosition(translation);
57  return result;
58 }
virtual bool isIdentity() const
Returns true if rotation matrix is identity matrix (no rotations)
Definition: Rotations.cpp:47

References ReParticle(), IRotation::isIdentity(), and IRotation::rotMatrix().

Here is the call graph for this function:

◆ formfactor_at_bottom() [1/2]

const IFormFactor * ReParticle::formfactor_at_bottom ( ) const

Definition at line 90 of file ReParticle.cpp.

91 {
92  return m_ff.get();
93 }

References m_ff.

◆ formfactor_at_bottom() [2/2]

complex_t ReParticle::formfactor_at_bottom ( C3  q) const
virtual

Definition at line 95 of file ReParticle.cpp.

96 {
97  return m_ff->formfactor_at_bottom(q);
98 }

References m_ff.

◆ radialExtension()

double ReParticle::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 85 of file ReParticle.cpp.

86 {
87  return m_ff->radialExtension();
88 }

References m_ff.

Referenced by ReMesocrystal::radialExtension().

◆ setAmbientMaterial()

void ReParticle::setAmbientMaterial ( const Material ambient_material)
overridevirtual

Sets the ambient material.

Reimplemented from IReParticle.

Definition at line 65 of file ReParticle.cpp.

66 {
67  m_ambient_material = std::make_unique<Material>(ambient_material);
68 }

References m_ambient_material.

◆ setMaterial()

void ReParticle::setMaterial ( const Material material)

Sets the material of the scatterer.

Definition at line 60 of file ReParticle.cpp.

61 {
62  m_material = std::make_unique<Material>(material);
63 }

References m_material.

◆ setPosition()

void ReParticle::setPosition ( const R3 &  position)

Definition at line 70 of file ReParticle.cpp.

71 {
72  m_position = std::make_unique<R3>(position);
73 }

References m_position.

◆ setRotMatrix()

void ReParticle::setRotMatrix ( const RotMatrix rotMatrix)

Definition at line 75 of file ReParticle.cpp.

76 {
77  m_rotMatrix = std::make_unique<RotMatrix>(rotMatrix);
78 }

References m_rotMatrix.

◆ theFF()

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

Returns scattering amplitude for complex wavevectors ki, kf.

Implements IReParticle.

Definition at line 100 of file ReParticle.cpp.

101 {
102  WavevectorInfo wavevectors2 =
103  m_rotMatrix ? wavevectors.transformed(m_rotMatrix->Inverse()) : wavevectors;
104  complex_t result = m_ff->theFF(wavevectors2);
106  result = (m_material->scalarSubtrSLD(wavevectors2)
107  - m_ambient_material->scalarSubtrSLD(wavevectors2))
108  * result;
109  if (m_position)
110  result *= exp_I(m_position->dot(wavevectors.getQ()));
111  return result;
112 }
Holds all wavevector information relevant for calculating form factors.
WavevectorInfo transformed(const RotMatrix &transform) const
C3 getQ() const

References WavevectorInfo::getQ(), m_ambient_material, m_ff, m_material, m_position, m_rotMatrix, and WavevectorInfo::transformed().

Referenced by ReMesocrystal::theFF(), and ReMesocrystal::thePolFF().

Here is the call graph for this function:

◆ thePolFF()

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

Returns scattering amplitude for matrix interactions.

Reimplemented from IReParticle.

Definition at line 114 of file ReParticle.cpp.

115 {
116  WavevectorInfo wavevectors2 =
117  m_rotMatrix ? wavevectors.transformed(m_rotMatrix->Inverse()) : wavevectors;
118  SpinMatrix result = m_ff->thePolFF(wavevectors2);
120  // the conjugated linear part of time reversal operator T
121  // (T=UK with K complex conjugate operator and U is linear)
122  SpinMatrix time_reverse_conj(0, 1, -1, 0);
123  // the interaction and time reversal taken together:
124  SpinMatrix V_eff = time_reverse_conj
125  * (m_material->polarizedSubtrSLD(wavevectors2)
126  - m_ambient_material->polarizedSubtrSLD(wavevectors2));
127  result *= V_eff;
128  }
129  if (m_position)
130  return result *= exp_I(m_position->dot(wavevectors.getQ()));
131  return result;
132 }

References WavevectorInfo::getQ(), m_ambient_material, m_ff, m_material, m_position, m_rotMatrix, and WavevectorInfo::transformed().

Here is the call graph for this function:

◆ topZ()

double ReParticle::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 146 of file ReParticle.cpp.

147 {
148  RotMatrix transform = rotation ? rotation->rotMatrix() : RotMatrix();
149  if (m_rotMatrix)
150  transform = transform * *m_rotMatrix;
151  std::unique_ptr<const IRotation> total_rotation(IRotation::createRotation(transform));
152  double result = m_ff->topZ(total_rotation.get());
153  if (m_position)
154  result += (rotation ? rotation->transformed(*m_position) : *m_position).z();
155  return result;
156 }

References IRotation::createRotation(), m_ff, m_position, m_rotMatrix, IRotation::rotMatrix(), and IRotation::transformed().

Referenced by ReMesocrystal::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 ReParticle::volume ( ) const
overridevirtual

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

Reimplemented from IReParticle.

Definition at line 80 of file ReParticle.cpp.

81 {
82  return m_ff->volume();
83 }

References m_ff.

Referenced by ReMesocrystal::volume().

Member Data Documentation

◆ m_ambient_material

std::unique_ptr<const Material> ReParticle::m_ambient_material
protected

Definition at line 75 of file ReParticle.h.

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

◆ m_ff

std::unique_ptr<const IFormFactor> ReParticle::m_ff
protected

◆ m_material

std::unique_ptr<const Material> ReParticle::m_material
protected

Definition at line 74 of file ReParticle.h.

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

◆ m_position

std::unique_ptr<const R3> ReParticle::m_position
protected

Definition at line 76 of file ReParticle.h.

Referenced by bottomZ(), clone(), setPosition(), theFF(), thePolFF(), and topZ().

◆ m_rotMatrix

std::unique_ptr<const RotMatrix> ReParticle::m_rotMatrix
protected

Definition at line 77 of file ReParticle.h.

Referenced by bottomZ(), clone(), setRotMatrix(), theFF(), thePolFF(), and topZ().


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