FOX/ObjCryst++  2022
PowderPattern.h
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2002 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #ifndef _OBJCRYST_POWDERPATTERN_H_
20 #define _OBJCRYST_POWDERPATTERN_H_
21 
22 #include <utility>
23 #include <list>
24 #include <string>
25 
26 #include "ObjCryst/CrystVector/CrystVector.h"
27 #include "ObjCryst/ObjCryst/General.h"
28 #include "ObjCryst/ObjCryst/Crystal.h"
29 #include "ObjCryst/ObjCryst/ScatteringCorr.h"
30 #include "ObjCryst/ObjCryst/ReflectionProfile.h"
31 #include "ObjCryst/ObjCryst/CIF.h"
32 #include "ObjCryst/ObjCryst/Indexing.h"
33 #include "ObjCryst/ObjCryst/DiffractionDataSingleCrystal.h"
34 
35 namespace ObjCryst
36 {
37 class PeakList;
38 class PowderPattern;
39 class PowderPatternDiffraction;
40 
41 //######################################################################
50 {
51 public:
56  virtual ~CylinderAbsCorr();
57  virtual const string & GetName() const;
58  virtual const string & GetClassName() const;
59 protected:
60  virtual void CalcCorr() const;
61  const PowderPatternDiffraction *mpPowderPatternDiff;
62 };
63 
64 //######################################################################
71 //######################################################################
72 class PowderPatternComponent : virtual public RefinableObj
73 {
74  public:
77  virtual ~PowderPatternComponent();
78  virtual const string& GetClassName() const;
79 
96  virtual const CrystVector_REAL& GetPowderPatternCalc()const=0;
97  virtual std::map<RefinablePar*,CrystVector_REAL>& GetPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
106  virtual pair<const CrystVector_REAL*,const RefinableObjClock*> GetPowderPatternIntegratedCalc()const=0;
107  virtual std::map<RefinablePar*,CrystVector_REAL>& GetPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
115  bool IsScalable()const;
122  virtual const CrystVector_REAL& GetPowderPatternCalcVariance()const=0;
129  virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
134  virtual bool HasPowderPatternCalcVariance()const=0;
139  const list<pair<const REAL ,const string > >& GetPatternLabelList() const;
140  protected:
143 
147  virtual void CalcPowderPattern() const=0;
148  virtual void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
151  virtual void CalcPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
152 
159  virtual const CrystVector_long& GetBraggLimits()const=0;
162 
165  virtual void SetMaxSinThetaOvLambda(const REAL max)=0;
166 
169  mutable CrystVector_REAL mPowderPatternCalc;
171  mutable CrystVector_REAL mPowderPatternIntegratedCalc;
172 
174  mutable CrystVector_REAL mPowderPatternCalcVariance;
176  mutable CrystVector_REAL mPowderPatternIntegratedCalcVariance;
177 
179  mutable CrystVector_long mIntegratedReflLimits;
180 
185  virtual void Prepare()=0;
186 
189 
190  //Clocks
199 
204 
206  mutable list<pair<const REAL ,const string > > mvLabel;
207 
208  mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPattern_FullDeriv;
209  mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPatternIntegrated_FullDeriv;
210  //Eventually this should be removed (?)
211  friend class PowderPattern;
212 };
215 
216 //######################################################################
221 //######################################################################
223 {
224  public:
227  virtual ~PowderPatternBackground();
228  virtual const string& GetClassName() const;
229 
230  virtual void SetParentPowderPattern(PowderPattern&);
231  virtual const CrystVector_REAL& GetPowderPatternCalc()const;
232  virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
235  void ImportUserBackground(const string &filename);
236  void SetInterpPoints(const CrystVector_REAL tth, const CrystVector_REAL backgd);
237  const std::pair<const CrystVector_REAL*,const CrystVector_REAL*> GetInterpPoints()const;
238  virtual void XMLOutput(ostream &os,int indent=0)const;
239  virtual void XMLInput(istream &is,const XMLCrystTag &tag);
240  //virtual void XMLInputOld(istream &is,const IOCrystTag &tag);
241  virtual void GetGeneGroup(const RefinableObj &obj,
242  CrystVector_uint & groupIndex,
243  unsigned int &firstGroup) const;
244  virtual void BeginOptimization(const bool allowApproximations=false,
245  const bool enableRestraints=false);
246  virtual const CrystVector_REAL& GetPowderPatternCalcVariance()const;
247  virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
249  virtual bool HasPowderPatternCalcVariance()const;
250  virtual void TagNewBestConfig()const;
269  protected:
270  virtual void CalcPowderPattern() const;
271  virtual void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
272  virtual void CalcPowderPatternIntegrated() const;
273  virtual void CalcPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
274  virtual void Prepare();
275  virtual const CrystVector_long& GetBraggLimits()const;
276  virtual void SetMaxSinThetaOvLambda(const REAL max);
277  void InitRefParList();
278  void InitOptions();
279  void InitSpline()const;
283  CrystVector_REAL mBackgroundInterpPointX;
288  mutable CrystVector_long mPointOrder;
291  mutable CrystVector_REAL mvSplinePixel;
296  // Clocks
301 
308 
312 
315  //To be removed
316  friend class PowderPattern;
317  #ifdef __WX__CRYST__
318  public:
319  virtual WXCrystObjBasic* WXCreate(wxWindow*);
320  friend class WXPowderPatternBackground;
321  #endif
322 };
323 
324 //######################################################################
329 //######################################################################
331 {
332  public:
335  virtual ~PowderPatternDiffraction();
336  virtual PowderPatternDiffraction* CreateCopy()const;
337  virtual const string& GetClassName() const;
338 
339  virtual void SetParentPowderPattern(PowderPattern&);
340  virtual const CrystVector_REAL& GetPowderPatternCalc()const;
341  virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
343 
355  const REAL fwhmCagliotiW,
356  const REAL fwhmCagliotiU=0,
357  const REAL fwhmCagliotiV=0,
358  const REAL eta0=0.5,
359  const REAL eta1=0.);
363  void SetProfile(ReflectionProfile *prof);
365  const ReflectionProfile& GetProfile()const;
368  virtual void GenHKLFullSpace()const;
369  virtual void XMLOutput(ostream &os,int indent=0)const;
370  virtual void XMLInput(istream &is,const XMLCrystTag &tag);
371  //virtual void XMLInputOld(istream &is,const IOCrystTag &tag);
372  virtual void GetGeneGroup(const RefinableObj &obj,
373  CrystVector_uint & groupIndex,
374  unsigned int &firstGroup) const;
375  virtual void BeginOptimization(const bool allowApproximations=false,
376  const bool enableRestraints=false);
377  virtual void EndOptimization();
378  virtual void SetApproximationFlag(const bool allow);
379  virtual const Radiation& GetRadiation()const;
380  virtual const CrystVector_REAL& GetPowderPatternCalcVariance()const;
381  virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
383  virtual bool HasPowderPatternCalcVariance()const;
384  virtual void SetCrystal(Crystal &crystal);
393  void SetExtractionMode(const bool extract=true,const bool init=false);
395  bool GetExtractionMode()const;
400  void ExtractLeBail(unsigned int nbcycle=1);
403  virtual long GetNbReflBelowMaxSinThetaOvLambda()const;
405  void SetFrozenLatticePar(const unsigned int i, REAL v);
407  REAL GetFrozenLatticePar(const unsigned int i) const;
411  void FreezeLatticePar(const bool use);
413  bool FreezeLatticePar() const;
422  unsigned int GetProfileFitNetNbObs()const;
424  bool HasFhklObsSq() const;
432  const CrystVector_REAL& GetFhklObsSq() const;
433  protected:
434  virtual void CalcPowderPattern() const;
435  virtual void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
436  virtual void CalcPowderPatternIntegrated() const;
437  virtual void CalcPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
438 
440  void CalcPowderReflProfile()const;
443  void CalcPowderReflProfile_FullDeriv(std::set<RefinablePar *> &vPar);
445  void CalcIntensityCorr()const;
448  virtual void CalcIhkl() const;
449  virtual void CalcIhkl_FullDeriv(std::set<RefinablePar*> &vPar);
450  virtual void Prepare();
451  virtual void InitOptions();
452  virtual const CrystVector_long& GetBraggLimits()const;
453  virtual void SetMaxSinThetaOvLambda(const REAL max);
456  virtual const CrystMatrix_REAL& GetBMatrix()const;
458  void CalcFrozenBMatrix()const;
459  void PrepareIntegratedProfile()const;
460  //Clocks
465  //Clocks (internal, mutable)
474  // Corrections
495  mutable CrystVector_REAL mIntensityCorr;
510 
512  mutable CrystVector_REAL mIhklCalc;
513  mutable std::map<RefinablePar*,CrystVector_REAL> mIhkl_FullDeriv;
515  mutable CrystVector_REAL mIhklCalcVariance;
516 
517  // Saved arrays to speed-up computations
519  struct ReflProfile
520  {
522  long first;
524  long last;
526  CrystVector_REAL profile;
527  };
529  mutable vector<ReflProfile> mvReflProfile;
533  mutable std::map<RefinablePar*,vector<CrystVector_REAL> > mvReflProfile_FullDeriv;
534 
535  // When using integrated profiles
543  mutable vector< pair<unsigned long, CrystVector_REAL> > mIntegratedProfileFactor;
554  mutable CrystVector_REAL mFrozenLatticePar;
558  mutable CrystMatrix_REAL mFrozenBMatrix;
560  mutable CrystMatrix_REAL mGenHKLBMatrix;
561  #ifdef __WX__CRYST__
562  public:
563  virtual WXCrystObjBasic* WXCreate(wxWindow*);
564  friend class WXPowderPatternDiffraction;
565  #endif
566  private:
567  // Avoid compiler warnings. Explicitly hide the base-class method.
568  void GenHKLFullSpace(const REAL, const bool) const;
569 };
570 
571 //######################################################################
579 //######################################################################
581 {
582  public:
583  PowderPattern();
585  ~PowderPattern();
586  virtual const string& GetClassName() const;
597  void RemovePowderPatternComponent(const int i);
599  unsigned int GetNbPowderPatternComponent()const;
601  const PowderPatternComponent& GetPowderPatternComponent(const string &name)const;
603  const PowderPatternComponent& GetPowderPatternComponent(const int)const;
609  REAL GetScaleFactor(const int i)const;
611  REAL GetScaleFactor(const PowderPatternComponent &comp)const;
613  void SetScaleFactor(const int i, REAL s);
615  void SetScaleFactor(const PowderPatternComponent &comp, REAL s);
616 
617  // Pattern parameters (2theta range, wavelength, radiation)
633  void SetPowderPatternPar(const REAL min,
634  const REAL step,
635  unsigned long nbPoint);
643  void SetPowderPatternX(const CrystVector_REAL &x);
645  unsigned long GetNbPoint()const;
647  unsigned long GetNbPointUsed()const;
650 
652  void SetRadiation(const Radiation &radiation);
654  const Radiation& GetRadiation()const;
657 
659  void SetRadiationType(const RadiationType radiation);
667  void SetWavelength(const REAL lambda);
668 
688  void SetWavelength(const string &XRayTubeElementName,const REAL alpha12ratio=0.5);
689 
691  void SetEnergy(const REAL energy);
693  REAL GetWavelength()const;
694 
695  //Access to pattern data
697  const CrystVector_REAL& GetPowderPatternCalc()const;
698  std::map<RefinablePar*,CrystVector_REAL>& GetPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
700  const CrystVector_REAL& GetPowderPatternObs()const;
702  const CrystVector_REAL& GetPowderPatternObsSigma()const;
704  const CrystVector_REAL& GetPowderPatternVariance()const;
706  const CrystVector_REAL& GetPowderPatternWeight()const;
708  REAL GetPowderPatternXMin()const;
716  REAL GetPowderPatternXStep()const;
718  REAL GetPowderPatternXMax()const;
720  const CrystVector_REAL& GetPowderPatternX()const;
728  const CrystVector_REAL& GetChi2Cumul(const int mode=-1)const;
729 
730  // Clocks
742 
743  // Corrections to the x (2theta, tof) coordinate
745  void SetXZero(const REAL newZero);
748  void Set2ThetaDisplacement(const REAL displacement);
751  void Set2ThetaTransparency(const REAL transparency);
752 
753  // Import & export powder pattern
757  void ImportPowderPatternFullprof(const string &fullprofFileName);
760  void ImportPowderPatternPSI_DMC(const string &filename);
764  void ImportPowderPatternILL_D1A5(const string &filename);
768  void ImportPowderPatternXdd(const string &fileName);
772  void ImportPowderPatternSietronicsCPI(const string &fileName);
777  void ImportPowderPattern2ThetaObsSigma(const string &fileName,const int nbSkip=0);
786  void ImportPowderPatternFullprof4(const string &fileName);
795  void ImportPowderPatternMultiDetectorLLBG42(const string &fileName);
801  void ImportPowderPattern2ThetaObs(const string &fileName,const int nbSkip=0);
805  void ImportPowderPatternTOF_ISIS_XYSigma(const string &fileName);
809  void ImportPowderPatternGSAS(const string &fileName);
812  void ImportPowderPatternCIF(const CIF &cif);
818  void SetPowderPatternObs(const CrystVector_REAL& obs);
820  void SetPowderPatternObsSigma(const CrystVector_REAL& sigma);
821 
827  void SavePowderPattern(const string &filename="powderPattern.out") const;
830  void PrintObsCalcData(ostream&os=cout)const;
831 
832  // Statistics..
838  REAL GetR()const ;
839  REAL GetIntegratedR()const ;
844  REAL GetRw()const;
845  REAL GetIntegratedRw()const;
851  REAL GetChi2()const;
855  REAL GetIntegratedChi2()const;
859  REAL GetChi2_Option()const;
861  void FitScaleFactorForR()const;
862  void FitScaleFactorForIntegratedR()const;
864  void FitScaleFactorForRw()const;
865  void FitScaleFactorForIntegratedRw()const;
867  void SetSigmaToSqrtIobs();
872  void SetWeightToInvSigmaSq(const REAL minRelatSigma=1e-3);
874  void SetWeightToUnit();
882  void SetWeightPolynomial(const REAL a, const REAL b, const REAL c,
883  const REAL minRelatIobs=1e-3);
884 
890  void AddExcludedRegion(const REAL min2Theta,const REAL max2theta);
891 
892  virtual void BeginOptimization(const bool allowApproximations=false,
893  const bool enableRestraints=false);
894  //virtual void SetApproximationFlag(const bool allow);
895  virtual void GlobalOptRandomMove(const REAL mutationAmplitude,
896  const RefParType *type=gpRefParTypeObjCryst);
897  virtual REAL GetLogLikelihood()const;
898  //LSQ functions
899  virtual unsigned int GetNbLSQFunction()const;
900  virtual const CrystVector_REAL& GetLSQCalc(const unsigned int) const;
901  virtual const CrystVector_REAL& GetLSQObs(const unsigned int) const;
902  virtual const CrystVector_REAL& GetLSQWeight(const unsigned int) const;
903  virtual std::map<RefinablePar*, CrystVector_REAL>& GetLSQ_FullDeriv(const unsigned int,std::set<RefinablePar *> &vPar);
904  // I/O
905  virtual void XMLOutput(ostream &os,int indent=0)const;
906  virtual void XMLInput(istream &is,const XMLCrystTag &tag);
907  //virtual void XMLInputOld(istream &is,const IOCrystTag &tag);
908  void Prepare();
909  virtual void GetGeneGroup(const RefinableObj &obj,
910  CrystVector_uint & groupIndex,
911  unsigned int &firstGroup) const;
914  virtual void SetMaxSinThetaOvLambda(const REAL max);
916  REAL GetMaxSinThetaOvLambda()const;
917 
918  // For integrated pattern calculations
920  const CrystVector_long& GetIntegratedProfileMin()const;
922  const CrystVector_long& GetIntegratedProfileMax()const;
930  REAL X2XCorr(const REAL x)const;
942  REAL X2PixelCorr(const REAL x)const;
952  REAL X2Pixel(const REAL x)const;
953 
958  REAL STOL2X(const REAL stol)const;
963  REAL X2STOL(const REAL x)const;
968  REAL STOL2Pixel(const REAL stol)const;
970  PeakList FindPeaks(const float dmin=2.0,const float maxratio=0.01,const unsigned int maxpeak=100);
972  const CrystVector_REAL &GetScaleFactor() const;
974  CrystVector_REAL &GetScaleFactor();
984  void ExportFullprof(const std::string &prefix)const;
986  void SetMuR(const REAL muR);
988  REAL GetMuR() const;
989  protected:
991  void CalcPowderPattern() const;
992  void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
994  void CalcPowderPatternIntegrated() const;
995  void CalcPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
997  virtual void Init();
999  void PrepareIntegratedRfactor()const;
1002  void CalcNbPointUsed()const;
1004  virtual void InitOptions();
1005 
1008  mutable CrystVector_REAL mPowderPatternCalc;
1009  mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPattern_FullDeriv;
1011  mutable CrystVector_REAL mPowderPatternIntegratedCalc;
1012  mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPatternIntegrated_FullDeriv;
1015  mutable CrystVector_REAL mPowderPatternBackgroundCalc;
1018  mutable CrystVector_REAL mPowderPatternBackgroundIntegratedCalc;
1020  CrystVector_REAL mPowderPatternObs;
1022  CrystVector_REAL mPowderPatternObsSigma;
1024  mutable CrystVector_REAL mPowderPatternWeight;
1027  mutable CrystVector_REAL mPowderPatternVariance;
1030  mutable CrystVector_REAL mPowderPatternVarianceIntegrated;
1032  mutable CrystVector_REAL mChi2Cumul;
1033 
1034 
1036  mutable CrystVector_REAL mPowderPatternUsedCalc;
1037  mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPatternUsed_FullDeriv;
1039  mutable CrystVector_REAL mPowderPatternUsedObs;
1041  mutable CrystVector_REAL mPowderPatternUsedWeight;
1042 
1048  CrystVector_REAL mX;
1052  unsigned long mNbPoint;
1053 
1056 
1057  // Clocks
1072 
1073  //Excluded regions in the powder pattern, for statistics.
1075  CrystVector_REAL mExcludedRegionMinX;
1077  CrystVector_REAL mExcludedRegionMaxX;
1078 
1079  //Various corrections to 2theta-to be used by the components
1083  REAL mXZero;
1086  REAL m2ThetaDisplacement;
1089  REAL m2ThetaTransparency;
1092  REAL mDIFC,mDIFA;
1093  // Components of the powder pattern
1095  ObjRegistry<PowderPatternComponent> mPowderPatternComponentRegistry;
1101  mutable CrystVector_REAL mScaleFactor;
1102 
1104  REAL mMuR;
1105 
1107  bool mUseFastLessPreciseFunc;
1108 
1109  // For statistics
1111  bool mStatisticsExcludeBackground;
1114  mutable CrystVector_int mScalableComponentIndex;
1116  mutable CrystMatrix_REAL mFitScaleFactorM,mFitScaleFactorB,mFitScaleFactorX;
1117 
1119  RefObjOpt mOptProfileIntegration;
1120 
1121  // Integrated R-factors
1122  mutable CrystVector_long mIntegratedPatternMin,mIntegratedPatternMax;
1123  mutable CrystVector_REAL mIntegratedObs;
1124  mutable CrystVector_REAL mIntegratedWeight;
1125  mutable CrystVector_REAL mIntegratedWeightObs;
1126  mutable CrystVector_REAL mIntegratedVarianceObs;
1127  mutable RefinableObjClock mClockIntegratedFactorsPrep;
1128  // Statistical indicators
1129  mutable REAL mChi2,mIntegratedChi2;
1134  mutable REAL mChi2LikeNorm,mIntegratedChi2LikeNorm;
1135  mutable REAL mR;
1136  mutable REAL mRw;
1138  mutable RefinableObjClock mClockChi2,mClockIntegratedChi2;
1147  mutable unsigned long mNbPointUsed;
1150  mutable unsigned long mNbIntegrationUsed;
1153  mutable RefinableObjClock mClockNbPointUsed;
1154  #ifdef __WX__CRYST__
1155  public:
1156  virtual WXCrystObjBasic* WXCreate(wxWindow*);
1157  friend class WXPowderPattern;
1158  // This should be removed
1159  friend class WXPowderPatternGraph;
1160  #endif
1161 };
1163 extern ObjRegistry<PowderPattern> gPowderPatternRegistry;
1164 //######################################################################
1165 // PROFILE FUNCTIONS (for powder diffraction)
1166 //######################################################################
1167 
1171 CrystVector_REAL PowderProfileGauss (const CrystVector_REAL theta,
1172  const REAL fwhm,
1173  const REAL asymmetryPar=1.);
1177 CrystVector_REAL PowderProfileLorentz(const CrystVector_REAL theta,
1178  const REAL fwhm,
1179  const REAL asymmetryPar=1.);
1180 
1181 
1182 //######################################################################
1183 // Spacegroup explorer
1184 //######################################################################
1188 struct SPGScore
1189 {
1190  SPGScore(const string &s, const REAL r, const REAL g, const unsigned int nbextinct, const REAL ngof=0, const unsigned int nbrefl=0);
1191  string hm;
1193  REAL rw;
1195  REAL gof;
1200  REAL ngof;
1203  unsigned int nbextinct446;
1205  unsigned int nbreflused;
1206 };
1207 
1208 bool compareSPGScore(const SPGScore &s1, const SPGScore &s2);
1209 
1212 std::vector<bool> spgExtinctionFingerprint(Crystal &c, const cctbx::sgtbx::space_group &spg);
1213 
1217 class SpaceGroupExplorer
1218 {
1219 public:
1224  SpaceGroupExplorer(PowderPatternDiffraction *pd);
1238  SPGScore Run(const string &spg, const bool fitprofile=false, const bool verbose=false,
1239  const bool restore_orig=false, const bool update_display=true,
1240  const REAL relative_length_tolerance=0.01, const REAL absolute_angle_tolerance_degree=0.5);
1254  SPGScore Run(const cctbx::sgtbx::space_group &spg, const bool fitprofile=false,
1255  const bool verbose=false, const bool restore_orig=false, const bool update_display=true,
1256  const REAL relative_length_tolerance=0.01, const REAL absolute_angle_tolerance_degree=0.5);
1274  void RunAll(const bool fitprofile_all=false, const bool verbose=true, const bool keep_best=false,
1275  const bool update_display=true, const bool fitprofile_p1=true,
1276  const REAL relative_length_tolerance=0.01, const REAL absolute_angle_tolerance_degree=0.5);
1278  const list<SPGScore>& GetScores() const;
1279 private:
1283  REAL GetP1IntegratedGoF();
1285  PowderPatternDiffraction *mpDiff;
1288  CrystVector_REAL mP1IntegratedProfileMin,mP1IntegratedProfileMax;
1290  list<SPGScore> mvSPG;
1292  std::map<std::vector<bool>,SPGScore> mvSPGExtinctionFingerprint;
1293 };
1294 
1295 
1296 }//namespace ObjCryst
1297 #endif // _OBJCRYST_POWDERPATTERN_H_
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: doc-main.h:25
ReflectionProfileType
Profile type for powder (could it be used fopr single crystals on 2D detectors ?)
Definition: General.h:105
std::vector< bool > spgExtinctionFingerprint(Crystal &c, const cctbx::sgtbx::space_group &spg)
Function which determines the unique extinction fingerprint of a spacegroup, by calculating all prese...
ObjRegistry< PowderPatternComponent > gPowderPatternComponentRegistry("List of all PowderPattern Components")
Global registry for all PowderPatternComponent objects.
RadiationType
Type of radiation used.
Definition: General.h:96
const RefParType * gpRefParTypeObjCryst
Top RefParType for the ObjCryst++ library.
Main CIF class - parses the stream and separates data blocks, comments, items, loops.
Definition: CIF.h:170
Crystal class: Unit cell, spacegroup, scatterers.
Definition: Crystal.h:98
DiffractionData object for Single Crystal analysis.
Class to store positions of observed reflections.
Definition: Indexing.h:117
Cylinder absorption correction.
Definition: PowderPattern.h:50
virtual const string & GetName() const
Get the name of this object.
virtual void CalcCorr() const
Do the computation of corrected intensities.
CylinderAbsCorr(const PowderPatternDiffraction &data)
Constructor.
virtual const string & GetClassName() const
Get the name of the class.
Generic class to compute components (eg the contribution of a given phase, or background) of a powder...
Definition: PowderPattern.h:73
CrystVector_REAL mPowderPatternCalcVariance
The variance associated to each point of the calculated powder pattern.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
bool IsScalable() const
Is this component scalable ?
virtual const CrystVector_REAL & GetPowderPatternCalc() const =0
Get the calculated powder pattern for this component.
virtual void SetMaxSinThetaOvLambda(const REAL max)=0
Set the maximum value for sin(theta)/lambda.
RefinableObjClock mClockPowderPatternIntegratedVarianceCalc
When was the 'integrated' powder pattern variance last computed ?
RefinableObjClock mClockPowderPatternVarianceCalc
When was the powder pattern variance last computed ?
virtual void SetParentPowderPattern(PowderPattern &)=0
Set the PowderPattern object which uses this component.
virtual const CrystVector_long & GetBraggLimits() const =0
Get the pixel positions separating the integration intervals around reflections.
RefinableObjClock mClockBraggLimits
Get last time the Bragg Limits were changed.
const PowderPattern & GetParentPowderPattern() const
Get the PowderPattern object which uses this component.
virtual bool HasPowderPatternCalcVariance() const =0
Does this component have a variance associated with each calculated point ? i.e., do we use maximum l...
virtual void CalcPowderPatternIntegrated_FullDeriv(std::set< RefinablePar * > &vPar)
Calc the integrated powder pattern.
virtual void CalcPowderPattern() const =0
Calc the powder pattern.
CrystVector_REAL mPowderPatternIntegratedCalc
The calculated powder pattern, integrated.
bool mIsScalable
Scalable ? (crystal phase = scalable, background= not scalable)
RefinableObjClock mClockPowderPatternCalc
When was the powder pattern last computed ?
const RefinableObjClock & GetClockPowderPatternCalcVariance() const
Last time the variance on the pattern was actually calculated.
list< pair< const REAL,const string > > mvLabel
The labels associated to different points of the pattern.
virtual pair< const CrystVector_REAL *, const RefinableObjClock * > GetPowderPatternIntegratedCalc() const =0
Get the integrated values of the powder pattern.
CrystVector_long mIntegratedReflLimits
Interval limits around each reflection, for integrated R-factors.
const RefinableObjClock & GetClockPowderPatternCalc() const
Last time the powder pattern was calculated.
PowderPattern * mpParentPowderPattern
The PowderPattern object in which this component is included.
virtual const CrystVector_REAL & GetPowderPatternCalcVariance() const =0
Get the variance associated to each point of the calculated powder pattern, for this component.
RefinableObjClock mClockPowderPatternIntegratedCalc
When was the 'integrated' powder pattern last computed ?
CrystVector_REAL mPowderPatternCalc
The calculated component of a powder pattern.
virtual pair< const CrystVector_REAL *, const RefinableObjClock * > GetPowderPatternIntegratedCalcVariance() const =0
Get the variance associated to each point of the calculated powder pattern, for this component (integ...
CrystVector_REAL mPowderPatternIntegratedCalcVariance
The variance associated to each point of the calculated powder pattern, integrated.
const RefinableObjClock & GetClockBraggLimits() const
Get last time the Bragg Limits were changed.
const list< pair< const REAL,const string > > & GetPatternLabelList() const
Get a list of labels for the pattern (usually reflection indexes).
Phase to compute a background contribution to a powder pattern using an interpolation.
virtual void CalcPowderPatternIntegrated_FullDeriv(std::set< RefinablePar * > &vPar)
Calc the integrated powder pattern.
void OptimizeBayesianBackground()
Optimize the background using a Bayesian approach.
virtual bool HasPowderPatternCalcVariance() const
Does this component have a variance associated with each calculated point ? i.e., do we use maximum l...
CrystVector_long mPointOrder
Subscript of the points, sorted the correct order, taking into account the type of radiation (monochr...
CrystVector_REAL mvSplinePixel
Vector of pixel values between each interval, for faster CubicSpline calculations.
int mBackgroundNbPoint
Number of fitting points for background.
virtual void TagNewBestConfig() const
During a global optimization, tells the object that the current config is the latest "best" config.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
virtual void BeginOptimization(const bool allowApproximations=false, const bool enableRestraints=false)
This should be called by any optimization class at the begining of an optimization.
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
CubicSpline mvSpline
Spline used for interpolation.
CrystVector_REAL mBackgroundInterpPointX
Vector of 2theta values for the fitting points of the background.
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
virtual void CalcPowderPattern() const
Calc the powder pattern.
virtual void SetParentPowderPattern(PowderPattern &)
Set the PowderPattern object which uses this component.
virtual const CrystVector_REAL & GetPowderPatternCalcVariance() const
Get the variance associated to each point of the calculated powder pattern, for this component.
void FixParametersBeyondMaxresolution(RefinableObj &obj)
Fix parameters corresponding to points of the pattern that are not actually calculated.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
virtual pair< const CrystVector_REAL *, const RefinableObjClock * > GetPowderPatternIntegratedCalcVariance() const
Get the variance associated to each point of the calculated powder pattern, for this component (integ...
RefObjOpt mInterpolationModel
Type of interpolation performed: linear or cubic spline.
CrystVector_REAL mBackgroundInterpPointIntensity
Values of background at interpolating points.
REAL mMaxSinThetaOvLambda
Maximum sin(theta)/lambda for all calculations (10 by default).
virtual pair< const CrystVector_REAL *, const RefinableObjClock * > GetPowderPatternIntegratedCalc() const
Get the integrated values of the powder pattern.
RefinableObjClock mClockBackgroundPoint
Modification of the interpolated points.
void ImportUserBackground(const string &filename)
Import background points from a file (with two columns 2theta (or tof), intensity)
virtual const CrystVector_long & GetBraggLimits() const
Get the pixel positions separating the integration intervals around reflections.
virtual const CrystVector_REAL & GetPowderPatternCalc() const
Get the calculated powder pattern for this component.
RefinableObjClock mClockSpline
Initialization of the spline.
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
REAL mModelVariance
Constant error (sigma) on the calculated pattern, due to an incomplete model.
Class to compute the contribution to a powder pattern from a crystalline phase.
void SetExtractionMode(const bool extract=true, const bool init=false)
Prepare intensity extraction (Le Bail or Pawley)
const ReflectionProfile & GetProfile() const
Get reflection profile.
virtual pair< const CrystVector_REAL *, const RefinableObjClock * > GetPowderPatternIntegratedCalcVariance() const
Get the variance associated to each point of the calculated powder pattern, for this component (integ...
unsigned int GetProfileFitNetNbObs() const
Get the 'net' number of observed intensities, minus the number of reflections, for a profile fit.
RefinableObjClock mClockLorentzPolarSlitCorrPar
Last time the Lorentz-Polarization and slit parameters were changed.
void SetFrozenLatticePar(const unsigned int i, REAL v)
Change one parameter in mFrozenLatticePar. This triggers a call to CalcLocalBMatrix() if the paramete...
CylinderAbsCorr mCorrCylAbs
Cylinder absorption correction.
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
REAL GetFrozenLatticePar(const unsigned int i) const
Access to one parameter in mFrozenLatticePar.
virtual const CrystVector_REAL & GetPowderPatternCalc() const
Get the calculated powder pattern for this component.
virtual pair< const CrystVector_REAL *, const RefinableObjClock * > GetPowderPatternIntegratedCalc() const
Get the integrated values of the powder pattern.
bool mFreezeLatticePar
If true, use local cell parameters from mFrozenLatticePar rather than the Crystal.
PolarizationCorr mCorrPolar
Polarization correction.
RefinableObjClock mClockProfileCalc
Last time the reflection profiles were computed.
const CrystVector_REAL & GetFhklObsSq() const
Get the extracted structure factors modulus (squared), e.g.
bool mExtractionMode
Extraction mode (Le Bail, Pawley)
std::map< RefinablePar *, vector< CrystVector_REAL > > mvReflProfile_FullDeriv
Derivatives of reflection profiles versus a list of parameters.
virtual void CalcPowderPatternIntegrated_FullDeriv(std::set< RefinablePar * > &vPar)
Calc the integrated powder pattern.
RefinableObjClock mClockIntegratedProfileFactor
Last time the integrated values of normalized profiles was calculated.
RefinableObjClock mClockIhklCalc
Last time intensities were computed.
virtual void CalcPowderPattern() const
Calc the powder pattern.
RefinableObjClock mClockProfilePar
Last time the reflection parameters were changed.
vector< pair< unsigned long, CrystVector_REAL > > mIntegratedProfileFactor
For each reflection, store the integrated value of the normalized profile over all integration interv...
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
void CalcPowderReflProfile_FullDeriv(std::set< RefinablePar * > &vPar)
TOFCorr mCorrTOF
Time-Of-Flight intensity correction.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
virtual bool HasPowderPatternCalcVariance() const
Does this component have a variance associated with each calculated point ? i.e., do we use maximum l...
virtual const CrystVector_REAL & GetPowderPatternCalcVariance() const
Get the variance associated to each point of the calculated powder pattern, for this component.
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
void SetReflectionProfilePar(const ReflectionProfileType prof, const REAL fwhmCagliotiW, const REAL fwhmCagliotiU=0, const REAL fwhmCagliotiV=0, const REAL eta0=0.5, const REAL eta1=0.)
Set reflection profile parameters.
LorentzCorr mCorrLorentz
Lorentz correction.
virtual long GetNbReflBelowMaxSinThetaOvLambda() const
Recalc, and get the number of reflections which should be actually used, due to the maximuml sin(thet...
bool GetExtractionMode() const
Return true if in extraction mode, i.e. using extracted intensities instead of computed structure fac...
virtual const CrystVector_long & GetBraggLimits() const
Get the pixel positions separating the integration intervals around reflections.
TextureMarchDollase mCorrTextureMarchDollase
Preferred orientation (texture) correction following the March-Dollase model.
CrystVector_REAL mIhklCalc
Computed intensities for all reflections.
void ExtractLeBail(unsigned int nbcycle=1)
Extract intensities using Le Bail method.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
vector< ReflProfile > mvReflProfile
Reflection profiles for ALL reflections during the last powder pattern generation.
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
PowderSlitApertureCorr mCorrSlitAperture
Slit aperture correction.
CrystMatrix_REAL mGenHKLBMatrix
Bmatrix the last time the HKL parameters were generated.
virtual void SetParentPowderPattern(PowderPattern &)
Set the PowderPattern object which uses this component.
void SetProfile(ReflectionProfile *prof)
Assign a new profile.
virtual PowderPatternDiffraction * CreateCopy() const
So-called virtual copy constructor.
bool HasFhklObsSq() const
Return true if there are extracted (le Bail) squared structure factors, false otherwise.
virtual const CrystMatrix_REAL & GetBMatrix() const
This can use either locally stored lattice parameters from mLocalLatticePar, or the Crystal's,...
void CalcFrozenBMatrix() const
Calculate the local BMatrix, used if mFreezeLatticePar is true.
CrystVector_REAL mIhklCalcVariance
Variance on computed intensities for all reflections.
ReflectionProfile * mpReflectionProfile
Profile.
CrystVector_REAL mFrozenLatticePar
a,b and c in Angstroems, angles (stored) in radians This is used to override lattice parameter from t...
RefinableObjClock mClockIntensityCorr
Last time the Lorentz-Polar-Slit correction was computed.
CrystVector_REAL mIntensityCorr
Calculated corrections for all reflections.
DiffractionDataSingleCrystal * mpLeBailData
Single crystal data extracted from the powder pattern.
virtual void SetApproximationFlag(const bool allow)
Enable or disable numerical approximations.
bool FreezeLatticePar() const
Do we use local cell parameters ? (see mFrozenLatticePar)
virtual const Radiation & GetRadiation() const
Get the radiation object for this data.
CrystMatrix_REAL mFrozenBMatrix
Local B Matrix, used if mFreezeLatticePar is true.
virtual void BeginOptimization(const bool allowApproximations=false, const bool enableRestraints=false)
This should be called by any optimization class at the begining of an optimization.
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
TextureEllipsoid mCorrTextureEllipsoid
Preferred orientation (texture) correction following the Ellipsoidal function.
long first
First point of the pattern for which the profile is calculated.
long last
Last point of the pattern for which the profile is calculated.
Powder pattern class, with an observed pattern and several calculated components to modelize the patt...
REAL X2Pixel(const REAL x) const
Get the pixel number on the experimental pattern, corresponding to a given (experimental) x coordinat...
void AddPowderPatternComponent(PowderPatternComponent &)
Add a component (phase, backround) to this pattern.
REAL X2STOL(const REAL x) const
Convert X (either 2theta or TOF) to sin(theta)/lambda, depending on the type of radiation.
CrystVector_REAL mPowderPatternCalc
The calculated powder pattern.
Radiation mRadiation
The Radiation corresponding to this experiment.
REAL STOL2X(const REAL stol) const
Convert sin(theta)/lambda to X (i.e.
void SetEnergy(const REAL energy)
Set the energy of the experiment [in keV, lambda(A)=12398/E(keV)].
virtual const CrystVector_REAL & GetLSQObs(const unsigned int) const
Get the observed values for the LSQ function.
const RefinableObjClock & GetClockNbPointUsed() const
Clock corresponding to the last time the number of points used was changed.
CrystVector_REAL mChi2Cumul
The cumulative Chi^2 (integrated or not, depending on the option)
void PrepareIntegratedRfactor() const
Prepare the calculation of the integrated R-factors.
REAL GetIntegratedChi2() const
Return integrated Chi^2.
REAL GetWavelength() const
wavelength of the experiment (in Angstroems)
CrystVector_REAL mPowderPatternBackgroundIntegratedCalc
The calculated powder pattern part which corresponds to 'background' (eg non-scalable components),...
unsigned long mNbPoint
Number of points in the pattern.
REAL GetPowderPatternXMax() const
Get the maximum 2theta.
void ImportPowderPattern2ThetaObs(const string &fileName, const int nbSkip=0)
Import file with 2 columns 2Theta Iobs.
void ImportPowderPatternPSI_DMC(const string &filename)
Import powder pattern, format DMC from PSI.
const CrystVector_long & GetIntegratedProfileMin() const
Get the list of first pixels for the integration intervals.
void SetSigmaToSqrtIobs()
Set sigma=sqrt(Iobs)
void CalcPowderPatternIntegrated() const
Calc the integrated powder pattern.
void ImportPowderPatternFullprof4(const string &fileName)
Import diffraction data from a file, with the first line has 2ThetaMin, step, 2thetaMax,...
REAL GetR() const
Unweighted R-factor.
virtual const CrystVector_REAL & GetLSQWeight(const unsigned int) const
Get the weight values for the LSQ function.
const RefinableObjClock & GetClockPowderPatternPar() const
When were the pattern parameters (2theta range, step) changed ?
const RefinableObjClock & GetIntegratedProfileLimitsClock() const
When were the integration intervals last changed ?
void SetWeightPolynomial(const REAL a, const REAL b, const REAL c, const REAL minRelatIobs=1e-3)
Set w = 1/(a+ Iobs + b*Iobs^2+c*Iobs^3)
const PowderPatternComponent & GetPowderPatternComponent(const string &name) const
Access to a component of the powder pattern.
const CrystVector_REAL & GetPowderPatternWeight() const
Get the weight for each point of the powder pattern.
void CalcNbPointUsed() const
Calculate the number of points of the pattern actually used, from the maximum value of sin(theta)/lam...
void ImportPowderPatternFullprof(const string &fullprofFileName)
Import fullprof-style diffraction data.
virtual std::map< RefinablePar *, CrystVector_REAL > & GetLSQ_FullDeriv(const unsigned int, std::set< RefinablePar * > &vPar)
Get the first derivative for the LSQ function for each parameter supplied in a list.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
CrystVector_REAL mPowderPatternUsedCalc
The calculated powder pattern. Cropped to the maximum sin(theta)/lambda for LSQ.
void ImportPowderPatternXdd(const string &fileName)
Import *.xdd diffraction data (Topas,...).
virtual unsigned int GetNbLSQFunction() const
Number of LSQ functions.
const CrystVector_REAL & GetPowderPatternVariance() const
Get the variance (obs+model) for each point of the powder pattern.
void ImportPowderPatternCIF(const CIF &cif)
Import CIF powder pattern data.
CrystVector_REAL mPowderPatternUsedObs
The calculated powder pattern. Cropped to the maximum sin(theta)/lambda for LSQ.
REAL GetMuR() const
Get the $\mu R$ value.
void SetWeightToUnit()
Set w = 1.
REAL mMaxSinThetaOvLambda
Displacement correction : REAL m2ThetaDisplacement; Transparency correction : REAL m2ThetaTranspare...
void SetXZero(const REAL newZero)
Change Zero in x (2theta,tof)
void ExportFullprof(const std::string &prefix) const
Export powder pattern & crystal structure in Fullprof format.
void SetScaleFactor(const int i, REAL s)
Access to the scale factor of components (will be 1 for background components)
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
void SetPowderPatternX(const CrystVector_REAL &x)
Set the x coordinate of the powder pattern : either the 2theta or time-of-flight values for each reco...
CrystVector_REAL mExcludedRegionMinX
Min coordinate for for all excluded regions.
CrystVector_REAL mPowderPatternWeight
The weight for each point of the pattern.
unsigned long GetNbPoint() const
Number of points ?
REAL GetPowderPatternXStep() const
Get the average step in 2theta.
REAL GetRw() const
Get the weighted R-factor.
void Set2ThetaTransparency(const REAL transparency)
Change transparency correction .
virtual const CrystVector_REAL & GetLSQCalc(const unsigned int) const
Get the current calculated value for the LSQ function.
CrystVector_REAL mExcludedRegionMaxX
Max coordinate for 2theta for all excluded regions.
void ImportPowderPatternGSAS(const string &fileName)
Import GSAS standard powder pattern data (see GSAS manual).
void SetRadiation(const Radiation &radiation)
Set the radiation.
CrystVector_REAL mPowderPatternVarianceIntegrated
The complete variance associated to each point of the powder pattern, taking into account observation...
RadiationType GetRadiationType() const
Neutron or x-ray experiment ?
void RemovePowderPatternComponent(PowderPatternComponent &)
Remove a powder pattern component.
void SetPowderPatternObs(const CrystVector_REAL &obs)
Set observed powder pattern from vector array.
REAL X2PixelCorr(const REAL x) const
Get the pixel number on the experimental pattern, from the theoretical (uncorrected) x coordinate,...
const Radiation & GetRadiation() const
Neutron or x-ray experiment ?
RefinableObjClock mClockPowderPatternIntegratedCalc
When was the powder pattern (integrated) last computed ?
void ImportPowderPatternILL_D1A5(const string &filename)
Import powder pattern, format from ILL D1A/D2B (format without counter info)
const RefinableObjClock & GetClockPowderPatternAbsCorr() const
When were the absorption correction parameters (muR) last changed ?
void CalcPowderPattern() const
Calc the powder pattern.
const CrystVector_REAL & GetPowderPatternX() const
Get the vector of X (2theta or time-of-flight) coordinates.
unsigned long GetNbPointUsed() const
Number of points actually calculated (below the chosen max(sin(theta)/lambda)) ?
void AddExcludedRegion(const REAL min2Theta, const REAL max2theta)
Add an Exclusion region, in 2theta, which will be ignored when computing R's XMLInput values must be,...
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
void ImportPowderPatternTOF_ISIS_XYSigma(const string &fileName)
Import TOF file (ISIS type, 3 columns t, Iobs, sigma(Iobs))
const CrystVector_REAL & GetChi2Cumul(const int mode=-1) const
Get the powder pattern cumulative Chi^2.
CrystVector_REAL mPowderPatternBackgroundCalc
The calculated powder pattern part which corresponds to 'background' (eg non-scalable components).
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
CrystVector_REAL mPowderPatternObs
The observed powder pattern.
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
RefinableObjClock mClockPowderPatternCalc
When was the powder pattern last computed ?
CrystVector_REAL mPowderPatternObsSigma
The sigma of the observed pattern.
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
CrystVector_REAL mPowderPatternUsedWeight
The weight for each point of the pattern. Cropped to the maximum sin(theta)/lambda for LSQ.
REAL STOL2Pixel(const REAL stol) const
Convert sin(theta)/lambda to pixel, depending on the type of radiation.
REAL GetPowderPatternXMin() const
Get the Minimum 2theta.
virtual void InitOptions()
Initialize options.
virtual void Init()
Init parameters and options.
void FitScaleFactorForRw() const
Fit the scale(s) factor of each component to minimize Rw.
REAL GetChi2() const
Return conventionnal Chi^2.
REAL GetMaxSinThetaOvLambda() const
Get the maximum value for sin(theta)/lambda.
RefinableObjClock mClockScaleFactor
Last modification of the scale factor.
CrystVector_REAL mPowderPatternIntegratedCalc
The calculated powder pattern, integrated.
void ImportPowderPatternMultiDetectorLLBG42(const string &fileName)
diffraction data in a multi-detector format (fullprof format #6).
void PrintObsCalcData(ostream &os=cout) const
Print to thee screen/console the observed and calculated pattern (long, mostly useful for debugging)
const CrystVector_REAL & GetPowderPatternObs() const
Get the observed powder pattern.
CrystVector_REAL mX
Vector of x coordinates (either 2theta or time-of-flight) for the pattern.
unsigned int GetNbPowderPatternComponent() const
Number of components.
CrystVector_REAL mPowderPatternVariance
The complete variance associated to each point of the powder pattern, taking into account observation...
RefinableObjClock mClockCorrAbs
Last modification of absorption correction parameters.
const RefinableObjClock & GetClockPowderPatternCalc() const
Last time the pattern was calculated.
REAL X2XCorr(const REAL x) const
Get the experimental x (2theta, tof) from the theoretical value, taking into account all corrections ...
void SetRadiationType(const RadiationType radiation)
Set the radiation type.
PeakList FindPeaks(const float dmin=2.0, const float maxratio=0.01, const unsigned int maxpeak=100)
Find peaks in the pattern.
void ImportPowderPatternSietronicsCPI(const string &fileName)
Import *.cpi Sietronics diffraction data.
void SetPowderPatternPar(const REAL min, const REAL step, unsigned long nbPoint)
\briefSet the powder pattern angular range & resolution parameter.
const CrystVector_long & GetIntegratedProfileMax() const
Get the list of last pixels for the integration intervals.
void SetWeightToInvSigmaSq(const REAL minRelatSigma=1e-3)
Set w = 1/sigma^2.
void FitScaleFactorForR() const
Fit the scale(s) factor of each component to minimize R.
const CrystVector_REAL & GetPowderPatternCalc() const
Get the calculated powder pattern.
virtual void BeginOptimization(const bool allowApproximations=false, const bool enableRestraints=false)
This should be called by any optimization class at the begining of an optimization.
RefinableObjClock mClockPowderPatternXCorr
Corrections to 2Theta.
bool mIsXAscending
Is the mX vector sorted in ascending order ? (true for 2theta, false for TOF)
RefinableObjClock mClockPowderPatternPar
When were the pattern parameters (2theta or time-of-flight range) changed ?
REAL mXZero
Zero correction : Thus mPowderPattern2ThetaMin=(mPowderPattern2ThetaMin-m2ThetaZero)
const RefinableObjClock & GetClockPowderPatternRadiation() const
When were the radiation parameter (radiation type, wavelength) changed ?
void SetMuR(const REAL muR)
Set the $\mu R$ value for cylinder absorption correction.
REAL GetChi2_Option() const
Return the conventionnal or integrated Chi^2, depending on the option.
void SavePowderPattern(const string &filename="powderPattern.out") const
Save powder pattern to one file, text format, 3 columns theta Iobs Icalc.
void SetWavelength(const REAL lambda)
Set the wavelength of the experiment (in Angstroems).
void Set2ThetaDisplacement(const REAL displacement)
Change displacement correction .
void ImportPowderPattern2ThetaObsSigma(const string &fileName, const int nbSkip=0)
Import file with 3 columns 2Theta Iobs Sigma.
void SetPowderPatternObsSigma(const CrystVector_REAL &sigma)
Set sigma for each point of the observed powder pattern.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
const CrystVector_REAL & GetScaleFactor() const
Access the scale factors (see PowderPattern::mScaleFactor)
const RefinableObjClock & GetClockPowderPatternXCorr() const
When were the parameters for 2theta/TOF correction (zero, transparency, displacement) last changed ?
RefinableObjClock mClockPowderPatternRadiation
When were the radiation parameter (radiation type, wavelength) changed ?
const CrystVector_REAL & GetPowderPatternObsSigma() const
Get the sigma for each point of the observed powder pattern.
Structure to hold the score corresponding to a given spacegroup.
SPGScore(const string &s, const REAL r, const REAL g, const unsigned int nbextinct, const REAL ngof=0, const unsigned int nbrefl=0)
Structure to hold the score corresponding to a given spacegroup.
Abstract base class for reflection profiles.
Base class to compute all kind of corrections to intensities: Lorentz, Polar, absorption,...
Lorentz Correction.
Polarization Correction.
Slit aperture correction (for powder)
Texture correction using the March-Dollase model.
Texture correction using the Ellipsoidal preferred orientation function.
Time-Of-Flight Correction.
Class to define the radiation (type, monochromaticity, wavelength(s)) of an experiment.
Class to compute structure factors for a set of reflections and a Crystal.
Cubic spline interpolation.
Definition: CrystVector.h:565
class to input or output a well-formatted xml beginning or ending tag.
class of refinable parameter types.
Definition: RefinableObj.h:80
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Definition: RefinableObj.h:140
Base class for options.
Definition: RefinableObj.h:552
Object Registry.
Definition: RefinableObj.h:645
Generic Refinable Object.
Definition: RefinableObj.h:784
Abstract base class for all objects in wxCryst.
Definition: wxCryst.h:128
WX Class for PowderPattern objects.
Class to display a Powder Pattern (calc,obs) in a graphic window.
Class to display a Powder Pattern Background.
Class to display a Powder Pattern for a crystalline phase.