FOX/ObjCryst++
1.10.X (development)
|
Powder pattern class, with an observed pattern and several calculated components to modelize the pattern. More...
Public Member Functions | |
PowderPattern (const PowderPattern &) | |
virtual const string & | GetClassName () const |
Name for this class ("RefinableObj", "Crystal",...). More... | |
void | AddPowderPatternComponent (PowderPatternComponent &) |
Add a component (phase, backround) to this pattern. More... | |
unsigned int | GetNbPowderPatternComponent () const |
Number of components. | |
const PowderPatternComponent & | GetPowderPatternComponent (const string &name) const |
Access to a component of the powder pattern. | |
const PowderPatternComponent & | GetPowderPatternComponent (const int) const |
Access to a component of the powder pattern. | |
PowderPatternComponent & | GetPowderPatternComponent (const string &name) |
Access to a component of the powder pattern. | |
PowderPatternComponent & | GetPowderPatternComponent (const int) |
Access to a component of the powder pattern. | |
REAL | GetScaleFactor (const int i) const |
Access to the scale factor of components (will be 1 for background components) | |
REAL | GetScaleFactor (const PowderPatternComponent &comp) const |
Access to the scale factor of components (will be 1 for background components) | |
void | SetScaleFactor (const int i, REAL s) |
Access to the scale factor of components (will be 1 for background components) | |
void | SetScaleFactor (const PowderPatternComponent &comp, REAL s) |
Access to the scale factor of components (will be 1 for background components) | |
void | SetPowderPatternPar (const REAL min, const REAL step, unsigned long nbPoint) |
the powder pattern angular range & resolution parameter. More... | |
void | SetPowderPatternX (const CrystVector_REAL &x) |
Set the x coordinate of the powder pattern : either the 2theta or time-of-flight values for each recorded point. More... | |
unsigned long | GetNbPoint () const |
Number of points ? | |
unsigned long | GetNbPointUsed () const |
Number of points actually calculated (below the chosen max(sin(theta)/lambda)) ? | |
const RefinableObjClock & | GetClockNbPointUsed () const |
Clock corresponding to the last time the number of points used was changed. | |
void | SetRadiation (const Radiation &radiation) |
Set the radiation. | |
const Radiation & | GetRadiation () const |
Neutron or x-ray experiment ? | |
Radiation & | GetRadiation () |
Neutron or x-ray experiment ? | |
void | SetRadiationType (const RadiationType radiation) |
Set the radiation type. | |
RadiationType | GetRadiationType () const |
Neutron or x-ray experiment ? | |
void | SetWavelength (const REAL lambda) |
Set the wavelength of the experiment (in Angstroems). More... | |
void | SetWavelength (const string &XRayTubeElementName, const REAL alpha12ratio=0.5) |
Set the wavelength of the experiment to that of an X-Ray tube. More... | |
void | SetEnergy (const REAL energy) |
Set the energy of the experiment [in keV, lambda(A)=12398/E(keV)]. | |
REAL | GetWavelength () const |
wavelength of the experiment (in Angstroems) | |
const CrystVector_REAL & | GetPowderPatternCalc () const |
Get the calculated powder pattern. | |
std::map< RefinablePar *, CrystVector_REAL > & | GetPowderPattern_FullDeriv (std::set< RefinablePar * > &vPar) |
const CrystVector_REAL & | GetPowderPatternObs () const |
Get the observed powder pattern. | |
const CrystVector_REAL & | GetPowderPatternObsSigma () const |
Get the sigma for each point of the observed powder pattern. | |
const CrystVector_REAL & | GetPowderPatternVariance () const |
Get the variance (obs+model) for each point of the powder pattern. | |
const CrystVector_REAL & | GetPowderPatternWeight () const |
Get the weight for each point of the powder pattern. | |
REAL | GetPowderPatternXMin () const |
Get the Minimum 2theta. | |
REAL | GetPowderPatternXStep () const |
Get the average step in 2theta. More... | |
REAL | GetPowderPatternXMax () const |
Get the maximum 2theta. | |
const CrystVector_REAL & | GetPowderPatternX () const |
Get the vector of X (2theta or time-of-flight) coordinates. | |
const CrystVector_REAL & | GetChi2Cumul () const |
Get the powder pattern cumulative Chi^2. More... | |
const RefinableObjClock & | GetClockPowderPatternCalc () const |
Last time the pattern was calculated. | |
const RefinableObjClock & | GetClockPowderPatternPar () const |
When were the pattern parameters (2theta range, step) changed ? | |
const RefinableObjClock & | GetClockPowderPatternRadiation () const |
When were the radiation parameter (radiation type, wavelength) changed ? | |
const RefinableObjClock & | GetClockPowderPatternXCorr () const |
When were the parameters for 2theta/TOF correction (zero, transparency, displacement) last changed ? | |
void | SetXZero (const REAL newZero) |
Change Zero in x (2theta,tof) | |
void | Set2ThetaDisplacement (const REAL displacement) |
Change displacement correction . | |
void | Set2ThetaTransparency (const REAL transparency) |
Change transparency correction . | |
void | ImportPowderPatternFullprof (const string &fullprofFileName) |
Import fullprof-style diffraction data. More... | |
void | ImportPowderPatternPSI_DMC (const string &filename) |
Import powder pattern, format DMC from PSI. | |
void | ImportPowderPatternILL_D1A5 (const string &filename) |
Import powder pattern, format from ILL D1A/D2B (format without counter info) | |
void | ImportPowderPatternXdd (const string &fileName) |
Import *.xdd diffraction data (Topas,...). More... | |
void | ImportPowderPatternSietronicsCPI (const string &fileName) |
Import *.cpi Sietronics diffraction data. More... | |
void | ImportPowderPattern2ThetaObsSigma (const string &fileName, const int nbSkip=0) |
Import file with 3 columns 2Theta Iobs Sigma. More... | |
void | ImportPowderPatternFullprof4 (const string &fileName) |
Import diffraction data from a file, with the first line has 2ThetaMin, step, 2thetaMax, and the following lines alternate 10 Iobs and 10 sigma. More... | |
void | ImportPowderPatternMultiDetectorLLBG42 (const string &fileName) |
diffraction data in a multi-detector format (fullprof format #6). More... | |
void | ImportPowderPattern2ThetaObs (const string &fileName, const int nbSkip=0) |
Import file with 2 columns 2Theta Iobs. More... | |
void | ImportPowderPatternTOF_ISIS_XYSigma (const string &fileName) |
Import TOF file (ISIS type, 3 columns t, Iobs, sigma(Iobs)) More... | |
void | ImportPowderPatternGSAS (const string &fileName) |
Import GSAS standard powder pattern data (see GSAS manual). More... | |
void | ImportPowderPatternCIF (const CIF &cif) |
Import CIF powder pattern data. | |
void | SetPowderPatternObs (const CrystVector_REAL &obs) |
Set observed powder pattern from vector array. More... | |
void | SavePowderPattern (const string &filename="powderPattern.out") const |
Save powder pattern to one file, text format, 3 columns theta Iobs Icalc. More... | |
void | PrintObsCalcData (ostream &os=cout) const |
Print to thee screen/console the observed and calculated pattern (long, mostly useful for debugging) | |
REAL | GetR () const |
Unweighted R-factor. More... | |
REAL | GetIntegratedR () const |
REAL | GetRw () const |
Get the weighted R-factor. More... | |
REAL | GetIntegratedRw () const |
REAL | GetChi2 () const |
Return conventionnal Chi^2. More... | |
REAL | GetIntegratedChi2 () const |
Return integrated Chi^2. More... | |
REAL | GetChi2_Option () const |
Return the conventionnal or integrated Chi^2, depending on the option. | |
void | FitScaleFactorForR () const |
Fit the scale(s) factor of each component to minimize R. More... | |
void | FitScaleFactorForIntegratedR () const |
void | FitScaleFactorForRw () const |
Fit the scale(s) factor of each component to minimize Rw. More... | |
void | FitScaleFactorForIntegratedRw () const |
void | SetSigmaToSqrtIobs () |
Set sigma=sqrt(Iobs) | |
void | SetWeightToInvSigmaSq (const REAL minRelatSigma=1e-3) |
Set w = 1/sigma^2. More... | |
void | SetWeightToUnit () |
Set w = 1. | |
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) More... | |
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, as always, in radians. More... | |
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. More... | |
virtual void | GlobalOptRandomMove (const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst) |
Make a random move of the current configuration. More... | |
virtual REAL | GetLogLikelihood () const |
Get -log(likelihood) of the current configuration for the object. More... | |
virtual unsigned int | GetNbLSQFunction () const |
Number of LSQ functions. | |
virtual const CrystVector_REAL & | GetLSQCalc (const unsigned int) const |
Get the current calculated value for the LSQ function. | |
virtual const CrystVector_REAL & | GetLSQObs (const unsigned int) const |
Get the observed values for the LSQ function. | |
virtual const CrystVector_REAL & | GetLSQWeight (const unsigned int) const |
Get the weight values for the LSQ function. | |
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. More... | |
virtual void | XMLOutput (ostream &os, int indent=0) const |
Output to stream in well-formed XML. More... | |
virtual void | XMLInput (istream &is, const XMLCrystTag &tag) |
Input From stream. More... | |
void | Prepare () |
virtual void | GetGeneGroup (const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const |
Get the gene group assigned to each parameter. More... | |
virtual void | SetMaxSinThetaOvLambda (const REAL max) |
Set the maximum value for sin(theta)/lambda. More... | |
REAL | GetMaxSinThetaOvLambda () const |
Get the maximum value for sin(theta)/lambda. | |
const CrystVector_long & | GetIntegratedProfileMin () const |
Get the list of first pixels for the integration intervals. | |
const CrystVector_long & | GetIntegratedProfileMax () const |
Get the list of last pixels for the integration intervals. | |
const RefinableObjClock & | GetIntegratedProfileLimitsClock () const |
When were the integration intervals last changed ? | |
REAL | X2XCorr (const REAL x) const |
Get the experimental x (2theta, tof) from the theoretical value, taking into account all corrections (zero, transparency,..). More... | |
REAL | X2PixelCorr (const REAL x) const |
Get the pixel number on the experimental pattern, from the theoretical (uncorrected) x coordinate, taking into account all corrections. More... | |
REAL | X2Pixel (const REAL x) const |
Get the pixel number on the experimental pattern, corresponding to a given (experimental) x coordinate. More... | |
REAL | STOL2X (const REAL stol) const |
Convert sin(theta)/lambda to X (i.e. More... | |
REAL | X2STOL (const REAL x) const |
Convert X (either 2theta or TOF) to sin(theta)/lambda, depending on the type of radiation. More... | |
REAL | STOL2Pixel (const REAL stol) const |
Convert sin(theta)/lambda to pixel, depending on the type of radiation. More... | |
PeakList | FindPeaks (const float dmin=2.0, const float maxratio=0.01, const unsigned int maxpeak=100) |
Find peaks in the pattern. | |
const CrystVector_REAL & | GetScaleFactor () const |
Access the scale factors (see PowderPattern::mScaleFactor) | |
CrystVector_REAL & | GetScaleFactor () |
Access the scale factors (see PowderPattern::mScaleFactor) | |
void | ExportFullprof (const std::string &prefix) const |
Export powder pattern & crystal structure in Fullprof format. More... | |
Public Member Functions inherited from ObjCryst::RefinableObj | |
RefinableObj () | |
Constructor. | |
RefinableObj (const bool internalUseOnly) | |
Constructor. More... | |
RefinableObj (const RefinableObj &old) | |
Defined not implemented... More... | |
virtual | ~RefinableObj () |
Destructor. | |
virtual const string & | GetName () const |
Name of the object. | |
virtual void | SetName (const string &name) |
Name of the object. | |
void | operator= (const RefinableObj &old) |
Defined not implemented... More... | |
void | PrepareForRefinement () const |
Find which parameters are used and not fixed, for a refinement /optimization. More... | |
void | FixAllPar () |
Fix All parameters. | |
void | UnFixAllPar () |
UnFix All parameters. | |
void | SetParIsFixed (const long parIndex, const bool fix) |
Fix/un-fix one parameter from its #. | |
void | SetParIsFixed (const string &parName, const bool fix) |
Fix/un-fix one parameter from its name. | |
void | SetParIsFixed (const RefParType *type, const bool fix) |
Fix/un-fix one family of parameters. | |
void | SetParIsUsed (const string &parName, const bool use) |
Set whether a parameter is used. | |
void | SetParIsUsed (const RefParType *type, const bool use) |
Set whether a family of parameters is used. | |
long | GetNbPar () const |
Total number of refinable parameter in the object. More... | |
long | GetNbParNotFixed () const |
Total number of non-fixed parameters. Is initialized by PrepareForRefinement() | |
RefinablePar & | GetPar (const long i) |
Access all parameters in the order they were inputted. | |
const RefinablePar & | GetPar (const long i) const |
Access all parameters in the order they were inputted. | |
RefinablePar & | GetPar (const string &name) |
Access all parameters from their name. | |
const RefinablePar & | GetPar (const string &name) const |
Access all parameters from their name. | |
RefinablePar & | GetPar (const REAL *) |
Access parameter from its adress. | |
const RefinablePar & | GetPar (const REAL *) const |
Access parameter from its adress. | |
RefinablePar & | GetParNotFixed (const long i) |
Access all parameters in the order they were inputted, skipping fixed parameters. More... | |
const RefinablePar & | GetParNotFixed (const long i) const |
Access all parameters in the order they were inputed, skipping fixed parameters. More... | |
void | AddPar (const RefinablePar &newRefPar) |
Add a refinable parameter. More... | |
void | AddPar (RefinablePar *newRefPar) |
Add a refinable parameter. More... | |
void | AddPar (RefinableObj &newRefParList, const bool copyParam=false) |
Add all the parameters in another RefinableObj. More... | |
vector< RefinablePar * >::iterator | RemovePar (RefinablePar *refPar) |
Remove a refinable parameter. More... | |
virtual void | Print () const |
unsigned long | CreateParamSet (const string name="") const |
Save the current set of refined values in a new set. More... | |
void | ClearParamSet (const unsigned long id) const |
Erase the param set with the given id, releasing memory. | |
void | SaveParamSet (const unsigned long id) const |
Save the current set of refined values over a previously-created set of saved values. More... | |
void | RestoreParamSet (const unsigned long id) |
Restore a saved set of values. More... | |
const CrystVector_REAL & | GetParamSet (const unsigned long setId) const |
Access one save refpar set. More... | |
CrystVector_REAL & | GetParamSet (const unsigned long setId) |
Access one save refpar set. More... | |
REAL | GetParamSet_ParNotFixedHumanValue (const unsigned long setId, const long parNumber) const |
Access the (human) value of one refined parameter in a saved set of parameters. More... | |
const void | EraseAllParamSet () |
Erase all saved refpar sets. More... | |
const string & | GetParamSetName (const unsigned long setId) const |
Get the name associated to a refpar set. More... | |
void | SetLimitsAbsolute (const string &parName, const REAL min, const REAL max) |
Change the limits for a given parameter, giving absolute new limits. | |
void | SetLimitsAbsolute (const RefParType *type, const REAL min, const REAL max) |
Change the limits for a category of parameters, giving absolute new limits. | |
void | SetLimitsRelative (const string &parName, const REAL min, const REAL max) |
Change the limits for a given parameter, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max) Thus min should logically be <0 and max >0. More... | |
void | SetLimitsRelative (const RefParType *type, const REAL min, const REAL max) |
Change the limits for a category of parameters, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max). More... | |
void | SetLimitsProportional (const string &parName, const REAL min, const REAL max) |
Change the limits for a given parameter, proportionnaly to the current value. More... | |
void | SetLimitsProportional (const RefParType *type, const REAL min, const REAL max) |
Change the limits for a category of parameters, proportionnaly to their current value. More... | |
void | SetGlobalOptimStep (const RefParType *type, const REAL step) |
Change the maximum step to use during Global Optimization algorithms. | |
ObjRegistry< RefinableObj > & | GetSubObjRegistry () |
Access to the registry of RefinableObj used by this object. | |
const ObjRegistry< RefinableObj > & | GetSubObjRegistry () const |
Access to the registry of RefinableObj used by this object. | |
virtual void | RegisterClient (RefinableObj &) const |
Register a new object using this object. More... | |
virtual void | DeRegisterClient (RefinableObj &) const |
Deregister an object (which not any more) using this object. | |
virtual const ObjRegistry < RefinableObj > & | GetClientRegistry () const |
Get the list of clients. | |
virtual ObjRegistry < RefinableObj > & | GetClientRegistry () |
Get the list of clients. | |
bool | IsBeingRefined () const |
Is the object being refined ? (Can be refined by one algorithm at a time only.) | |
virtual void | EndOptimization () |
This should be called by any optimization class at the end of an optimization. More... | |
virtual void | SetApproximationFlag (const bool allow) |
Enable or disable numerical approximations. More... | |
virtual void | RandomizeConfiguration () |
Randomize Configuration (before a global optimization). More... | |
void | BeginGlobalOptRandomMove () |
Raise a flag, to be sure not to make a random change more than once in each RefinableObj. More... | |
virtual const CrystVector_REAL & | GetLSQDeriv (const unsigned int, RefinablePar &) |
Get the first derivative values for the LSQ function, for a given parameter. More... | |
void | ResetParList () |
Re-init the list of refinable parameters, removing all parameters. More... | |
virtual void | UpdateDisplay () const |
If there is an interface, this should be automatically be called each time there is a 'new, significant' configuration to report. More... | |
unsigned int | GetNbOption () const |
Number of Options for this object. | |
RefObjOpt & | GetOption (const unsigned int i) |
Access to the options. | |
const RefObjOpt & | GetOption (const unsigned int i) const |
const access to the options | |
void | SetDeleteRefParInDestructor (const bool b) |
Set this object not to delete its list of parameters when destroyed. More... | |
const RefinableObjClock & | GetRefParListClock () const |
What was the last time a RefinablePar was added/removed ? More... | |
virtual REAL | GetRestraintCost () const |
Get the restraint cost (overall penalty of all restraints) More... | |
void | AddRestraint (Restraint *pNewRestraint) |
Add a new restraint. More... | |
vector< Restraint * >::iterator | RemoveRestraint (Restraint *pRestraint) |
Remove a restraint from the list of known restraints. More... | |
virtual void | TagNewBestConfig () const |
During a global optimization, tells the object that the current config is the latest "best" config. More... | |
const RefinableObjClock & | GetClockMaster () const |
This clocks records any change in the object. See refinableObj::mClockMaster. | |
Protected Member Functions | |
void | CalcPowderPattern () const |
Calc the powder pattern. | |
void | CalcPowderPattern_FullDeriv (std::set< RefinablePar * > &vPar) |
void | CalcPowderPatternIntegrated () const |
Calc the integrated powder pattern. | |
void | CalcPowderPatternIntegrated_FullDeriv (std::set< RefinablePar * > &vPar) |
virtual void | Init () |
Init parameters and options. | |
void | PrepareIntegratedRfactor () const |
Prepare the calculation of the integrated R-factors. | |
void | CalcNbPointUsed () const |
Calculate the number of points of the pattern actually used, from the maximum value of sin(theta)/lambda. | |
virtual void | InitOptions () |
Initialize options. | |
Number of points actually due to the maximum value of | sin (theta)/lambda.mutable unsigned long mNbPointUsed |
Number of integration intervals actually due to the maximum value of | sin (theta)/lambda.mutable unsigned long mNbIntegrationUsed |
Clock recording the last time the number of points | used (PowderPattern::mNbPointUsed) was changed.mutable RefinableObjClock mClockNbPointUsed |
Protected Member Functions inherited from ObjCryst::RefinableObj | |
long | FindPar (const string &name) const |
Find a refinable parameter with a given name. | |
long | FindPar (const REAL *) const |
Find a refinable parameter from the adress of its value. | |
void | AddSubRefObj (RefinableObj &) |
void | RemoveSubRefObj (RefinableObj &) |
void | AddOption (RefObjOpt *opt) |
map< unsigned long, pair < CrystVector_REAL, string > >::iterator | FindParamSet (unsigned long id) const |
Find a parameter set with a given id (and check if it is there) | |
Protected Attributes | |
CrystVector_REAL | mPowderPatternCalc |
The calculated powder pattern. More... | |
std::map< RefinablePar *, CrystVector_REAL > | mPowderPattern_FullDeriv |
CrystVector_REAL | mPowderPatternIntegratedCalc |
The calculated powder pattern, integrated. | |
std::map< RefinablePar *, CrystVector_REAL > | mPowderPatternIntegrated_FullDeriv |
CrystVector_REAL | mPowderPatternBackgroundCalc |
The calculated powder pattern part which corresponds to 'background' (eg non-scalable components). More... | |
CrystVector_REAL | mPowderPatternBackgroundIntegratedCalc |
The calculated powder pattern part which corresponds to 'background' (eg non-scalable components), integrated. | |
CrystVector_REAL | mPowderPatternObs |
The observed powder pattern. | |
CrystVector_REAL | mPowderPatternObsSigma |
The sigma of the observed pattern. | |
CrystVector_REAL | mPowderPatternWeight |
The weight for each point of the pattern. | |
CrystVector_REAL | mPowderPatternVariance |
The complete variance associated to each point of the powder pattern, taking into account observation and model errors. More... | |
CrystVector_REAL | mPowderPatternVarianceIntegrated |
The complete variance associated to each point of the powder pattern, taking into account observation and model errors. More... | |
CrystVector_REAL | mChi2Cumul |
The cumulative Chi^2 (integrated or not, depending on the option) | |
CrystVector_REAL | mPowderPatternUsedCalc |
The calculated powder pattern. Cropped to the maximum sin(theta)/lambda for LSQ. | |
std::map< RefinablePar *, CrystVector_REAL > | mPowderPatternUsed_FullDeriv |
CrystVector_REAL | mPowderPatternUsedObs |
The calculated powder pattern. Cropped to the maximum sin(theta)/lambda for LSQ. | |
CrystVector_REAL | mPowderPatternUsedWeight |
The weight for each point of the pattern. Cropped to the maximum sin(theta)/lambda for LSQ. | |
CrystVector_REAL | mX |
Vector of x coordinates (either 2theta or time-of-flight) for the pattern. More... | |
bool | mIsXAscending |
Is the mX vector sorted in ascending order ? (true for 2theta, false for TOF) | |
unsigned long | mNbPoint |
Number of points in the pattern. | |
Radiation | mRadiation |
The Radiation corresponding to this experiment. | |
RefinableObjClock | mClockPowderPatternPar |
When were the pattern parameters (2theta or time-of-flight range) changed ? | |
RefinableObjClock | mClockPowderPatternRadiation |
When were the radiation parameter (radiation type, wavelength) changed ? | |
RefinableObjClock | mClockPowderPatternCalc |
When was the powder pattern last computed ? | |
RefinableObjClock | mClockPowderPatternIntegratedCalc |
When was the powder pattern (integrated) last computed ? | |
RefinableObjClock | mClockPowderPatternXCorr |
Corrections to 2Theta. | |
RefinableObjClock | mClockScaleFactor |
Last modification of the scale factor. | |
CrystVector_REAL | mExcludedRegionMinX |
Min coordinate for for all excluded regions. | |
CrystVector_REAL | mExcludedRegionMaxX |
Max coordinate for 2theta for all excluded regions. | |
REAL | mXZero |
Zero correction : Thus mPowderPattern2ThetaMin=(mPowderPattern2ThetaMin-m2ThetaZero) | |
REAL | mMaxSinThetaOvLambda |
Displacement correction : REAL m2ThetaDisplacement; Transparency correction : REAL m2ThetaTransparency; Time Of Flight (TOF) parameters : REAL mDIFC,mDIFA; Components of the powder pattern The components (crystalline phases, background,...) of the powder pattern ObjRegistry<PowderPatternComponent> mPowderPatternComponentRegistry; The scale factors for each component. More... | |
Number of points actually | used |
Number of integration intervals actually | used |
Protected Attributes inherited from ObjCryst::RefinableObj | |
string | mName |
Name for this RefinableObject. Should be unique, at least in the same scope.+. | |
vector< RefinablePar * > | mvpRefPar |
Vector of pointers to the refinable parameters. | |
vector< Restraint * > | mvpRestraint |
Vector of pointers to the restraints for this object. More... | |
map< unsigned long, pair < CrystVector_REAL, string > > | mvpSavedValuesSet |
Map of (index,pointers to arrays) used to save sets of values for all parameters. More... | |
long | mNbRefParNotFixed |
Total of not-fixed parameters. | |
CrystVector_long | mRefparNotFixedIndex |
Index of not-fixed parameters. | |
int | mOptimizationDepth |
Is the object being refined or optimized ? if mOptimizationDepth=0, no optimization is taking place. More... | |
ObjRegistry< RefinableObj > | mSubObjRegistry |
Registry of RefinableObject needed for this object (owned by this object or not) | |
ObjRegistry< RefinableObj > | mClientObjRegistry |
Registry of RefinableObject using this object. More... | |
ObjRegistry< RefObjOpt > | mOptionRegistry |
List of options for this object. More... | |
bool | mDeleteRefParInDestructor |
If true (the default), then all RefinablePar will be deleted when the the object is deleted. More... | |
RefinableObjClock | mRefParListClock |
Last time the RefinableParList was modified (a parameter added or removed). | |
bool | mRandomMoveIsDone |
CrystVector_REAL | mLSQDeriv |
Temporary array used to return derivative values of the LSQ function for given parameters. More... | |
std::map< unsigned int, std::map< RefinablePar *, CrystVector_REAL > > | mLSQ_FullDeriv |
Temporary map to return the derivative of the LSQ function versus a list of parameters. More... | |
RefinableObjClock | mClockMaster |
Master clock, which is changed whenever the object has been altered. More... | |
Powder pattern class, with an observed pattern and several calculated components to modelize the pattern.
This can also be used for simulation, using a fake Iobs. Supports multiple phases.
Definition at line 534 of file PowderPattern.h.
void ObjCryst::PowderPattern::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, as always, in radians.
Does not work yet with integrated R factors. Note that the pattern is still computed in these regions. They are only ignored by statistics functions (R, Rws).
Definition at line 5062 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::AddPowderPatternComponent | ( | PowderPatternComponent & | comp | ) |
Add a component (phase, backround) to this pattern.
It must have been allocated in the heap. The pattern parameters (2theta min, step, nbpoints, wavelength, radiation type) of the component are automatically changed to that of the PowderPattern object.
Definition at line 2430 of file PowderPattern.cpp.
|
virtual |
This should be called by any optimization class at the begining of an optimization.
This will also check that everything is ready, eg call the RefinableObj::Prepare() function. This also affects all sub-objects.
allowApproximations | if true, then the object can use faster but less precise functions during the optimization. This is useful for global optimization not using derivatives. |
enableRestraints | xrefitem deprecated 28. |
Reimplemented from ObjCryst::RefinableObj.
Definition at line 5038 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ExportFullprof | ( | const std::string & | prefix | ) | const |
Export powder pattern & crystal structure in Fullprof format.
This will create two files - the .pcr file (including the crystal structure and all pattern parameters), and the .dat file with the powder pattern, written using the "Ins=10" file format.
prefix | the prefix used to output the two files, 'prefix'.pcr and 'prefix'.dat |
Definition at line 5500 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::FitScaleFactorForR | ( | ) | const |
Fit the scale(s) factor of each component to minimize R.
min is the beginning of the excluded region
min is the beginning of the excluded region
min is the beginning of the excluded region
Definition at line 4245 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::FitScaleFactorForRw | ( | ) | const |
Fit the scale(s) factor of each component to minimize Rw.
min is the beginning of the excluded region
min is the beginning of the excluded region
min is the beginning of the excluded region
Definition at line 4561 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::GetChi2 | ( | ) | const |
Return conventionnal Chi^2.
min is the beginning of the excluded region !
Definition at line 4106 of file PowderPattern.cpp.
const CrystVector_REAL & ObjCryst::PowderPattern::GetChi2Cumul | ( | ) | const |
Get the powder pattern cumulative Chi^2.
Depending on the chosen option, it will be calculated in an integrated manner or not.
The vector is recomputed on every call, so this is slow.
Definition at line 2634 of file PowderPattern.cpp.
|
virtual |
Name for this class ("RefinableObj", "Crystal",...).
This is only useful to distinguish different classes when picking up objects from the RefinableObj Global Registry
Reimplemented from ObjCryst::RefinableObj.
Definition at line 2424 of file PowderPattern.cpp.
|
virtual |
Get the gene group assigned to each parameter.
Each parameter (a gene in terms of genetic algorithms) can be assigned to a gene group. Thus when mating two configurations, genes will be exchanged by groups. By default (in the base RefinabeObj class), each parameter is alone in its group. Derived classes can group genes for a better s** life.
The number identifying a gene group only has a meaning in a given object. It can also change on subsequent calls, and thus is not unique.
obj | the , supplied by an algorithm class (OptimizationObj,..), which contains a list of parameters, some of which (but possibly all or none) are parameters belonging to this object. |
groupIndex | a vector of unsigned integers, one for each parameter in the input object, giving an unsigned integer value as gene group index. At the beginning this vector should contain only zeros (no group assigned). |
firstGroup | this is the number of groups which have already been assigned, plus one. The gene groups returned by this object will start from this value, and increment firstGroup for each gene group used, so that different RefinableObj cannot share a gene group. |
Reimplemented from ObjCryst::RefinableObj.
Definition at line 5213 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::GetIntegratedChi2 | ( | ) | const |
Return integrated Chi^2.
Definition at line 4185 of file PowderPattern.cpp.
|
virtual |
Get -log(likelihood) of the current configuration for the object.
By default (no likelihood evaluation available), this is equal to 0.
This call should not be recursive, it is the task of the algorithm to get the sum of likelihoods for all objects invlolved.
Reimplemented from ObjCryst::RefinableObj.
Definition at line 5094 of file PowderPattern.cpp.
|
virtual |
Get the first derivative for the LSQ function for each parameter supplied in a list.
Reimplemented from ObjCryst::RefinableObj.
Definition at line 5174 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::GetPowderPatternXStep | ( | ) | const |
Get the average step in 2theta.
Definition at line 2617 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::GetR | ( | ) | const |
Unweighted R-factor.
min is the beginning of the excluded region !
min is the beginning of the excluded region !
Definition at line 3710 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::GetRw | ( | ) | const |
Get the weighted R-factor.
min is the beginning of the excluded region !
min is the beginning of the excluded region !
Definition at line 3903 of file PowderPattern.cpp.
|
virtual |
Make a random move of the current configuration.
This is for global optimization algorithms. the moves for each parameter are less than their global optimization step, multiplied by the mutation amplitude.
mutationAmplitude | multiplier for the maximum move amplitude, for all parameters |
type | restrain the change exclusively to parameters of a given type (same type or descendant from this RefParType). |
Reimplemented from ObjCryst::RefinableObj.
Definition at line 5055 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPattern2ThetaObs | ( | const string & | fileName, |
const int | nbSkip = 0 |
||
) |
Import file with 2 columns 2Theta Iobs.
fileName | the filename (surprise!) |
nbSkip | the number of lines to skip at the beginning of the file (default=0) |
Definition at line 3109 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPattern2ThetaObsSigma | ( | const string & | fileName, |
const int | nbSkip = 0 |
||
) |
Import file with 3 columns 2Theta Iobs Sigma.
fileName | the filename (surprise!) |
nbSkip | the number of lines to skip at the beginning of the file (default=0) |
Definition at line 3049 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternFullprof | ( | const string & | fullprofFileName | ) |
Import fullprof-style diffraction data.
fullprofFileName | filename |
Definition at line 2820 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternFullprof4 | ( | const string & | fileName | ) |
Import diffraction data from a file, with the first line has 2ThetaMin, step, 2thetaMax, and the following lines alternate 10 Iobs and 10 sigma.
Ends with null entries (to fill last Iobs line to reach last sigme line).
That's fullprof format #4.
fileName | filename |
Definition at line 3249 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternGSAS | ( | const string & | fileName | ) |
Import GSAS standard powder pattern data (see GSAS manual).
Definition at line 3389 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternMultiDetectorLLBG42 | ( | const string & | fileName | ) |
diffraction data in a multi-detector format (fullprof format #6).
First line is text. Third entry of second line is the 2theta step. Third line has the 2thetamin, fourth line has monitors and temperatures. Then each line has ten pairs (I2,I8)of NbCounters,intensity. Ends with negative entries.
fileName | filename |
Definition at line 3167 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternSietronicsCPI | ( | const string & | fileName | ) |
Import *.cpi Sietronics diffraction data.
fileName | filename |
Definition at line 3001 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternTOF_ISIS_XYSigma | ( | const string & | fileName | ) |
Import TOF file (ISIS type, 3 columns t, Iobs, sigma(Iobs))
fileName | the filename |
Definition at line 3312 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::ImportPowderPatternXdd | ( | const string & | fileName | ) |
Import *.xdd diffraction data (Topas,...).
fileName | filename |
Definition at line 2958 of file PowderPattern.cpp.
|
virtual |
Prepare everything (if necessary) for an optimization/calculation.
Reimplemented from ObjCryst::RefinableObj.
Definition at line 5204 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SavePowderPattern | ( | const string & | filename = "powderPattern.out" | ) | const |
Save powder pattern to one file, text format, 3 columns theta Iobs Icalc.
If Iobs is missing, the column is omitted.
Definition at line 3675 of file PowderPattern.cpp.
|
virtual |
Set the maximum value for sin(theta)/lambda.
All data (reflections,..) still exist but are ignored for all calculations.
Definition at line 5238 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SetPowderPatternObs | ( | const CrystVector_REAL & | obs | ) |
Set observed powder pattern from vector array.
Note: powder pattern parameters must have been set before calling this function, for example by calling DiffractionDataPowder::InitPowderPatternPar().
Definition at line 3650 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SetPowderPatternPar | ( | const REAL | min, |
const REAL | step, | ||
unsigned long | nbPoint | ||
) |
the powder pattern angular range & resolution parameter.
this will affect all components (phases) of the pattern.
Use this with caution, as the number of points must be correct with respect to the observed data (Iobs).
min | min 2theta (in radians) or time-of-flight (in microseconds) value, |
step | step (assumed constant) in 2theta or time-of-flight (in microseconds). |
nbPoints | number of points in the pattern. |
Definition at line 2513 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SetPowderPatternX | ( | const CrystVector_REAL & | x | ) |
Set the x coordinate of the powder pattern : either the 2theta or time-of-flight values for each recorded point.
The step need not be constant, but the variation must be strictly monotonous.
2theta must be in radians and time-of-flight in microseconds
Definition at line 2526 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SetWavelength | ( | const REAL | lambda | ) |
Set the wavelength of the experiment (in Angstroems).
Definition at line 2564 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SetWavelength | ( | const string & | XRayTubeElementName, |
const REAL | alpha12ratio = 0.5 |
||
) |
Set the wavelength of the experiment to that of an X-Ray tube.
XRayTubeElementName | : name of the anticathode element name. Known ones are Cr, Fe, Cu, Mo, Ag. |
alpha2Alpha2ratio | Kalpha2/Kalpha1 ratio (0.5 by default) |
Alpha1 and alpha2 wavelength are taken from R. Grosse-Kunstleve package, and the average wavelength is calculated using the alpha2/alpha1 weight. All structure factors computation are made using the average wavelength, and for powder diffraction, profiles are output at the alpha1 and alpha2 ratio for the calculated pattern.
NOTE : if the name of the wavelength is generic (eg"Cu"), then the program considers that there are both Alpha1 and Alpha2, and thus automatically changes the WavelengthType to WAVELENGTH_ALPHA12. If instead either alpha1 or alpha2 (eg "CuA1") is asked for, the WavelengthType is set to WAVELENGTH_MONOCHROMATIC. In both cases, the radiation type is set to X-Ray.
Definition at line 2570 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::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)
To filter too small or null intensities: if Iobs < [minRelatIobs * max(Iobs)], then use Iobs=minRelatIobs * max(Iobs) to compute the weight.
Typical values: a=2*min(Iobs) b=2/max(Iobs) c=0
Definition at line 5022 of file PowderPattern.cpp.
void ObjCryst::PowderPattern::SetWeightToInvSigmaSq | ( | const REAL | minRelatSigma = 1e-3 | ) |
Set w = 1/sigma^2.
To filter too small or null intensities :If sigma< minRelatSigma* max(sigma), then w=1/(minRelatSigma* max(sigma))^2
Definition at line 5002 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::STOL2Pixel | ( | const REAL | stol | ) | const |
Convert sin(theta)/lambda to pixel, depending on the type of radiation.
This does not take into account any zero/transparency, etc... correction
Definition at line 5295 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::STOL2X | ( | const REAL | stol | ) | const |
Convert sin(theta)/lambda to X (i.e.
either to 2theta or to TOF), depending on the type of radiation.
This does not take into account any zero/transparency, etc... correction
Definition at line 5259 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::X2Pixel | ( | const REAL | x | ) | const |
Get the pixel number on the experimental pattern, corresponding to a given (experimental) x coordinate.
x | the x (2theta, tof) value. |
Definition at line 2735 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::X2PixelCorr | ( | const REAL | x | ) | const |
Get the pixel number on the experimental pattern, from the theoretical (uncorrected) x coordinate, taking into account all corrections.
(zero, transparency,..).
x | the theoretical x (2theta, tof) value. |
Definition at line 2730 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::X2STOL | ( | const REAL | x | ) | const |
Convert X (either 2theta or TOF) to sin(theta)/lambda, depending on the type of radiation.
This does not take into account any zero/transparency, etc... correction
Definition at line 5276 of file PowderPattern.cpp.
REAL ObjCryst::PowderPattern::X2XCorr | ( | const REAL | x | ) | const |
Get the experimental x (2theta, tof) from the theoretical value, taking into account all corrections (zero, transparency,..).
ttheta | the theoretical x (2theta, tof) value. |
Definition at line 2720 of file PowderPattern.cpp.
|
virtual |
Input From stream.
Reimplemented from ObjCryst::RefinableObj.
Definition at line 2084 of file ObjCryst/IO.cpp.
|
virtual |
Output to stream in well-formed XML.
Reimplemented from ObjCryst::RefinableObj.
Definition at line 1977 of file ObjCryst/IO.cpp.
|
protected |
Displacement correction : REAL m2ThetaDisplacement; Transparency correction : REAL m2ThetaTransparency; Time Of Flight (TOF) parameters : REAL mDIFC,mDIFA; Components of the powder pattern The components (crystalline phases, background,...) of the powder pattern ObjRegistry<PowderPatternComponent> mPowderPatternComponentRegistry; The scale factors for each component.
For unscalable phases, this is set to 1 (constant).
This is mutable because generally we use the 'best' scale factor, but it should not be... mutable CrystVector_REAL mScaleFactor;
Use faster, less precise functions ? bool mUseFastLessPreciseFunc;
For statistics Should Statistics (R, Rw,..) exclude the background ? bool mStatisticsExcludeBackground;
To compute scale factors, which are the components (phases) that can be scaled ? mutable CrystVector_int mScalableComponentIndex;
Used to fit the components' scale factors mutable CrystMatrix_REAL mFitScaleFactorM,mFitScaleFactorB,mFitScaleFactorX;
Use Integrated profiles for Chi^2, R, Rwp... RefObjOpt mOptProfileIntegration;
Integrated R-factors mutable CrystVector_long mIntegratedPatternMin,mIntegratedPatternMax; mutable CrystVector_REAL mIntegratedObs; mutable CrystVector_REAL mIntegratedWeight; mutable CrystVector_REAL mIntegratedWeightObs; mutable CrystVector_REAL mIntegratedVarianceObs; mutable RefinableObjClock mClockIntegratedFactorsPrep; Statistical indicators mutable REAL mChi2,mIntegratedChi2; This is the logarithm of the part of log(Likelihood) which corresponds to the normalization terms of gaussian distribution for each obs/calc point. In practice, this is the sum of 1/2*log(2pi*sig(i)^2), although we discard the 2pi terms. mutable REAL mChi2LikeNorm,mIntegratedChi2LikeNorm; mutable REAL mR; mutable REAL mRw; Clock the last time Chi^2 was computed mutable RefinableObjClock mClockChi2,mClockIntegratedChi2; /** Maximum sin(theta)/lambda for all calculations (10 by default).
This keeps all data in memory, but only the part which is below the max is calculated.
Definition at line 1079 of file PowderPattern.h.
|
mutableprotected |
The calculated powder pattern part which corresponds to 'background' (eg non-scalable components).
It is already included in mPowderPatternCalc
Definition at line 955 of file PowderPattern.h.
|
mutableprotected |
The calculated powder pattern.
It is mutable since it is completely defined by other parameters (eg it is not an 'independent parameter')
Definition at line 948 of file PowderPattern.h.
|
mutableprotected |
The complete variance associated to each point of the powder pattern, taking into account observation and model errors.
Definition at line 967 of file PowderPattern.h.
|
mutableprotected |
The complete variance associated to each point of the powder pattern, taking into account observation and model errors.
Integrated.
Definition at line 970 of file PowderPattern.h.
|
protected |
Vector of x coordinates (either 2theta or time-of-flight) for the pattern.
Stored in ascending order for 2theta, and descending for TOF, i.e. always in ascending order for the corresponding sin(theta)/lambda.
Definition at line 988 of file PowderPattern.h.