19 #ifndef _OBJCRYST_POWDERPATTERN_H_
20 #define _OBJCRYST_POWDERPATTERN_H_
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"
39 class PowderPatternDiffraction;
57 virtual const string &
GetName()
const;
97 virtual std::map<RefinablePar*,CrystVector_REAL>& GetPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
107 virtual std::map<RefinablePar*,CrystVector_REAL>& GetPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
129 virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
148 virtual void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
206 mutable list<pair<const REAL ,const string > >
mvLabel;
208 mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPattern_FullDeriv;
209 mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPatternIntegrated_FullDeriv;
232 virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
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;
242 CrystVector_uint & groupIndex,
243 unsigned int &firstGroup)
const;
245 const bool enableRestraints=
false);
247 virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
271 virtual void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
272 virtual void CalcPowderPatternIntegrated()
const;
277 void InitRefParList();
279 void InitSpline()
const;
341 virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
355 const REAL fwhmCagliotiW,
356 const REAL fwhmCagliotiU=0,
357 const REAL fwhmCagliotiV=0,
368 virtual void GenHKLFullSpace()
const;
369 virtual void XMLOutput(ostream &os,
int indent=0)
const;
373 CrystVector_uint & groupIndex,
374 unsigned int &firstGroup)
const;
376 const bool enableRestraints=
false);
381 virtual pair<const CrystVector_REAL*,const RefinableObjClock*>
435 virtual void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
436 virtual void CalcPowderPatternIntegrated()
const;
449 virtual void CalcIhkl_FullDeriv(std::set<RefinablePar*> &vPar);
451 virtual void InitOptions();
456 virtual const CrystMatrix_REAL&
GetBMatrix()
const;
459 void PrepareIntegratedProfile()
const;
513 mutable std::map<RefinablePar*,CrystVector_REAL> mIhkl_FullDeriv;
568 void GenHKLFullSpace(
const REAL,
const bool)
const;
635 unsigned long nbPoint);
688 void SetWavelength(
const string &XRayTubeElementName,
const REAL alpha12ratio=0.5);
698 std::map<RefinablePar*,CrystVector_REAL>& GetPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
728 const CrystVector_REAL&
GetChi2Cumul(
const int mode=-1)
const;
839 REAL GetIntegratedR()
const ;
845 REAL GetIntegratedRw()
const;
862 void FitScaleFactorForIntegratedR()
const;
865 void FitScaleFactorForIntegratedRw()
const;
883 const REAL minRelatIobs=1e-3);
893 const bool enableRestraints=
false);
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);
905 virtual void XMLOutput(ostream &os,
int indent=0)
const;
910 CrystVector_uint & groupIndex,
911 unsigned int &firstGroup)
const;
930 REAL
X2XCorr(
const REAL x)
const;
952 REAL
X2Pixel(
const REAL x)
const;
958 REAL
STOL2X(
const REAL stol)
const;
963 REAL
X2STOL(
const REAL x)
const;
970 PeakList FindPeaks(
const float dmin=2.0,
const float maxratio=0.01,
const unsigned int maxpeak=100);
986 void SetMuR(
const REAL muR);
992 void CalcPowderPattern_FullDeriv(std::set<RefinablePar *> &vPar);
995 void CalcPowderPatternIntegrated_FullDeriv(std::set<RefinablePar *> &vPar);
1009 mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPattern_FullDeriv;
1012 mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPatternIntegrated_FullDeriv;
1037 mutable std::map<RefinablePar*,CrystVector_REAL> mPowderPatternUsed_FullDeriv;
1086 REAL m2ThetaDisplacement;
1089 REAL m2ThetaTransparency;
1101 mutable CrystVector_REAL mScaleFactor;
1107 bool mUseFastLessPreciseFunc;
1111 bool mStatisticsExcludeBackground;
1114 mutable CrystVector_int mScalableComponentIndex;
1116 mutable CrystMatrix_REAL mFitScaleFactorM,mFitScaleFactorB,mFitScaleFactorX;
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;
1129 mutable REAL mChi2,mIntegratedChi2;
1134 mutable REAL mChi2LikeNorm,mIntegratedChi2LikeNorm;
1147 mutable unsigned long mNbPointUsed;
1150 mutable unsigned long mNbIntegrationUsed;
1154 #ifdef __WX__CRYST__
1171 CrystVector_REAL PowderProfileGauss (
const CrystVector_REAL theta,
1173 const REAL asymmetryPar=1.);
1177 CrystVector_REAL PowderProfileLorentz(
const CrystVector_REAL theta,
1179 const REAL asymmetryPar=1.);
1190 SPGScore(
const string &s,
const REAL r,
const REAL g,
const unsigned int nbextinct,
const REAL ngof=0,
const unsigned int nbrefl=0);
1203 unsigned int nbextinct446;
1205 unsigned int nbreflused;
1217 class SpaceGroupExplorer
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;
1283 REAL GetP1IntegratedGoF();
1288 CrystVector_REAL mP1IntegratedProfileMin,mP1IntegratedProfileMax;
1290 list<SPGScore> mvSPG;
1292 std::map<std::vector<bool>,
SPGScore> mvSPGExtinctionFingerprint;
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
ReflectionProfileType
Profile type for powder (could it be used fopr single crystals on 2D detectors ?)
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.
const RefParType * gpRefParTypeObjCryst
Top RefParType for the ObjCryst++ library.
Main CIF class - parses the stream and separates data blocks, comments, items, loops.
Crystal class: Unit cell, spacegroup, scatterers.
DiffractionData object for Single Crystal analysis.
Class to store positions of observed reflections.
Cylinder absorption correction.
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...
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 CalcIntensityCorr() const
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...
virtual void CalcIhkl() const
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 CalcPowderReflProfile() const
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.
Profile of a single reflection.
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.
CrystVector_REAL profile
The profile.
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,...
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.
class to input or output a well-formatted xml beginning or ending tag.
class of refinable parameter types.
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Generic Refinable Object.
Abstract base class for all objects in wxCryst.
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.