00001 #ifndef _OBJCRYST_SCATTERINGDATA_H_
00002 #define _OBJCRYST_SCATTERINGDATA_H_
00003
00004 #include "CrystVector/CrystVector.h"
00005
00006 #include "ObjCryst/General.h"
00007
00008 #include "ObjCryst/SpaceGroup.h"
00009 #include "ObjCryst/ScatteringPower.h"
00010 #include "ObjCryst/Scatterer.h"
00011 #include "ObjCryst/Crystal.h"
00012
00013
00014 #include <string>
00015
00016
00017
00018
00019
00020
00021 namespace ObjCryst
00022 {
00023 extern const RefParType *gpRefParTypeScattData;
00024 extern const RefParType *gpRefParTypeScattDataScale;
00025 extern const RefParType *gpRefParTypeScattDataProfile;
00026 extern const RefParType *gpRefParTypeScattDataProfileType;
00027 extern const RefParType *gpRefParTypeScattDataProfileWidth;
00028 extern const RefParType *gpRefParTypeScattDataProfileAsym;
00029 extern const RefParType *gpRefParTypeScattDataCorr;
00030 extern const RefParType *gpRefParTypeScattDataCorrInt;
00031 extern const RefParType *gpRefParTypeScattDataCorrIntAbsorp;
00032 extern const RefParType *gpRefParTypeScattDataCorrIntPolar;
00033 extern const RefParType *gpRefParTypeScattDataCorrIntExtinc;
00034 extern const RefParType *gpRefParTypeScattDataCorrPos;
00035 extern const RefParType *gpRefParTypeScattDataBackground;
00036
00037 extern const RefParType *gpRefParTypeRadiation;
00038 extern const RefParType *gpRefParTypeRadiationWavelength;
00039
00040
00051
00052 class Radiation: public RefinableObj
00053 {
00054 public:
00056 Radiation();
00063 Radiation(const RadiationType rad,const double wavelength);
00082 Radiation(const string &XRayTubeElementName,const double alpha2Alpha2ratio=0.5);
00084 Radiation(const Radiation&);
00085 ~Radiation();
00086 virtual const string GetClassName() const;
00087
00088 void operator=(const Radiation&);
00089
00091 RadiationType GetRadiationType()const;
00093 void SetRadiationType(const RadiationType);
00094
00095 WavelengthType GetWavelengthType()const;
00099 const CrystVector_double& GetWavelength()const;
00101 void SetWavelength(const double );
00120 void SetWavelength(const string &XRayTubeElementName,const double alpha2Alpha2ratio=0.5);
00121
00123 double GetXRayTubeDeltaLambda()const;
00125 double GetXRayTubeAlpha2Alpha1Ratio()const;
00126
00128 const RefinableObjClock& GetClockWavelength()const ;
00130 const RefinableObjClock& GetClockRadiation()const ;
00131 virtual void XMLOutput(ostream &os,int indent=0)const;
00132 virtual void XMLInput(istream &is,const XMLCrystTag &tag);
00133
00135
00136 private:
00137 void InitOptions();
00139 RefObjOpt mRadiationType;
00141 RefObjOpt mWavelengthType;
00143 CrystVector_double mWavelength;
00146 string mXRayTubeName;
00148 double mXRayTubeDeltaLambda;
00150 double mXRayTubeAlpha2Alpha1Ratio;
00151
00152 RefinableObjClock mClockWavelength;
00153 RefinableObjClock mClockRadiation;
00154 #ifdef __WX__CRYST__
00155 public:
00156 virtual WXCrystObjBasic* WXCreate(wxWindow*);
00157 friend class WXRadiation;
00158 #endif
00159 };
00160
00161
00176
00177 class ScatteringData: virtual public RefinableObj
00178 {
00179 public:
00180 ScatteringData();
00181 ScatteringData(const ScatteringData &old);
00182 ~ScatteringData();
00184 virtual ScatteringData* CreateCopy()const=0;
00185
00191 virtual void SetHKL( CrystVector_double const &h,
00192 CrystVector_double const &k,
00193 CrystVector_double const &l);
00211 virtual void GenHKLFullSpace(const double maxTheta,
00212 const bool useMultiplicity=false);
00213
00215 virtual void SetRadiationType(const RadiationType radiation);
00217 RadiationType GetRadiationType()const;
00218
00222 virtual void SetCrystal(Crystal &crystal);
00224 const Crystal& GetCrystal()const ;
00226 Crystal& GetCrystal() ;
00227
00229 long GetNbRefl() const;
00231 const CrystVector_double& GetH() const;
00233 const CrystVector_double& GetK() const;
00235 const CrystVector_double& GetL() const;
00238 const CrystVector_double& GetH2Pi() const;
00241 const CrystVector_double& GetK2Pi() const;
00244 const CrystVector_double& GetL2Pi() const;
00245
00248 const CrystVector_double& GetSinThetaOverLambda()const;
00249
00251 const CrystVector_double& GetFhklCalcSq() const;
00253 const CrystVector_double& GetFhklCalcReal() const;
00255 const CrystVector_double& GetFhklCalcImag() const;
00256
00259 void SetWavelength(const double lambda);
00260
00279 void SetWavelength(const string &XRayTubeElementName,const double alpha2Alpha1ratio=0.5);
00280
00283 void SetEnergy(const double energy);
00285 CrystVector_double GetWavelength()const;
00286
00289 void SetUseFastLessPreciseFunc(const bool useItOrNot);
00296 void SetIsIgnoringImagScattFact(const bool b);
00299 bool IsIgnoringImagScattFact() const;
00300
00301
00302
00306 virtual void PrintFhklCalc()const;
00307
00308 protected:
00311 virtual void PrepareHKLarrays() ;
00315 CrystVector_long SortReflectionByTheta(const double maxTheta=-1.);
00323 CrystVector_long EliminateExtinctReflections();
00324
00325
00333
00337
00339
00341
00345
00346
00358 void CalcStructFactor() const;
00359
00364 void CalcGeomStructFactor(const ScatteringComponentList &scattCompList,
00365 const SpaceGroup &spg,
00366 const CrystVector_long &structFactorIndex,
00367 CrystVector_double* rsf2,
00368 CrystVector_double* isf2,
00369 bool useFastTabulatedTrigFunctions=false) const;
00370
00372 long mNbRefl;
00374 CrystVector_double mH, mK, mL ;
00376 mutable CrystVector_long mIntH, mIntK, mIntL ;
00378 mutable CrystVector_double mH2Pi, mK2Pi, mL2Pi ;
00379
00381 CrystVector_int mMultiplicity ;
00382
00384 mutable CrystVector_double mFhklCalcReal, mFhklCalcImag ;
00386 mutable CrystVector_double mFhklCalcSq ;
00387
00389 Radiation mRadiation;
00390
00396 Crystal *mpCrystal;
00397
00401 bool mUseFastLessPreciseFunc;
00402
00403
00404
00405
00408 mutable CrystVector_double mSinThetaLambda;
00409
00411 mutable CrystVector_double mTheta;
00412
00415 mutable CrystVector_double mTanTheta;
00416
00419 mutable CrystVector_double mFprime,mFsecond;
00420
00422 mutable CrystVector_double* mpTemperatureFactor;
00423
00425 mutable CrystVector_double* mpScatteringFactor;
00426
00428 mutable CrystVector_double* mpRealGeomSF,*mpImagGeomSF;
00429
00430
00432
00434
00436
00437
00439
00441
00443
00445
00447
00448
00449
00451
00456
00458
00460
00461
00462 mutable ScatteringComponentList mLastScattCompList;
00463 mutable bool mAnomalousNeedRecalc;
00464 mutable bool mThermicNeedRecalc;
00465 mutable bool mScattFactNeedRecalc;
00466 mutable bool mGeomFhklCalcNeedRecalc;
00467 mutable bool mFhklCalcNeedRecalc;
00468
00481 bool mIgnoreImagScattFact;
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516 };
00517
00518 }
00519 #endif