Skip to content
Snippets Groups Projects
Commit b0620734 authored by Ganeva, Marina's avatar Ganeva, Marina
Browse files

Corrected expressions for the 1DLattice.

parent 95326a6b
No related branches found
No related tags found
No related merge requests found
......@@ -212,7 +212,7 @@ ISample *TestInfLongBox::TestSampleBuilder::buildSample() const
lattice_params.m_length=m_lattice_length;
lattice_params.m_xi = m_xi;
InterferenceFunction1DLattice *p_interference_function = new InterferenceFunction1DLattice(lattice_params);
FTDistribution1DCauchy pdf(3000.0*Units::nanometer);
FTDistribution1DCauchy pdf(10e6*Units::nanometer);
p_interference_function->setProbabilityDistribution(pdf);
//IInterferenceFunction *p_interference_function = new InterferenceFunctionNone();
......
......@@ -62,7 +62,7 @@ FTDistribution1DGauss* FTDistribution1DGauss::clone() const
double FTDistribution1DGauss::evaluate(double q) const
{
double sum_sq = q*q*m_omega*m_omega;
return std::exp(-sum_sq/4.0)/2.0;
return std::exp(-sum_sq/4.0);
}
FTDistribution1DVoigt::FTDistribution1DVoigt(double omega, double eta)
......
......@@ -65,6 +65,8 @@ complex_t FormFactorInfLongBox::evaluate_for_q(const cvector_t& q) const
}
double FormFactorInfLongBox::getVolume() const {
return 2*M_PI*m_height*m_width;
// return 2*M_PI*m_height*m_width;
// volume of the infinite object is infinite
throw NotImplementedException(
"FormFactorInfLongBox::getVolume() -> Error: not implemented exception. Volume of the infinite object is infinite.");
}
......@@ -49,7 +49,7 @@ private:
//! Registers some class members for later access via parameter pool
virtual void init_parameters();
double m_asx; //!< x coordinates of a*
// double m_asx; //!< x coordinates of a*
double m_prefactor; //!< fixed prefactor for normalization
int m_na; //!< determines the number of reciprocal lattice points to use
};
......
......@@ -49,7 +49,7 @@ void InterferenceFunction1DLattice::setProbabilityDistribution(
// initialize_calc_factors(omega):
m_prefactor = 2.0*M_PI*omega;
double qa_max = (m_lattice_params.m_length/(2*M_PI))*nmax/omega;
m_na = (int) std::abs(qa_max) + 0.5;
m_na = (int) (std::abs(qa_max) + 0.5);
}
double InterferenceFunction1DLattice::evaluate(const cvector_t& q) const
......@@ -64,18 +64,19 @@ double InterferenceFunction1DLattice::evaluate(const cvector_t& q) const
double qx_frac;
double xi = m_lattice_params.m_xi;
double a = m_lattice_params.m_length;
double a_rec = 2*M_PI/a;
// rotate the q vector to xi angle
// so that qx_prime is along the a axis of lattice
double qx_prime = qxr*std::cos(xi) + qyr*std::sin(xi);
// calculate reciprocal vector fraction
int qa_int = (int) a*qx_prime/(2*M_PI);
qx_frac = qx_prime - qa_int*m_asx;
int qa_int = (int) qx_prime/a_rec;
qx_frac = qx_prime - qa_int*a_rec;
for (int i=-m_na-1; i<m_na+2; ++i)
{
double qx = qx_frac + i*m_asx;
double qx = qx_frac + i*a_rec;
result += mp_pdf->evaluate(qx);
}
return m_prefactor*result;
......
......@@ -46,7 +46,7 @@ TEST_F(FTDistributionsTest, FTDistribution1DGaussConstructor)
IFTDistribution1D * iftd1D = new FTDistribution1DGauss(1.0);
EXPECT_EQ(1.0, iftd1D->getOmega());
EXPECT_EQ("1DDistributionGauss", iftd1D->getName());
EXPECT_NEAR(0.4950249, iftd1D->evaluate(0.2),0.000001);
EXPECT_NEAR(2*0.4950249, iftd1D->evaluate(0.2),0.000001);
iftd1D->setOmega(3.0);
EXPECT_EQ(3.0, iftd1D->getOmega());
......@@ -61,7 +61,7 @@ TEST_F(FTDistributionsTest, FTDistribution1DGaussClone)
EXPECT_EQ(-5.0, iftd1DClone->getOmega());
EXPECT_EQ("1DDistributionGauss", iftd1DClone->getName());
EXPECT_NEAR(0.389400, iftd1DClone->evaluate(0.2),0.000001);
EXPECT_NEAR(2*0.389400, iftd1DClone->evaluate(0.2),0.000001);
delete iftd1D;
delete iftd1DClone;
......
......@@ -561,14 +561,14 @@ TEST_F(FormFactorTest, InfLongBox)
EXPECT_DOUBLE_EQ(100./M_PI, ilbox.getWidth());
EXPECT_EQ(15., ilbox.getHeight());
EXPECT_DOUBLE_EQ(50./M_PI, ilbox.getRadius());
EXPECT_DOUBLE_EQ(volume, ilbox.getVolume());
EXPECT_THROW(ilbox.getVolume(), NotImplementedException);
EXPECT_EQ(2, ilbox.getNumberOfStochasticParameters());
FormFactorInfLongBox *ilboxclone = ilbox.clone();
EXPECT_EQ("FormFactorInfLongBox",ilboxclone->getName());
EXPECT_DOUBLE_EQ(100./M_PI, ilboxclone->getWidth());
EXPECT_EQ(15., ilboxclone->getHeight());
EXPECT_DOUBLE_EQ(volume, ilboxclone->getVolume());
EXPECT_THROW(ilboxclone->getVolume(),NotImplementedException);
EXPECT_EQ(2, ilboxclone->getNumberOfStochasticParameters());
EXPECT_DOUBLE_EQ(50./M_PI, ilboxclone->getRadius());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment