BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RefractiveMaterialImpl.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Material/RefractiveMaterialImpl.cpp
6 //! @brief Implements class RefractiveMaterialImpl.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
17 
18 RefractiveMaterialImpl::RefractiveMaterialImpl(const std::string& name, double delta, double beta,
19  kvector_t magnetization)
20  : MagneticMaterialImpl(name, magnetization)
21  , m_delta(delta)
22  , m_beta(beta < 0. ? throw std::runtime_error(
23  "The imaginary part of the refractive index must be greater or equal zero")
24  : beta)
25 {
26 }
27 
29 {
30  return new RefractiveMaterialImpl(*this);
31 }
32 
34 {
35  return complex_t(1.0 - m_delta, m_beta);
36 }
37 
39 {
40  complex_t result(1.0 - m_delta, m_beta);
41  return result * result;
42 }
43 
45 {
46  return complex_t(m_delta, m_beta);
47 }
48 
50 {
51  double wavelength = wavevectors.wavelength();
52  return M_PI / wavelength / wavelength * refractiveIndex2(wavelength);
53 }
54 
55 void RefractiveMaterialImpl::print(std::ostream& ostr) const
56 {
57  ostr << "RefractiveMaterial:" << getName() << "<" << this << ">{ "
58  << "delta=" << m_delta << ", beta=" << m_beta << ", B=" << magnetization() << "}";
59 }
std::complex< double > complex_t
Definition: Complex.h:20
#define M_PI
Definition: Constants.h:44
Defines class RefractiveMaterialImpl.
Defines WavevectorInfo.
const std::string & getName() const
Returns name of the material.
Basic implementation for magnetized material.
kvector_t magnetization() const final
Returns the magnetization (in A/m)
Material implementation based on refractive coefficiencts (valid for one wavelength value only)
const double m_delta
coefficient for refractive index
complex_t refractiveIndex2(double wavelength) const override
Returns squared refractive index.
complex_t materialData() const override
Returns underlying material data.
complex_t refractiveIndex(double wavelength) const override
Returns refractive index For this particular implementation returned value does not depend on passed ...
void print(std::ostream &ostr) const override
Prints object data.
RefractiveMaterialImpl * clone() const override
Returns pointer to a copy of material.
RefractiveMaterialImpl(const std::string &name, double delta, double beta, kvector_t magnetization)
const double m_beta
coefficient for refractive index
complex_t scalarSubtrSLD(const WavevectorInfo &wavevectors) const override
Returns ( - sld), sld (in ) being the scattering length density.
Holds all wavevector information relevant for calculating form factors.
double wavelength() const
QString const & name(EShape k)
Definition: particles.cpp:21
Definition: filesystem.h:81