BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InterferenceFunction2DParaCrystal Class Reference

Interference function of a 2D paracrystal. More...

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

Public Member Functions

 InterferenceFunction2DParaCrystal (const Lattice2D &lattice, double damping_length, double domain_size_1, double domain_size_2)
 
 ~InterferenceFunction2DParaCrystal () override
 
void accept (INodeVisitor *visitor) const override
 Calls the INodeVisitor's visit method. More...
 
InterferenceFunction2DParaCrystalclone () const override
 Returns a clone of this ISampleNode object. More...
 
std::vector< const Material * > containedMaterials () const
 Returns set of unique materials contained in this ISampleNode. More...
 
int copyNumber (const INode *node) const
 Returns copyNumber of child, which takes into account existence of children with same name. More...
 
ParameterPoolcreateParameterTree () const
 Creates new parameter pool, with all local parameters and those of its children. More...
 
double dampingLength () const
 
std::string displayName () const
 Returns display name, composed from the name of node and it's copy number. More...
 
std::vector< double > domainSizes () const
 
double DWfactor (kvector_t q) const
 Evaluates the Debye-Waller factor for a given wavevector transfer. More...
 
virtual double evaluate (const kvector_t q, double outer_iff=1.0) const
 Evaluates the interference function for a given wavevector transfer. More...
 
std::vector< const INode * > getChildren () const override
 Returns a vector of children. More...
 
const std::string & getName () const
 
double getParticleDensity () const override
 If defined by this interference function's parameters, returns the particle density (per area). More...
 
bool integrationOverXi () const
 
bool isMagnetic () const
 Returns true if there is any magnetic material in this ISampleNode. More...
 
const Lattice2Dlattice () const
 
virtual const Materialmaterial () const
 Returns nullptr, unless overwritten to return a specific material. More...
 
virtual void onChange ()
 Action to be taken in inherited class when a parameter has changed. More...
 
RealParameterparameter (const std::string &name) const
 Returns parameter with given 'name'. More...
 
ParameterPoolparameterPool () const
 Returns pointer to the parameter pool. More...
 
std::string parametersToString () const
 Returns multiline string representing available parameters. More...
 
INodeparent ()
 
const INodeparent () const
 
const IFTDistribution2Dpdf1 () const
 
const IFTDistribution2Dpdf2 () const
 
double positionVariance () const
 Returns the position variance. More...
 
std::vector< const INode * > progeny () const
 Returns a vector of all descendants. More...
 
void registerChild (INode *node)
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
void setDampingLength (double damping_length)
 Sets the damping length. More...
 
void setDomainSizes (double size_1, double size_2)
 Sets the sizes of coherence domains. More...
 
void setIntegrationOverXi (bool integrate_xi)
 Enables/disables averaging over the lattice rotation angle. More...
 
void setName (const std::string &name)
 
void setParameterValue (const std::string &name, double value)
 
virtual void setParent (const INode *newParent)
 
void setPositionVariance (double var)
 Sets the variance of the position for the calculation of the DW factor It is defined as the variance in each relevant dimension. More...
 
void setProbabilityDistributions (const IFTDistribution2D &pdf_1, const IFTDistribution2D &pdf_2)
 Sets the probability distributions (Fourier transformed) for the two lattice directions. More...
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
virtual bool supportsMultilayer () const
 Indicates if this interference function can be used with a multilayer (DWBA mode) More...
 
virtual void transferToCPP ()
 Used for Python overriding of clone (see swig/tweaks.py) More...
 
virtual std::string treeToString () const
 Returns multiline string representing tree structure below the node. More...
 

Static Public Member Functions

static std::string XComponentName (const std::string &base_name)
 
static std::string YComponentName (const std::string &base_name)
 
static std::string ZComponentName (const std::string &base_name)
 

Protected Member Functions

double iff_no_inner (const kvector_t q, double outer_iff) const
 Calculates the structure factor in the absence of extra inner structure. More...
 

Protected Attributes

const size_t m_NP
 
std::vector< double > m_P
 
double m_position_var
 

Private Member Functions

complex_t FTPDF (double qx, double qy, double xi, size_t index) const
 
double iff_without_dw (const kvector_t q) const override
 Calculates the structure factor without Debye-Waller factor. More...
 
double interference1D (double qx, double qy, double xi, size_t index) const
 Returns interference function for fixed xi in the dimension determined by the given index. More...
 
double interferenceForXi (double xi) const
 Returns interference function for fixed angle xi. More...
 
void transformToPrincipalAxes (double qx, double qy, double gamma, double delta, double &q_pa_1, double &q_pa_2) const
 

Private Attributes

double m_damping_length
 Damping length for removing delta function singularity at q=0. More...
 
double m_domain_sizes [2]
 Coherence domain sizes. More...
 
bool m_integrate_xi
 Integrate over the orientation xi. More...
 
std::unique_ptr< Lattice2Dm_lattice
 
std::string m_name
 
const INodem_parent {nullptr}
 
std::unique_ptr< IFTDistribution2Dm_pdf1
 
std::unique_ptr< IFTDistribution2Dm_pdf2
 
std::unique_ptr< ParameterPoolm_pool
 parameter pool (kind of pointer-to-implementation) More...
 
double m_qx
 
double m_qy
 

Detailed Description

Interference function of a 2D paracrystal.

Definition at line 28 of file InterferenceFunction2DParaCrystal.h.

Constructor & Destructor Documentation

◆ InterferenceFunction2DParaCrystal()

InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal ( const Lattice2D lattice,
double  damping_length,
double  domain_size_1,
double  domain_size_2 
)

Definition at line 21 of file InterferenceFunction2DParaCrystal.cpp.

25  : IInterferenceFunction(0), m_integrate_xi(false), m_damping_length(damping_length)
26 {
27  setName("Interference2DParaCrystal");
28  m_lattice.reset(lattice.clone());
29  registerChild(m_lattice.get());
30  setDomainSizes(domain_size_1, domain_size_2);
31  registerParameter("DampingLength", &m_damping_length).setUnit("nm").setNonnegative();
32  registerParameter("DomainSize1", &m_domain_sizes[0]).setUnit("nm").setNonnegative();
33  registerParameter("DomainSize2", &m_domain_sizes[1]).setUnit("nm").setNonnegative();
34 }
IInterferenceFunction(const NodeMeta &meta, const std::vector< double > &PValues)
void registerChild(INode *node)
Definition: INode.cpp:57
void setName(const std::string &name)
RealParameter & registerParameter(const std::string &name, double *parpointer)
double m_domain_sizes[2]
Coherence domain sizes.
bool m_integrate_xi
Integrate over the orientation xi.
double m_damping_length
Damping length for removing delta function singularity at q=0.
void setDomainSizes(double size_1, double size_2)
Sets the sizes of coherence domains.
virtual Lattice2D * clone() const =0
RealParameter & setNonnegative()
RealParameter & setUnit(const std::string &name)

References Lattice2D::clone(), lattice(), m_damping_length, m_domain_sizes, m_lattice, INode::registerChild(), IParametricComponent::registerParameter(), setDomainSizes(), IParametricComponent::setName(), RealParameter::setNonnegative(), and RealParameter::setUnit().

Referenced by clone().

Here is the call graph for this function:

◆ ~InterferenceFunction2DParaCrystal()

InterferenceFunction2DParaCrystal::~InterferenceFunction2DParaCrystal ( )
overridedefault

Member Function Documentation

◆ accept()

void InterferenceFunction2DParaCrystal::accept ( INodeVisitor visitor) const
inlineoverridevirtual

Calls the INodeVisitor's visit method.

Implements INode.

Definition at line 37 of file InterferenceFunction2DParaCrystal.h.

37 { visitor->visit(this); }
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151

References INodeVisitor::visit().

Here is the call graph for this function:

◆ clone()

InterferenceFunction2DParaCrystal * InterferenceFunction2DParaCrystal::clone ( ) const
overridevirtual

Returns a clone of this ISampleNode object.

Implements IInterferenceFunction.

Definition at line 38 of file InterferenceFunction2DParaCrystal.cpp.

39 {
42  ret->setPositionVariance(m_position_var);
43  if (m_pdf1 && m_pdf2)
44  ret->setProbabilityDistributions(*m_pdf1, *m_pdf2);
45  ret->setIntegrationOverXi(m_integrate_xi);
46  return ret;
47 }
InterferenceFunction2DParaCrystal(const Lattice2D &lattice, double damping_length, double domain_size_1, double domain_size_2)
std::unique_ptr< IFTDistribution2D > m_pdf1
std::unique_ptr< IFTDistribution2D > m_pdf2

References InterferenceFunction2DParaCrystal(), m_damping_length, m_domain_sizes, m_integrate_xi, m_lattice, m_pdf1, m_pdf2, and IInterferenceFunction::m_position_var.

Here is the call graph for this function:

◆ containedMaterials()

std::vector< const Material * > ISampleNode::containedMaterials ( ) const
inherited

Returns set of unique materials contained in this ISampleNode.

Definition at line 26 of file ISampleNode.cpp.

27 {
28  std::vector<const Material*> result;
29  if (const Material* p_material = material())
30  result.push_back(p_material);
31  for (const auto* child : getChildren()) {
32  if (const ISampleNode* sample = dynamic_cast<const ISampleNode*>(child)) {
33  for (const Material* p_material : sample->containedMaterials())
34  result.push_back(p_material);
35  }
36  }
37  return result;
38 }
virtual std::vector< const INode * > getChildren() const
Returns a vector of children.
Definition: INode.cpp:63
Abstract base class for sample components and properties related to scattering.
Definition: ISampleNode.h:28
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISampleNode.h:37
A wrapper for underlying material implementation.
Definition: Material.h:29

References INode::getChildren(), and ISampleNode::material().

Referenced by MultiLayerUtils::ContainsCompatibleMaterials(), SampleToPython::initLabels(), and ISampleNode::isMagnetic().

Here is the call graph for this function:

◆ copyNumber()

int INode::copyNumber ( const INode node) const
inherited

Returns copyNumber of child, which takes into account existence of children with same name.

Definition at line 94 of file INode.cpp.

95 {
96  if (node->parent() != this)
97  return -1;
98 
99  int result(-1), count(0);
100  for (auto child : getChildren()) {
101 
102  if (child == nullptr)
103  throw std::runtime_error("INode::copyNumber() -> Error. Nullptr as child.");
104 
105  if (child == node)
106  result = count;
107 
108  if (child->getName() == node->getName())
109  ++count;
110  }
111 
112  return count > 1 ? result : -1;
113 }
const INode * parent() const
Definition: INode.cpp:84
const std::string & getName() const

References INode::getChildren(), IParametricComponent::getName(), and INode::parent().

Referenced by INode::displayName().

Here is the call graph for this function:

◆ createParameterTree()

ParameterPool * INode::createParameterTree ( ) const
virtualinherited

Creates new parameter pool, with all local parameters and those of its children.

Reimplemented from IParametricComponent.

Definition at line 126 of file INode.cpp.

127 {
128  std::unique_ptr<ParameterPool> result(new ParameterPool);
129 
130  for (const INode* child : progeny()) {
131  const std::string path = NodeUtils::nodePath(child, parent()) + "/";
132  child->parameterPool()->copyToExternalPool(path, result.get());
133  }
134 
135  return result.release();
136 }
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
std::vector< const INode * > progeny() const
Returns a vector of all descendants.
Definition: INode.cpp:68
Container with parameters for IParametricComponent object.
Definition: ParameterPool.h:29
std::string nodePath(const INode *node, const INode *root=nullptr)
Returns path composed of node's displayName, with respect to root node.
Definition: NodeUtils.cpp:89

References NodeUtils::nodePath(), INode::parent(), and INode::progeny().

Referenced by ISimulation::runSimulation(), DepthProbeSimulation::validateParametrization(), OffSpecularSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().

Here is the call graph for this function:

◆ dampingLength()

double InterferenceFunction2DParaCrystal::dampingLength ( ) const
inline

Definition at line 50 of file InterferenceFunction2DParaCrystal.h.

50 { return m_damping_length; }

References m_damping_length.

Referenced by TransformFromDomain::set2DParaCrystalItem().

◆ displayName()

std::string INode::displayName ( ) const
inherited

Returns display name, composed from the name of node and it's copy number.

Definition at line 115 of file INode.cpp.

116 {
117  std::string result = getName();
118  if (m_parent) {
119  int index = m_parent->copyNumber(this);
120  if (index >= 0)
121  result = result + std::to_string(index);
122  }
123  return result;
124 }
const INode * m_parent
Definition: INode.h:83
int copyNumber(const INode *node) const
Returns copyNumber of child, which takes into account existence of children with same name.
Definition: INode.cpp:94

References INode::copyNumber(), IParametricComponent::getName(), and INode::m_parent.

Referenced by NodeUtils::nodePath().

Here is the call graph for this function:

◆ domainSizes()

std::vector< double > InterferenceFunction2DParaCrystal::domainSizes ( ) const

Definition at line 177 of file InterferenceFunction2DParaCrystal.cpp.

178 {
179  return {m_domain_sizes[0], m_domain_sizes[1]};
180 }

References m_domain_sizes.

Referenced by TransformFromDomain::set2DParaCrystalItem().

◆ DWfactor()

double IInterferenceFunction::DWfactor ( kvector_t  q) const
inherited

Evaluates the Debye-Waller factor for a given wavevector transfer.

Definition at line 48 of file IInterferenceFunction.cpp.

49 {
50  // remove z component for two dimensional interference functions:
51  if (supportsMultilayer())
52  q.setZ(0.0);
53  return std::exp(-q.mag2() * m_position_var);
54 }
double mag2() const
Returns magnitude squared of the vector.
void setZ(const T &a)
Sets z-component in cartesian coordinate system.
Definition: BasicVector3D.h:74
virtual bool supportsMultilayer() const
Indicates if this interference function can be used with a multilayer (DWBA mode)

References IInterferenceFunction::m_position_var, BasicVector3D< T >::mag2(), BasicVector3D< T >::setZ(), and IInterferenceFunction::supportsMultilayer().

Referenced by IInterferenceFunction::iff_no_inner().

Here is the call graph for this function:

◆ evaluate()

double IInterferenceFunction::evaluate ( const kvector_t  q,
double  outer_iff = 1.0 
) const
virtualinherited

Evaluates the interference function for a given wavevector transfer.

Reimplemented in InterferenceFunction2DSuperLattice.

Definition at line 35 of file IInterferenceFunction.cpp.

36 {
37  return iff_no_inner(q, outer_iff);
38 }
double iff_no_inner(const kvector_t q, double outer_iff) const
Calculates the structure factor in the absence of extra inner structure.

References IInterferenceFunction::iff_no_inner().

Here is the call graph for this function:

◆ FTPDF()

complex_t InterferenceFunction2DParaCrystal::FTPDF ( double  qx,
double  qy,
double  xi,
size_t  index 
) const
private

Definition at line 157 of file InterferenceFunction2DParaCrystal.cpp.

159 {
160  double length = (index ? m_lattice->length2() : m_lattice->length1());
161 
162  const IFTDistribution2D* pdf = (index ? m_pdf2.get() : m_pdf1.get());
163  double qa = qx * length * std::cos(xi) + qy * length * std::sin(xi);
164  complex_t phase = exp_I(qa);
165  // transform q to principal axes:
166  double qp1, qp2;
167  double gamma = xi + pdf->gamma();
168  double delta = pdf->delta();
169  transformToPrincipalAxes(qx, qy, gamma, delta, qp1, qp2);
170  double amplitude = pdf->evaluate(qp1, qp2);
171  complex_t result = phase * amplitude;
172  if (m_damping_length != 0.0)
173  result *= std::exp(-length / m_damping_length);
174  return result;
175 }
std::complex< double > complex_t
Definition: Complex.h:20
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Definition: Complex.h:30
Interface for two-dimensional distributions in Fourier space.
double delta() const
Angle in direct space between X- and Y-axis of distribution.
virtual double evaluate(double qx, double qy) const =0
evaluate Fourier transformed distribution for q in X,Y coordinates the original distribution (in real...
double gamma() const
void transformToPrincipalAxes(double qx, double qy, double gamma, double delta, double &q_pa_1, double &q_pa_2) const

References IFTDistribution2D::delta(), IFTDistribution2D::evaluate(), exp_I(), IFTDistribution2D::gamma(), m_damping_length, m_lattice, m_pdf1, m_pdf2, and transformToPrincipalAxes().

Referenced by interference1D().

Here is the call graph for this function:

◆ getChildren()

std::vector< const INode * > InterferenceFunction2DParaCrystal::getChildren ( ) const
overridevirtual

Returns a vector of children.

Reimplemented from INode.

Definition at line 76 of file InterferenceFunction2DParaCrystal.cpp.

77 {
78  return std::vector<const INode*>() << m_pdf1 << m_pdf2 << m_lattice;
79 }

References m_lattice, m_pdf1, and m_pdf2.

◆ getName()

◆ getParticleDensity()

double InterferenceFunction2DParaCrystal::getParticleDensity ( ) const
overridevirtual

If defined by this interference function's parameters, returns the particle density (per area).

Otherwise, returns zero or a user-defined value

Reimplemented from IInterferenceFunction.

Definition at line 70 of file InterferenceFunction2DParaCrystal.cpp.

71 {
72  double area = m_lattice->unitCellArea();
73  return area == 0.0 ? 0.0 : 1.0 / area;
74 }

References m_lattice.

◆ iff_no_inner()

double IInterferenceFunction::iff_no_inner ( const kvector_t  q,
double  outer_iff 
) const
protectedinherited

Calculates the structure factor in the absence of extra inner structure.

Definition at line 56 of file IInterferenceFunction.cpp.

57 {
58  return DWfactor(q) * (iff_without_dw(q) * outer_iff - 1.0) + 1.0;
59 }
double DWfactor(kvector_t q) const
Evaluates the Debye-Waller factor for a given wavevector transfer.
virtual double iff_without_dw(const kvector_t q) const =0
Calculates the structure factor without Debye-Waller factor.

References IInterferenceFunction::DWfactor(), and IInterferenceFunction::iff_without_dw().

Referenced by IInterferenceFunction::evaluate(), and InterferenceFunction2DSuperLattice::interferenceForXi().

Here is the call graph for this function:

◆ iff_without_dw()

double InterferenceFunction2DParaCrystal::iff_without_dw ( const kvector_t  q) const
overrideprivatevirtual

Calculates the structure factor without Debye-Waller factor.

Implements IInterferenceFunction.

Definition at line 81 of file InterferenceFunction2DParaCrystal.cpp.

82 {
83  m_qx = q.x();
84  m_qy = q.y();
85  if (!m_integrate_xi)
86  return interferenceForXi(m_lattice->rotationAngle());
87  return RealIntegrator().integrate([&](double xi) -> double { return interferenceForXi(xi); },
88  0.0, M_TWOPI)
89  / M_TWOPI;
90 }
#define M_TWOPI
Definition: Constants.h:54
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:65
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:63
double interferenceForXi(double xi) const
Returns interference function for fixed angle xi.
To integrate a real function of a real variable.
Definition: IntegratorGK.h:28
double integrate(const std::function< double(double)> &f, double lmin, double lmax)

References RealIntegrator::integrate(), interferenceForXi(), m_integrate_xi, m_lattice, m_qx, m_qy, M_TWOPI, BasicVector3D< T >::x(), and BasicVector3D< T >::y().

Here is the call graph for this function:

◆ integrationOverXi()

bool InterferenceFunction2DParaCrystal::integrationOverXi ( ) const
inline

Definition at line 49 of file InterferenceFunction2DParaCrystal.h.

49 { return m_integrate_xi; }

References m_integrate_xi.

Referenced by TransformFromDomain::set2DParaCrystalItem().

◆ interference1D()

double InterferenceFunction2DParaCrystal::interference1D ( double  qx,
double  qy,
double  xi,
size_t  index 
) const
private

Returns interference function for fixed xi in the dimension determined by the given index.

Definition at line 120 of file InterferenceFunction2DParaCrystal.cpp.

122 {
123  if (index > 1)
124  throw std::runtime_error("InterferenceFunction2DParaCrystal::"
125  "interference1D() -> Error! Index of interference function "
126  "probability must be < 2");
127  if (!m_pdf1 || !m_pdf2)
128  throw std::runtime_error("InterferenceFunction2DParaCrystal::"
129  "interference1D() -> Error! Probability distributions for "
130  "interference function not properly initialized");
131 
132  double length = index ? m_lattice->length2() : m_lattice->length1();
133  int n = static_cast<int>(std::abs(m_domain_sizes[index] / length));
134  double nd = static_cast<double>(n);
135  complex_t fp = FTPDF(qx, qy, xi, index);
136  if (n < 1)
137  return ((1.0 + fp) / (1.0 - fp)).real();
138  if (std::norm(1.0 - fp) < std::numeric_limits<double>::epsilon())
139  return nd;
140  // for (1-fp)*nd small, take the series expansion to second order in nd*(1-fp)
141  if (std::abs(1.0 - fp) * nd < 2e-4) {
142  complex_t intermediate =
143  (nd - 1.0) / 2.0 + (nd * nd - 1.0) * (fp - 1.0) / 6.0
144  + (nd * nd * nd - 2.0 * nd * nd - nd + 2.0) * (fp - 1.0) * (fp - 1.0) / 24.0;
145  return 1.0 + 2.0 * intermediate.real();
146  }
147  complex_t tmp;
148  if (std::abs(fp) == 0.0
149  || std::log(std::abs(fp)) * nd < std::log(std::numeric_limits<double>::min()))
150  tmp = 0.0;
151  else
152  tmp = std::pow(fp, n);
153  complex_t intermediate = fp / (1.0 - fp) - fp * (1.0 - tmp) / nd / (1.0 - fp) / (1.0 - fp);
154  return 1.0 + 2.0 * intermediate.real();
155 }
complex_t FTPDF(double qx, double qy, double xi, size_t index) const

References FTPDF(), m_domain_sizes, m_lattice, m_pdf1, and m_pdf2.

Referenced by interferenceForXi().

Here is the call graph for this function:

◆ interferenceForXi()

double InterferenceFunction2DParaCrystal::interferenceForXi ( double  xi) const
private

Returns interference function for fixed angle xi.

Definition at line 111 of file InterferenceFunction2DParaCrystal.cpp.

112 {
113  // don't touch order of computation; problems under Windows
114  double rx = interference1D(m_qx, m_qy, xi, 0);
115  double ry = interference1D(m_qx, m_qy, xi + m_lattice->latticeAngle(), 1);
116  return rx * ry;
117 }
double interference1D(double qx, double qy, double xi, size_t index) const
Returns interference function for fixed xi in the dimension determined by the given index.

References interference1D(), m_lattice, m_qx, and m_qy.

Referenced by iff_without_dw().

Here is the call graph for this function:

◆ isMagnetic()

bool ISampleNode::isMagnetic ( ) const
inherited

Returns true if there is any magnetic material in this ISampleNode.

Definition at line 40 of file ISampleNode.cpp.

41 {
42  const auto materials = containedMaterials();
43  return std::any_of(materials.cbegin(), materials.cend(),
44  [](const Material* mat) { return mat->isMagneticMaterial(); });
45 }
std::vector< const Material * > containedMaterials() const
Returns set of unique materials contained in this ISampleNode.
Definition: ISampleNode.cpp:26

References ISampleNode::containedMaterials().

Referenced by ProcessedSample::initLayouts().

Here is the call graph for this function:

◆ lattice()

const Lattice2D & InterferenceFunction2DParaCrystal::lattice ( ) const

Definition at line 191 of file InterferenceFunction2DParaCrystal.cpp.

192 {
193  if (!m_lattice)
194  throw std::runtime_error("InterferenceFunction2DParaCrystal::lattice() -> Error. "
195  "No lattice defined.");
196  return *m_lattice;
197 }

References m_lattice.

Referenced by InterferenceFunction2DParaCrystal(), RealSpace2DParacrystalUtils::Compute2DParacrystalLatticePositions(), and TransformFromDomain::set2DParaCrystalItem().

◆ material()

virtual const Material* ISampleNode::material ( ) const
inlinevirtualinherited

◆ onChange()

◆ parameter()

RealParameter * IParametricComponent::parameter ( const std::string &  name) const
inherited

Returns parameter with given 'name'.

Definition at line 86 of file IParametricComponent.cpp.

87 {
88  return m_pool->parameter(name);
89 }
std::unique_ptr< ParameterPool > m_pool
parameter pool (kind of pointer-to-implementation)
QString const & name(EShape k)
Definition: particles.cpp:21

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by DepthProbeSimulation::initialize(), SpecularSimulation::initialize(), Lattice3D::initialize(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), IParticle::registerPosition(), Layer::registerThickness(), Lattice2D::setRotationEnabled(), and DistributionLogNormal::setUnits().

Here is the call graph for this function:

◆ parameterPool()

ParameterPool* IParametricComponent::parameterPool ( ) const
inlineinherited

Returns pointer to the parameter pool.

Definition at line 39 of file IParametricComponent.h.

39 { return m_pool.get(); } // has non-const usages!

References IParametricComponent::m_pool.

Referenced by INode::INode(), IParametricComponent::IParametricComponent(), pyfmt2::argumentList(), SampleBuilderNode::borrow_builder_parameters(), SampleBuilderNode::reset(), and IDistribution1D::setUnits().

◆ parametersToString()

std::string IParametricComponent::parametersToString ( ) const
inherited

Returns multiline string representing available parameters.

Definition at line 43 of file IParametricComponent.cpp.

44 {
45  std::ostringstream result;
46  std::unique_ptr<ParameterPool> P_pool(createParameterTree());
47  result << *P_pool << "\n";
48  return result.str();
49 }
virtual ParameterPool * createParameterTree() const
Creates new parameter pool, with all local parameters and those of its children.

References IParametricComponent::createParameterTree().

Here is the call graph for this function:

◆ parent() [1/2]

INode * INode::parent ( )
inherited

Definition at line 89 of file INode.cpp.

90 {
91  return const_cast<INode*>(m_parent);
92 }

References INode::m_parent.

◆ parent() [2/2]

◆ pdf1()

const IFTDistribution2D* InterferenceFunction2DParaCrystal::pdf1 ( ) const
inline

Definition at line 58 of file InterferenceFunction2DParaCrystal.h.

58 { return m_pdf1.get(); }

References m_pdf1.

Referenced by RealSpace2DParacrystalUtils::Compute2DParacrystalLatticePositions().

◆ pdf2()

const IFTDistribution2D* InterferenceFunction2DParaCrystal::pdf2 ( ) const
inline

Definition at line 60 of file InterferenceFunction2DParaCrystal.h.

60 { return m_pdf2.get(); }

References m_pdf2.

Referenced by RealSpace2DParacrystalUtils::Compute2DParacrystalLatticePositions().

◆ positionVariance()

double IInterferenceFunction::positionVariance ( ) const
inlineinherited

Returns the position variance.

Definition at line 39 of file IInterferenceFunction.h.

39 { return m_position_var; }

References IInterferenceFunction::m_position_var.

Referenced by TransformFromDomain::setFinite2DLatticeItem().

◆ progeny()

std::vector< const INode * > INode::progeny ( ) const
inherited

Returns a vector of all descendants.

Definition at line 68 of file INode.cpp.

69 {
70  std::vector<const INode*> result;
71  result.push_back(this);
72  for (const auto* child : getChildren()) {
73  for (const auto* p : child->progeny())
74  result.push_back(p);
75  }
76  return result;
77 }

References INode::getChildren().

Referenced by INode::createParameterTree(), and ParticleDistribution::generateParticles().

Here is the call graph for this function:

◆ registerChild()

void INode::registerChild ( INode node)
inherited

Definition at line 57 of file INode.cpp.

58 {
59  ASSERT(node);
60  node->setParent(this);
61 }
#define ASSERT(condition)
Definition: Assert.h:31
virtual void setParent(const INode *newParent)
Definition: INode.cpp:79

References ASSERT, and INode::setParent().

Referenced by Beam::Beam(), Crystal::Crystal(), IDetector::IDetector(), Instrument::Instrument(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), Particle::Particle(), ParticleDistribution::ParticleDistribution(), ParticleLayout::addAndRegisterAbstractParticle(), ParticleCoreShell::addAndRegisterCore(), MultiLayer::addAndRegisterInterface(), MultiLayer::addAndRegisterLayer(), ParticleCoreShell::addAndRegisterShell(), Layer::addLayout(), ParticleComposition::addParticlePointer(), ISimulation::initialize(), MesoCrystal::initialize(), Beam::operator=(), Instrument::operator=(), IParticle::rotate(), ParticleLayout::setAndRegisterInterferenceFunction(), ISimulation::setBackground(), InterferenceFunction1DLattice::setDecayFunction(), InterferenceFunction2DLattice::setDecayFunction(), Instrument::setDetector(), IDetector::setDetectorResolution(), Beam::setFootprintFactor(), Particle::setFormFactor(), InterferenceFunctionFinite3DLattice::setLattice(), InterferenceFunctionRadialParaCrystal::setProbabilityDistribution(), setProbabilityDistributions(), ConvolutionDetectorResolution::setResolutionFunction(), IParticle::setRotation(), LayerInterface::setRoughness(), and InterferenceFunction2DSuperLattice::setSubstructureIFF().

Here is the call graph for this function:

◆ registerParameter()

RealParameter & IParametricComponent::registerParameter ( const std::string &  name,
double *  parpointer 
)
inherited

Definition at line 51 of file IParametricComponent.cpp.

52 {
53  return m_pool->addParameter(
54  new RealParameter(name, data, getName(), [&]() -> void { onChange(); }));
55 }
virtual void onChange()
Action to be taken in inherited class when a parameter has changed.
Wraps a parameter of type double.
Definition: RealParameter.h:31

References IParametricComponent::getName(), IParametricComponent::m_pool, RealSpace::Particles::name(), and IParametricComponent::onChange().

Referenced by BasicLattice2D::BasicLattice2D(), Beam::Beam(), CylindersInBABuilder::CylindersInBABuilder(), DetectionProperties::DetectionProperties(), HexagonalLattice2D::HexagonalLattice2D(), IInterferenceFunction::IInterferenceFunction(), INode::INode(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DParaCrystal(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), Lattice2D::Lattice2D(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleDistribution::ParticleDistribution(), PlainMultiLayerBySLDBuilder::PlainMultiLayerBySLDBuilder(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), ResonatorBuilder::ResonatorBuilder(), SquareLattice2D::SquareLattice2D(), TriangularRippleBuilder::TriangularRippleBuilder(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::registerVector(), ParticleLayout::registerWeight(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ registerVector()

void IParametricComponent::registerVector ( const std::string &  base_name,
kvector_t p_vec,
const std::string &  units = "nm" 
)
inherited

Definition at line 57 of file IParametricComponent.cpp.

59 {
60  registerParameter(XComponentName(base_name), &((*p_vec)[0])).setUnit(units);
61  registerParameter(YComponentName(base_name), &((*p_vec)[1])).setUnit(units);
62  registerParameter(ZComponentName(base_name), &((*p_vec)[2])).setUnit(units);
63 }
static std::string XComponentName(const std::string &base_name)
static std::string ZComponentName(const std::string &base_name)
static std::string YComponentName(const std::string &base_name)
MVVM_MODEL_EXPORT std::string base_name(const std::string &path)
Provide the filename of a file path.
Definition: fileutils.cpp:78

References ModelView::Utils::base_name(), IParametricComponent::registerParameter(), RealParameter::setUnit(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by Beam::Beam(), DetectionProperties::DetectionProperties(), InterferenceFunctionTwin::InterferenceFunctionTwin(), MultiLayer::MultiLayer(), Lattice3D::initialize(), and IParticle::registerPosition().

Here is the call graph for this function:

◆ removeParameter()

void IParametricComponent::removeParameter ( const std::string &  name)
inherited

Definition at line 91 of file IParametricComponent.cpp.

92 {
93  m_pool->removeParameter(name);
94 }

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::removeVector(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ removeVector()

void IParametricComponent::removeVector ( const std::string &  base_name)
inherited

Definition at line 96 of file IParametricComponent.cpp.

References ModelView::Utils::base_name(), IParametricComponent::removeParameter(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by IParticle::registerPosition().

Here is the call graph for this function:

◆ setDampingLength()

void InterferenceFunction2DParaCrystal::setDampingLength ( double  damping_length)

Sets the damping length.

Parameters
damping_lengththe damping (coherence) length of the paracrystal in nanometers

Definition at line 65 of file InterferenceFunction2DParaCrystal.cpp.

66 {
67  m_damping_length = damping_length;
68 }

References m_damping_length.

◆ setDomainSizes()

void InterferenceFunction2DParaCrystal::setDomainSizes ( double  size_1,
double  size_2 
)

Sets the sizes of coherence domains.

Parameters
size_1coherence domain size along the first basis vector in nanometers
size_2coherence domain size along the second basis vector in nanometers

Definition at line 96 of file InterferenceFunction2DParaCrystal.cpp.

97 {
98  m_domain_sizes[0] = size_1;
99  m_domain_sizes[1] = size_2;
100 }

References m_domain_sizes.

Referenced by InterferenceFunction2DParaCrystal(), and RectParaCrystalBuilder::buildSample().

◆ setIntegrationOverXi()

void InterferenceFunction2DParaCrystal::setIntegrationOverXi ( bool  integrate_xi)

Enables/disables averaging over the lattice rotation angle.

Parameters
integrate_xiintegration flag

Definition at line 185 of file InterferenceFunction2DParaCrystal.cpp.

186 {
187  m_integrate_xi = integrate_xi;
188  m_lattice->setRotationEnabled(!m_integrate_xi); // deregister Xi in the case of integration
189 }

References m_integrate_xi, and m_lattice.

Referenced by HexParaCrystalBuilder::buildSample(), and RectParaCrystalBuilder::buildSample().

◆ setName()

void IParametricComponent::setName ( const std::string &  name)
inlineinherited

Definition at line 69 of file IParametricComponent.h.

69 { m_name = name; }

References IParametricComponent::m_name, and RealSpace::Particles::name().

Referenced by BasicLattice2D::BasicLattice2D(), Beam::Beam(), ConvolutionDetectorResolution::ConvolutionDetectorResolution(), Crystal::Crystal(), DetectionProperties::DetectionProperties(), DistributionHandler::DistributionHandler(), FormFactorCoreShell::FormFactorCoreShell(), FormFactorCrystal::FormFactorCrystal(), FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(), FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(), FormFactorDecoratorRotation::FormFactorDecoratorRotation(), FormFactorWeighted::FormFactorWeighted(), HexagonalLattice2D::HexagonalLattice2D(), IDetector::IDetector(), INode::INode(), Instrument::Instrument(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunction3DLattice::InterferenceFunction3DLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), InterferenceFunctionFinite3DLattice::InterferenceFunctionFinite3DLattice(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionNone::InterferenceFunctionNone(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), ISampleBuilder::ISampleBuilder(), IsGISAXSDetector::IsGISAXSDetector(), Lattice3D::Lattice3D(), Layer::Layer(), LayerInterface::LayerInterface(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleCoreShell::ParticleCoreShell(), ParticleDistribution::ParticleDistribution(), ParticleLayout::ParticleLayout(), RectangularDetector::RectangularDetector(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SampleBuilderNode::SampleBuilderNode(), SphericalDetector::SphericalDetector(), SquareLattice2D::SquareLattice2D(), Layer::clone(), LayersWithAbsorptionBuilder::createSampleByIndex(), Basic2DParaCrystalBuilder::createSampleByIndex(), ParticleInVacuumBuilder::createSampleByIndex(), SimpleMagneticRotationBuilder::createSampleByIndex(), DepthProbeSimulation::initialize(), GISASSimulation::initialize(), OffSpecularSimulation::initialize(), SpecularSimulation::initialize(), SpecularDetector1D::initialize(), MesoCrystal::initialize(), Particle::initialize(), ParticleComposition::initialize(), Beam::operator=(), SampleBuilderNode::operator=(), SampleBuilderNode::reset(), and SampleBuilderNode::setSBN().

Here is the call graph for this function:

◆ setParameterValue()

void IParametricComponent::setParameterValue ( const std::string &  name,
double  value 
)
inherited

Definition at line 65 of file IParametricComponent.cpp.

66 {
67  if (name.find('*') == std::string::npos && name.find('/') == std::string::npos) {
68  m_pool->setParameterValue(name, value);
69  } else {
70  std::unique_ptr<ParameterPool> P_pool{createParameterTree()};
71  if (name.find('*') != std::string::npos)
72  P_pool->setMatchedParametersValue(name, value);
73  else
74  P_pool->setParameterValue(name, value);
75  }
76 }
int setMatchedParametersValue(const std::string &wildcards, double value)
Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.

References IParametricComponent::createParameterTree(), IParametricComponent::m_pool, RealSpace::Particles::name(), and ParameterPool::setMatchedParametersValue().

Referenced by AsymRippleBuilder::buildSample(), and IParametricComponent::setVectorValue().

Here is the call graph for this function:

◆ setParent()

void INode::setParent ( const INode newParent)
virtualinherited

Reimplemented in SampleProvider.

Definition at line 79 of file INode.cpp.

80 {
81  m_parent = newParent;
82 }

References INode::m_parent.

Referenced by INode::registerChild(), SampleProvider::setBuilder(), and SampleProvider::setParent().

◆ setPositionVariance()

void IInterferenceFunction::setPositionVariance ( double  var)
inherited

Sets the variance of the position for the calculation of the DW factor It is defined as the variance in each relevant dimension.

Definition at line 40 of file IInterferenceFunction.cpp.

41 {
42  if (var < 0.0)
43  throw std::runtime_error("IInterferenceFunction::setPositionVariance: "
44  "variance should be positive.");
45  m_position_var = var;
46 }

References IInterferenceFunction::m_position_var.

Referenced by FiniteSquareLattice2DBuilder::buildSample(), SuperLatticeBuilder::buildSample(), and InterferenceFunctionItem::setPositionVariance().

◆ setProbabilityDistributions()

void InterferenceFunction2DParaCrystal::setProbabilityDistributions ( const IFTDistribution2D pdf_1,
const IFTDistribution2D pdf_2 
)

Sets the probability distributions (Fourier transformed) for the two lattice directions.

Parameters
pdf_1probability distribution in first lattice direction
pdf_2probability distribution in second lattice direction

Definition at line 53 of file InterferenceFunction2DParaCrystal.cpp.

55 {
56  m_pdf1.reset(pdf_1.clone());
57  registerChild(m_pdf1.get());
58  m_pdf2.reset(pdf_2.clone());
59  registerChild(m_pdf2.get());
60 }
IFTDistribution2D * clone() const =0

References IFTDistribution2D::clone(), m_pdf1, m_pdf2, and INode::registerChild().

Referenced by Basic2DParaCrystalBuilder::buildSample(), HexParaCrystalBuilder::buildSample(), and RectParaCrystalBuilder::buildSample().

Here is the call graph for this function:

◆ setVectorValue()

void IParametricComponent::setVectorValue ( const std::string &  base_name,
kvector_t  value 
)
inherited

Definition at line 78 of file IParametricComponent.cpp.

79 {
83 }
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:67
void setParameterValue(const std::string &name, double value)

References ModelView::Utils::base_name(), IParametricComponent::setParameterValue(), BasicVector3D< T >::x(), IParametricComponent::XComponentName(), BasicVector3D< T >::y(), IParametricComponent::YComponentName(), BasicVector3D< T >::z(), and IParametricComponent::ZComponentName().

Here is the call graph for this function:

◆ supportsMultilayer()

virtual bool IInterferenceFunction::supportsMultilayer ( ) const
inlinevirtualinherited

Indicates if this interference function can be used with a multilayer (DWBA mode)

Reimplemented in InterferenceFunctionFinite3DLattice, and InterferenceFunction3DLattice.

Definition at line 46 of file IInterferenceFunction.h.

46 { return true; }

Referenced by IInterferenceFunction::DWfactor().

◆ transferToCPP()

virtual void ICloneable::transferToCPP ( )
inlinevirtualinherited

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

Definition at line 34 of file ICloneable.h.

◆ transformToPrincipalAxes()

void InterferenceFunction2DParaCrystal::transformToPrincipalAxes ( double  qx,
double  qy,
double  gamma,
double  delta,
double &  q_pa_1,
double &  q_pa_2 
) const
private

Definition at line 102 of file InterferenceFunction2DParaCrystal.cpp.

105 {
106  q_pa_1 = qx * std::cos(gamma) + qy * std::sin(gamma);
107  q_pa_2 = qx * std::cos(gamma + delta) + qy * std::sin(gamma + delta);
108 }

Referenced by FTPDF().

◆ treeToString()

std::string INode::treeToString ( ) const
virtualinherited

Returns multiline string representing tree structure below the node.

Definition at line 52 of file INode.cpp.

53 {
54  return NodeUtils::nodeToString(this);
55 }
std::string nodeToString(const INode *node)
Returns multiline string representing tree structure starting from given node.
Definition: NodeUtils.cpp:81

References NodeUtils::nodeToString().

Here is the call graph for this function:

◆ XComponentName()

std::string IParametricComponent::XComponentName ( const std::string &  base_name)
staticinherited

Definition at line 103 of file IParametricComponent.cpp.

104 {
105  return base_name + "X";
106 }

References ModelView::Utils::base_name().

Referenced by Lattice3D::initialize(), IParticle::registerPosition(), IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ YComponentName()

std::string IParametricComponent::YComponentName ( const std::string &  base_name)
staticinherited

Definition at line 108 of file IParametricComponent.cpp.

109 {
110  return base_name + "Y";
111 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ ZComponentName()

std::string IParametricComponent::ZComponentName ( const std::string &  base_name)
staticinherited

Definition at line 113 of file IParametricComponent.cpp.

114 {
115  return base_name + "Z";
116 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

Member Data Documentation

◆ m_damping_length

double InterferenceFunction2DParaCrystal::m_damping_length
private

Damping length for removing delta function singularity at q=0.

Definition at line 74 of file InterferenceFunction2DParaCrystal.h.

Referenced by InterferenceFunction2DParaCrystal(), clone(), dampingLength(), FTPDF(), and setDampingLength().

◆ m_domain_sizes

double InterferenceFunction2DParaCrystal::m_domain_sizes[2]
private

Coherence domain sizes.

Definition at line 75 of file InterferenceFunction2DParaCrystal.h.

Referenced by InterferenceFunction2DParaCrystal(), clone(), domainSizes(), interference1D(), and setDomainSizes().

◆ m_integrate_xi

bool InterferenceFunction2DParaCrystal::m_integrate_xi
private

Integrate over the orientation xi.

Definition at line 71 of file InterferenceFunction2DParaCrystal.h.

Referenced by clone(), iff_without_dw(), integrationOverXi(), and setIntegrationOverXi().

◆ m_lattice

std::unique_ptr<Lattice2D> InterferenceFunction2DParaCrystal::m_lattice
private

◆ m_name

std::string IParametricComponent::m_name
privateinherited

◆ m_NP

const size_t INode::m_NP
protectedinherited

Definition at line 88 of file INode.h.

Referenced by INode::INode().

◆ m_P

std::vector<double> INode::m_P
protectedinherited

Definition at line 89 of file INode.h.

Referenced by INode::INode(), and IFootprintFactor::setWidthRatio().

◆ m_parent

const INode* INode::m_parent {nullptr}
privateinherited

Definition at line 83 of file INode.h.

Referenced by INode::displayName(), INode::parent(), and INode::setParent().

◆ m_pdf1

std::unique_ptr<IFTDistribution2D> InterferenceFunction2DParaCrystal::m_pdf1
private

◆ m_pdf2

std::unique_ptr<IFTDistribution2D> InterferenceFunction2DParaCrystal::m_pdf2
private

◆ m_pool

◆ m_position_var

◆ m_qx

double InterferenceFunction2DParaCrystal::m_qx
mutableprivate

Definition at line 76 of file InterferenceFunction2DParaCrystal.h.

Referenced by iff_without_dw(), and interferenceForXi().

◆ m_qy

double InterferenceFunction2DParaCrystal::m_qy
mutableprivate

Definition at line 77 of file InterferenceFunction2DParaCrystal.h.

Referenced by iff_without_dw(), and interferenceForXi().


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