@@ -130,14 +130,27 @@ QuantityType PDFCalculator::getF() const
130
130
131
131
QuantityType PDFCalculator::getExtendedPDF () const
132
132
{
133
- // we need a full range PDF to apply termination ripples correctly
134
133
QuantityType rgrid_ext = this ->getExtendedRgrid ();
134
+ // Skip FFT when qmax is not specified and qmin does not exclude the
135
+ // the F(Q=Qstep) point (excluding F(0) == 0 makes no difference to G).
136
+ const bool skipfft =
137
+ !eps_lt (this ->getQmax (), M_PI / this ->getRstep ()) &&
138
+ !(1 < pdfutils_qminSteps (this ));
139
+ if (skipfft)
140
+ {
141
+ QuantityType rdfpr = this ->getExtendedRDFperR ();
142
+ QuantityType rdfprb = this ->applyBaseline (rgrid_ext, rdfpr);
143
+ QuantityType pdf = this ->applyEnvelopes (rgrid_ext, rdfprb);
144
+ return pdf;
145
+ }
146
+ // FFT required here
147
+ // we need a full range PDF to apply termination ripples correctly
135
148
QuantityType f_ext = this ->getExtendedF ();
136
- QuantityType pdf0 = fftftog (f_ext, this ->getQstep ());
149
+ QuantityType pdf1 = fftftog (f_ext, this ->getQstep ());
137
150
// cut away the FFT padded points
138
- assert (this ->extendedRmaxSteps () <= int (pdf0 .size ()));
139
- QuantityType pdf1 (pdf0 .begin () + this ->extendedRminSteps (),
140
- pdf0 .begin () + this ->extendedRmaxSteps ());
151
+ assert (this ->extendedRmaxSteps () <= int (pdf1 .size ()));
152
+ pdf1. erase (pdf1 .begin () + this ->extendedRmaxSteps (), pdf1. end ());
153
+ pdf1. erase (pdf1. begin (), pdf1 .begin () + this ->extendedRminSteps ());
141
154
QuantityType pdf2 = this ->applyEnvelopes (rgrid_ext, pdf1);
142
155
return pdf2;
143
156
}
0 commit comments