@@ -292,14 +292,28 @@ class Radiation: public RefinableObj
292
292
* This class only computes structure factor, but no intensity. i.e. it does
293
293
* not include any correction such as absorption, Lorentz or Polarization.
294
294
*
295
- * Does this really need to be a RefinableObj ?
296
295
* \todo Optimize computation for Bijvoet/Friedel mates. To do this, generate
297
296
* an internal list of 'true independent reflections', with two entries for each,
298
297
* for both mates, and make the 'real' reflections only a reference to these reflections.
299
298
*
300
299
* \todo a \b lot of cleaning is necessary in the computing of structure
301
300
* factors, for (1) the 'preparation' part (deciding what needs to be recomputed)
302
301
* and (2) to allow anisotropic temperature factors (or other anisotropic parts)
302
+ *
303
+ * \note
304
+ * all H,K,L related parameters are mutable so that a PowderPatternDiffraction
305
+ * list of reflections can be updated whenever the spacegroup or
306
+ * lattice parameters are changed, and this needs to automatically happen
307
+ * even when calling const-functions like PowderPatternDiffraction::CalcPowderPattern().
308
+ *
309
+ * \par
310
+ * Nevertheless this 'const' modification of HKL's are meant to be purely internal,
311
+ * so the const functions are all protected, and the non-const ones (such as
312
+ * SetHKL or GenHKLFullSpace) are public.
313
+ *
314
+ * \par
315
+ * Single crystal classes should not make use of the new const functions since
316
+ * changing the list of HKL's is effectively mutating the object.
303
317
*/
304
318
// ######################################################################
305
319
class ScatteringData : virtual public RefinableObj
@@ -463,13 +477,58 @@ class ScatteringData: virtual public RefinableObj
463
477
// / Clock the last time the number of reflections used was changed
464
478
const RefinableObjClock& GetClockNbReflBelowMaxSinThetaOvLambda ()const ;
465
479
protected:
480
+ /* * \brief \internal input H,K,L
481
+ *
482
+ * \param h,k,l: REAL arrays (vectors with NbRefl elements -same size),
483
+ *with the h, k and l coordinates of all reflections.
484
+ */
485
+ virtual void SetHKL ( const CrystVector_REAL &h,
486
+ const CrystVector_REAL &k,
487
+ const CrystVector_REAL &l) const ;
488
+ /* * \brief Generate a list of h,k,l to describe a full reciprocal space,
489
+ * up to a given maximum theta value
490
+ *
491
+ * \param maxTheta:maximum theta value
492
+ * \param unique: if set to true, only unique reflections will be listed.
493
+ * Bijvoet (Friedel) pairs
494
+ * are NOT merged, for 'anomalous' reasons, unless you have chosen to ignore the
495
+ * imaginary part of the scattering factor.
496
+ *
497
+ * The multiplicity is always stored in ScatteringData::mMultiplicity.
498
+ *
499
+ * \warning The ScatteringData object must already have been assigned
500
+ * a crystal object using SetCrystal(), and the experimental wavelength
501
+ * must also have been set before calling this function.
502
+ */
503
+ virtual void GenHKLFullSpace2 (const REAL maxsithsl,
504
+ const bool unique=false ) const ;
505
+ /* * \brief \internal Generate a list of h,k,l to describe a full reciprocal space,
506
+ * up to a given maximum theta value
507
+ *
508
+ * \param maxsithsl:maximum sin(theta)/lambda=1/2d value
509
+ * \param unique: if set to true, only unique reflections will be listed.
510
+ * Bijvoet (Friedel) pairs
511
+ * are NOT merged, for 'anomalous' reasons, unless you have chosen to ignore the
512
+ * imaginary part of the scattering factor.
513
+ *
514
+ * The multiplicity is always stored in ScatteringData::mMultiplicity.
515
+ *
516
+ * \warning The ScatteringData object must already have been assigned
517
+ * a crystal object using SetCrystal(), and the experimental wavelength
518
+ * must also have been set before calling this function.
519
+ *
520
+ * \deprecated Rather use PowderPattern::GenHKLFullSpace2,
521
+ * with a maximum sin(theta)/lambda value, which also works for dispersive experiments.
522
+ */
523
+ virtual void GenHKLFullSpace (const REAL maxTheta,
524
+ const bool unique=false ) const ;
466
525
// / \internal This function is called after H,K and L arrays have
467
526
// / been initialized or modified.
468
- virtual void PrepareHKLarrays () ;
527
+ virtual void PrepareHKLarrays () const ;
469
528
// / \internal sort reflections by theta values (also get rid of [0,0,0] if present)
470
529
// / If maxSTOL >0, then only reflections where sin(theta)/lambda<maxSTOL are kept
471
530
// / \return an array with the subscript of the kept reflections (for inherited classes)
472
- virtual CrystVector_long SortReflectionBySinThetaOverLambda (const REAL maxSTOL=-1 .);
531
+ virtual CrystVector_long SortReflectionBySinThetaOverLambda (const REAL maxSTOL=-1 .) const ;
473
532
// / \internal Get rid of extinct reflections. Useful after GenHKLFullSpace().
474
533
// / Do not use this if you have a list of observed reflections !
475
534
// /
@@ -532,9 +591,9 @@ class ScatteringData: virtual public RefinableObj
532
591
void CalcStructFactVariance ()const ;
533
592
534
593
// / Number of H,K,L reflections
535
- long mNbRefl ;
594
+ mutable long mNbRefl ;
536
595
// / H,K,L coordinates
537
- CrystVector_REAL mH , mK , mL ;
596
+ mutable CrystVector_REAL mH , mK , mL ;
538
597
// / H,K,L integer coordinates
539
598
mutable CrystVector_long mIntH , mIntK , mIntL ;
540
599
// / H,K,L coordinates, multiplied by 2PI
@@ -543,13 +602,13 @@ class ScatteringData: virtual public RefinableObj
543
602
mutable CrystVector_REAL mX , mY , mZ ;
544
603
545
604
// /Multiplicity for each reflections (mostly for powder diffraction)
546
- CrystVector_int mMultiplicity ;
605
+ mutable CrystVector_int mMultiplicity ;
547
606
548
607
/* * Expected intensity factor for all reflections.
549
608
*
550
609
* See SpaceGroup::GetExpectedIntensityFactor()
551
610
*/
552
- CrystVector_int mExpectedIntensityFactor ;
611
+ mutable CrystVector_int mExpectedIntensityFactor ;
553
612
554
613
// / real &imaginary parts of F(HKL)calc
555
614
mutable CrystVector_REAL mFhklCalcReal , mFhklCalcImag ;
@@ -609,7 +668,7 @@ class ScatteringData: virtual public RefinableObj
609
668
610
669
// Public Clocks
611
670
// / Clock for the list of hkl
612
- RefinableObjClock mClockHKL ;
671
+ mutable RefinableObjClock mClockHKL ;
613
672
// / Clock for the structure factor
614
673
mutable RefinableObjClock mClockStructFactor ;
615
674
// / Clock for the square modulus of the structure factor
@@ -676,9 +735,9 @@ class ScatteringData: virtual public RefinableObj
676
735
mutable RefinableObjClock mClockLuzzatiFactor ;
677
736
mutable RefinableObjClock mClockFhklCalcVariance ;
678
737
// / Observed squared structure factors (zero-sized if none)
679
- CrystVector_REAL mFhklObsSq ;
738
+ mutable CrystVector_REAL mFhklObsSq ;
680
739
// / Last time observed squared structure factors were altered
681
- RefinableObjClock mClockFhklObsSq ;
740
+ mutable RefinableObjClock mClockFhklObsSq ;
682
741
#ifdef __WX__CRYST__
683
742
// to access mMaxSinThetaOvLambda
684
743
friend class WXDiffractionSingleCrystal ;
0 commit comments