diff --git a/.travis.yml b/.travis.yml index df6940fc..c7af470c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -147,3 +147,7 @@ after_success: - cd $TRAVIS_BUILD_DIR - pip install $MYPIPFLAGS codecov - codecov + - +deploy: + - provider: releases + - draft: true diff --git a/src/diffpy/srreal/JeongPeakWidth.cpp b/src/diffpy/srreal/JeongPeakWidth.cpp index 23d342ba..7cd9679e 100644 --- a/src/diffpy/srreal/JeongPeakWidth.cpp +++ b/src/diffpy/srreal/JeongPeakWidth.cpp @@ -30,7 +30,7 @@ using namespace std; // Constructors -------------------------------------------------------------- JeongPeakWidth::JeongPeakWidth() : - mdelta1(0.0), mdelta2(0.0), mqbroad(0.0) + mdelta1(0.0), mdelta2(0.0), mqbroad(0.0), mqbroad_seperable(0.0) { this->registerDoubleAttribute("delta1", this, &JeongPeakWidth::getDelta1, &JeongPeakWidth::setDelta1); @@ -38,6 +38,8 @@ JeongPeakWidth::JeongPeakWidth() : this, &JeongPeakWidth::getDelta2, &JeongPeakWidth::setDelta2); this->registerDoubleAttribute("qbroad", this, &JeongPeakWidth::getQbroad, &JeongPeakWidth::setQbroad); + this->registerDoubleAttribute("qbroad_seperable", + this, &JeongPeakWidth::getQbroad_seperable, &JeongPeakWidth::setQbroad_seperable); } @@ -69,7 +71,8 @@ double JeongPeakWidth::calculate(const BaseBondGenerator& bnds) const double corr = this->msdSharpeningRatio(r); // avoid calculating square root of negative value double fwhm = (corr <= 0) ? 0.0 : - (sqrt(corr) * this->DebyeWallerPeakWidth::calculate(bnds)); + (sqrt(corr) * this->DebyeWallerPeakWidth::calculate(bnds) + + pow(this->getQbroad_seperable()*r, 2)); return fwhm; } @@ -82,7 +85,7 @@ double JeongPeakWidth::maxWidth(StructureAdapterPtr stru, this->msdSharpeningRatio(rmin), this->msdSharpeningRatio(rmax)); // if the sharpening factor is larger than 1 adjust the maximum width - double rv = maxwidth0 * sqrt(max(1.0, maxmsdsharp)); + double rv = maxwidth0 * sqrt(max(1.0, maxmsdsharp))+ pow(this->getQbroad_seperable()*rmax, 2); return rv; } @@ -118,6 +121,19 @@ const double& JeongPeakWidth::getQbroad() const } +const double& JeongPeakWidth::getQbroad_seperable() const +{ + return mqbroad_seperable; +} + + +void JeongPeakWidth::setQbroad_seperable(double qbroad_seperable) +{ + if (mqbroad_seperable != qbroad_seperable) mticker.click(); + mqbroad_seperable = qbroad_seperable; +} + + void JeongPeakWidth::setQbroad(double qbroad) { if (mqbroad != qbroad) mticker.click(); diff --git a/src/diffpy/srreal/JeongPeakWidth.hpp b/src/diffpy/srreal/JeongPeakWidth.hpp index 96ccd44d..1acd9a19 100644 --- a/src/diffpy/srreal/JeongPeakWidth.hpp +++ b/src/diffpy/srreal/JeongPeakWidth.hpp @@ -49,6 +49,8 @@ class JeongPeakWidth : public DebyeWallerPeakWidth void setDelta2(double); const double& getQbroad() const; void setQbroad(double); + const double& getQbroad_seperable() const; + void setQbroad_seperable(double); private: @@ -56,6 +58,7 @@ class JeongPeakWidth : public DebyeWallerPeakWidth double mdelta1; double mdelta2; double mqbroad; + double mqbroad_seperable; // methods double msdSharpeningRatio(const double& r) const; @@ -71,6 +74,7 @@ class JeongPeakWidth : public DebyeWallerPeakWidth ar & mdelta1; ar & mdelta2; ar & mqbroad; + ar & mqbroad_seperable; } }; diff --git a/src/tests/TestPDFCalculator.hpp b/src/tests/TestPDFCalculator.hpp index 249aa72b..ff70c7ad 100644 --- a/src/tests/TestPDFCalculator.hpp +++ b/src/tests/TestPDFCalculator.hpp @@ -55,15 +55,18 @@ class TestPDFCalculator : public CxxTest::TestSuite TS_ASSERT_EQUALS(0.0, jpw0->getDoubleAttr("delta1")); TS_ASSERT_EQUALS(0.0, jpw0->getDoubleAttr("delta2")); TS_ASSERT_EQUALS(0.0, jpw0->getDoubleAttr("qbroad")); + TS_ASSERT_EQUALS(0.0, jpw0->getDoubleAttr("qbroad_seperable")); JeongPeakWidth jpw; jpw.setDelta1(1.0); jpw.setDelta2(2.0); jpw.setQbroad(3.0); + jpw.setQbroad_seperable(4.0); mpdfc->setPeakWidthModel(jpw.clone()); const PeakWidthModelPtr& jpw1 = mpdfc->getPeakWidthModel(); TS_ASSERT_EQUALS(1.0, jpw1->getDoubleAttr("delta1")); TS_ASSERT_EQUALS(2.0, jpw1->getDoubleAttr("delta2")); TS_ASSERT_EQUALS(3.0, jpw1->getDoubleAttr("qbroad")); + TS_ASSERT_EQUALS(4.0, jpw1->getDoubleAttr("qbroad_seperable")); } diff --git a/src/tests/TestPeakWidthModel.hpp b/src/tests/TestPeakWidthModel.hpp index 8df43d37..d42e0200 100644 --- a/src/tests/TestPeakWidthModel.hpp +++ b/src/tests/TestPeakWidthModel.hpp @@ -84,13 +84,15 @@ class TestPeakWidthModel : public CxxTest::TestSuite void test_attributes() { TS_ASSERT_EQUALS(0, mdwpw->namesOfDoubleAttributes().size()); - TS_ASSERT_EQUALS(3, mjepw->namesOfDoubleAttributes().size()); + TS_ASSERT_EQUALS(4, mjepw->namesOfDoubleAttributes().size()); mcjepw->setDelta1(0.1); mcjepw->setDelta2(0.2); mcjepw->setQbroad(0.3); + mcjepw->setQbroad_seperable(0.4); TS_ASSERT_EQUALS(0.1, mjepw->getDoubleAttr("delta1")); TS_ASSERT_EQUALS(0.2, mjepw->getDoubleAttr("delta2")); TS_ASSERT_EQUALS(0.3, mjepw->getDoubleAttr("qbroad")); + TS_ASSERT_EQUALS(0.4, mjepw->getDoubleAttr("qbroad_seperable")); } @@ -108,6 +110,7 @@ class TestPeakWidthModel : public CxxTest::TestSuite TS_ASSERT_DELTA(0.5 * w, mjepw->calculate(*bnds), meps); mcjepw->setDelta2(0); mcjepw->setQbroad(sqrt(3)); + mcjepw->setQbroad_seperable(0); TS_ASSERT_DELTA(2 * w, mjepw->calculate(*bnds), meps); } @@ -121,12 +124,14 @@ class TestPeakWidthModel : public CxxTest::TestSuite mcjepw->setDelta1(1.1); mcjepw->setDoubleAttr("delta2", 2.2); mcjepw->setDoubleAttr("qbroad", 0.03); + mcjepw->setDoubleAttr("qbroad_seperable", 0.003); PeakWidthModelPtr pwm2 = dumpandload(mjepw); JeongPeakWidth* cpwm2 = dynamic_cast(pwm2.get()); TS_ASSERT(cpwm2); TS_ASSERT_EQUALS(1.1, pwm2->getDoubleAttr("delta1")); TS_ASSERT_EQUALS(2.2, pwm2->getDoubleAttr("delta2")); TS_ASSERT_EQUALS(0.03, pwm2->getDoubleAttr("qbroad")); + TS_ASSERT_EQUALS(0.003, pwm2->getDoubleAttr("qbroad_seperable")); }