FOX/ObjCryst++  1.10.X (development)
ObjCryst::PowderPatternDiffraction Class Reference

Class to compute the contribution to a powder pattern from a crystalline phase. More...

+ Inheritance diagram for ObjCryst::PowderPatternDiffraction:
+ Collaboration diagram for ObjCryst::PowderPatternDiffraction:

Classes

struct  ReflProfile
 Profile of a single reflection. More...
 

Public Member Functions

 PowderPatternDiffraction (const PowderPatternDiffraction &)
 
virtual PowderPatternDiffractionCreateCopy () const
 So-called virtual copy constructor.
 
virtual const string & GetClassName () const
 Name for this class ("RefinableObj", "Crystal",...). More...
 
virtual void SetParentPowderPattern (PowderPattern &)
 Set the PowderPattern object which uses this component. More...
 
virtual const CrystVector_REAL & GetPowderPatternCalc () const
 Get the calculated powder pattern for this component. More...
 
virtual pair< const
CrystVector_REAL *, const
RefinableObjClock * > 
GetPowderPatternIntegratedCalc () const
 Get the integrated values of the powder pattern. More...
 
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. More...
 
void SetProfile (ReflectionProfile *prof)
 Assign a new profile. More...
 
const ReflectionProfileGetProfile () const
 Get reflection profile.
 
ReflectionProfileGetProfile ()
 Get reflection profile.
 
virtual void GenHKLFullSpace ()
 
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...
 
virtual void GetGeneGroup (const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
 Get the gene group assigned to each parameter. 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 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 const RadiationGetRadiation () const
 Get the radiation object for this data.
 
virtual const CrystVector_REAL & GetPowderPatternCalcVariance () const
 Get the variance associated to each point of the calculated powder pattern, for this component. More...
 
virtual pair< const
CrystVector_REAL *, const
RefinableObjClock * > 
GetPowderPatternIntegratedCalcVariance () const
 Get the variance associated to each point of the calculated powder pattern, for this component (integrated version). More...
 
virtual bool HasPowderPatternCalcVariance () const
 Does this component have a variance associated with each calculated point ? i.e., do we use maximum likelihood to take into account incomplete models ?
 
virtual void SetCrystal (Crystal &crystal)
 Set the crystal for this experiment. More...
 
void SetExtractionMode (const bool extract=true, const bool init=false)
 Prepare intensity extraction (Le Bail or Pawley) More...
 
bool GetExtractionMode () const
 Return true if in extraction mode, i.e. using extracted intensities instead of computed structure factors.
 
void ExtractLeBail (unsigned int nbcycle=1)
 Extract intensities using Le Bail method. More...
 
virtual long GetNbReflBelowMaxSinThetaOvLambda () const
 Recalc, and get the number of reflections which should be actually used, due to the maximuml sin(theta)/lambda value set. More...
 
void SetFrozenLatticePar (const unsigned int i, REAL v)
 Change one parameter in mFrozenLatticePar. This triggers a call to CalcLocalBMatrix() if the parameter has changed.
 
REAL GetFrozenLatticePar (const unsigned int i) const
 Access to one parameter in mFrozenLatticePar.
 
void FreezeLatticePar (const bool use)
 Set the use local cell parameters ? (see mFrozenLatticePar) If this changes mUseLocalLatticePar from false to true, this triggers a copy of the Crystal's lattice parameters into mFrozenLatticePar.
 
bool FreezeLatticePar () const
 Do we use local cell parameters ? (see mFrozenLatticePar)
 
- Public Member Functions inherited from ObjCryst::PowderPatternComponent
 PowderPatternComponent (const PowderPatternComponent &)
 
const PowderPatternGetParentPowderPattern () const
 Get the PowderPattern object which uses this component. More...
 
PowderPatternGetParentPowderPattern ()
 Get the PowderPattern object which uses this component. More...
 
virtual std::map< RefinablePar
*, CrystVector_REAL > & 
GetPowderPattern_FullDeriv (std::set< RefinablePar * > &vPar)
 
virtual std::map< RefinablePar
*, CrystVector_REAL > & 
GetPowderPatternIntegrated_FullDeriv (std::set< RefinablePar * > &vPar)
 
bool IsScalable () const
 Is this component scalable ? More...
 
const RefinableObjClockGetClockPowderPatternCalc () const
 Last time the powder pattern was calculated.
 
const list< pair< const REAL,const
string > > & 
GetPatternLabelList () const
 Get a list of labels for the pattern (usually reflection indexes). 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()
 
RefinableParGetPar (const long i)
 Access all parameters in the order they were inputted.
 
const RefinableParGetPar (const long i) const
 Access all parameters in the order they were inputted.
 
RefinableParGetPar (const string &name)
 Access all parameters from their name.
 
const RefinableParGetPar (const string &name) const
 Access all parameters from their name.
 
RefinableParGetPar (const REAL *)
 Access parameter from its adress.
 
const RefinableParGetPar (const REAL *) const
 Access parameter from its adress.
 
RefinableParGetParNotFixed (const long i)
 Access all parameters in the order they were inputted, skipping fixed parameters. More...
 
const RefinableParGetParNotFixed (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 RandomizeConfiguration ()
 Randomize Configuration (before a global optimization). More...
 
virtual void GlobalOptRandomMove (const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
 Make a random move of the current configuration. More...
 
void BeginGlobalOptRandomMove ()
 Raise a flag, to be sure not to make a random change more than once in each RefinableObj. 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 const CrystVector_REAL & GetLSQDeriv (const unsigned int, RefinablePar &)
 Get the first derivative values for the LSQ function, for a given parameter. More...
 
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...
 
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.
 
RefObjOptGetOption (const unsigned int i)
 Access to the options.
 
const RefObjOptGetOption (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 RefinableObjClockGetRefParListClock () 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 RefinableObjClockGetClockMaster () const
 This clocks records any change in the object. See refinableObj::mClockMaster.
 
- Public Member Functions inherited from ObjCryst::ScatteringData
 ScatteringData (const ScatteringData &old)
 
virtual void SetHKL (const CrystVector_REAL &h, const CrystVector_REAL &k, const CrystVector_REAL &l)
 input H,K,L More...
 
virtual void GenHKLFullSpace2 (const REAL maxsithsl, const bool unique=false)
 Generate a list of h,k,l to describe a full reciprocal space, up to a given maximum theta value. More...
 
RadiationType GetRadiationType () const
 Neutron or x-ray experiment ? Wavelength ?
 
const CrystalGetCrystal () const
 Const access to the data's crystal.
 
CrystalGetCrystal ()
 Access to the data's crystal.
 
bool HasCrystal () const
 Has a Crystal structure associated yet ?
 
long GetNbRefl () const
 Return the number of reflections in this experiment.
 
const CrystVector_REAL & GetH () const
 Return the 1D array of H coordinates for all reflections.
 
const CrystVector_REAL & GetK () const
 Return the 1D array of K coordinates for all reflections.
 
const CrystVector_REAL & GetL () const
 Return the 1D array of L coordinates for all reflections.
 
const CrystVector_REAL & GetH2Pi () const
 Return the 1D array of H coordinates for all reflections, multiplied by 2*pi. More...
 
const CrystVector_REAL & GetK2Pi () const
 Return the 1D array of K coordinates for all reflections, multiplied by 2*pi. More...
 
const CrystVector_REAL & GetL2Pi () const
 Return the 1D array of L coordinates for all reflections, multiplied by 2*pi. More...
 
const CrystVector_REAL & GetReflX () const
 Return the 1D array of orthonormal x coordinates for all reflections (recipr. space)
 
const CrystVector_REAL & GetReflY () const
 Return the 1D array of orthonormal y coordinates for all reflections (recipr. space)
 
const CrystVector_REAL & GetReflZ () const
 Return the 1D array of orthonormal z coordinates for all reflections (recipr. space)
 
const CrystVector_REAL & GetSinThetaOverLambda () const
 Return an array with $ \frac{sin(\theta)}{\lambda} = \frac{1}{2d_{hkl}}$ for all reflections.
 
const CrystVector_REAL & GetTheta () const
 Return an array with theta values for all reflections.
 
const RefinableObjClockGetClockTheta () const
 Clock the last time the sin(theta)/lambda and theta arrays were re-computed.
 
const CrystVector_REAL & GetFhklCalcSq () const
 Returns the Array of calculated |F(hkl)|^2 for all reflections.
 
std::map< RefinablePar
*, CrystVector_REAL > & 
GetFhklCalcSq_FullDeriv (std::set< RefinablePar * > &vPar)
 
const CrystVector_REAL & GetFhklCalcReal () const
 Access to real part of F(hkl)calc.
 
const CrystVector_REAL & GetFhklCalcImag () const
 Access to imaginary part of F(hkl)calc.
 
const CrystVector_REAL & GetFhklObsSq () const
 Returns the Array of observed |F(hkl)|^2 for all reflections.
 
const map< const
ScatteringPower
*, CrystVector_REAL > & 
GetScatteringFactor () const
 Scattering factors for each ScatteringPower, as vectors with NbRefl elements.
 
CrystVector_REAL GetWavelength () const
 wavelength of the experiment (in Angstroems)
 
void SetIsIgnoringImagScattFact (const bool b)
 If true, then the imaginary part of the scattering factor is ignored during Structure factor computation. More...
 
bool IsIgnoringImagScattFact () const
 If true, then the imaginary part of the scattering factor is ignored during Structure factor computation. More...
 
virtual void PrintFhklCalc (ostream &os=cout) const
 Print H, K, L F^2 Re(F) Im(F) theta sin(theta)/lambda for all reflections. More...
 
virtual void PrintFhklCalcDetail (ostream &os=cout) const
 Print H, K, L sin(theta)/lambda theta F^2 Re(F) Im(F) [Re(F) Im(F)]_i, where [Re(F) Im(F)]_i are the real and imaginary contribution of the different scattering powers to the overall structure factor.
 
REAL GetMaxSinThetaOvLambda () const
 Get the maximum value for sin(theta)/lambda.
 
const RefinableObjClockGetClockNbReflBelowMaxSinThetaOvLambda () const
 Clock the last time the number of reflections used was changed.
 

Protected Member Functions

virtual void CalcPowderPattern () const
 Calc the powder pattern. More...
 
virtual void CalcPowderPattern_FullDeriv (std::set< RefinablePar * > &vPar)
 
virtual void CalcPowderPatternIntegrated () const
 
virtual void CalcPowderPatternIntegrated_FullDeriv (std::set< RefinablePar * > &vPar)
 Calc the integrated powder pattern. More...
 
void CalcPowderReflProfile () const
 
void CalcPowderReflProfile_FullDeriv (std::set< RefinablePar * > &vPar)
 
void CalcIntensityCorr () const
 
virtual void CalcIhkl () const
 
virtual void CalcIhkl_FullDeriv (std::set< RefinablePar * > &vPar)
 
virtual void Prepare ()
 
virtual void InitOptions ()
 
virtual const CrystVector_long & GetBraggLimits () const
 Get the pixel positions separating the integration intervals around reflections. More...
 
virtual void SetMaxSinThetaOvLambda (const REAL max)
 Set the maximum value for sin(theta)/lambda. More...
 
virtual const CrystMatrix_REAL & GetBMatrix () const
 This can use either locally stored lattice parameters from mLocalLatticePar, or the Crystal's, depending on mUseLocalLatticePar. More...
 
void CalcFrozenBMatrix () const
 Calculate the local BMatrix, used if mFreezeLatticePar is true.
 
void PrepareIntegratedProfile () const
 
- Protected Member Functions inherited from ObjCryst::PowderPatternComponent
const RefinableObjClockGetClockPowderPatternCalcVariance () const
 Last time the variance on the pattern was actually calculated.
 
const RefinableObjClockGetClockBraggLimits () const
 Get last time the Bragg Limits were changed.
 
- 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 Member Functions inherited from ObjCryst::ScatteringData
virtual void PrepareHKLarrays ()
 
virtual CrystVector_long SortReflectionBySinThetaOverLambda (const REAL maxSTOL=-1.)
 
CrystVector_long EliminateExtinctReflections ()
 
virtual void CalcSinThetaLambda () const
 
REAL CalcSinThetaLambda (REAL h, REAL k, REAL l) const
 Calculate sin(theta)/lambda for a single reflection.
 
void CalcScattFactor () const
 
void CalcTemperatureFactor () const
 
virtual void CalcResonantScattFactor () const
 
void CalcGlobalTemperatureFactor () const
 Compute the overall temperature factor affecting all reflections.
 
void CalcStructFactor () const
 Compute the overall structure factor (real and imaginary part). More...
 
void CalcStructFactor_FullDeriv (std::set< RefinablePar * > &vPar)
 
void CalcGeomStructFactor () const
 Compute the 'Geometrical Structure Factor' for each ScatteringPower of the Crystal. More...
 
void CalcGeomStructFactor_FullDeriv (std::set< RefinablePar * > &vPar)
 
void CalcLuzzatiFactor () const
 Calculate the Luzzati factor associated to each ScatteringPower and each reflection, for maximum likelihood optimization.
 
void CalcStructFactVariance () const
 Calculate the variance associated to the calculated structure factor. More...
 

Protected Attributes

RefinableObjClock mClockProfilePar
 Last time the reflection parameters were changed.
 
RefinableObjClock mClockLorentzPolarSlitCorrPar
 Last time the Lorentz-Polarization and slit parameters were changed.
 
RefinableObjClock mClockIntensityCorr
 Last time the Lorentz-Polar-Slit correction was computed.
 
RefinableObjClock mClockProfileCalc
 Last time the reflection profiles were computed.
 
RefinableObjClock mClockIhklCalc
 Last time intensities were computed.
 
ReflectionProfilempReflectionProfile
 Profile.
 
CrystVector_REAL mIntensityCorr
 Calculated corrections for all reflections. More...
 
LorentzCorr mCorrLorentz
 Lorentz correction.
 
PolarizationCorr mCorrPolar
 Polarization correction.
 
PowderSlitApertureCorr mCorrSlitAperture
 Slit aperture correction.
 
TextureMarchDollase mCorrTextureMarchDollase
 Preferred orientation (texture) correction following the March-Dollase model.
 
TextureEllipsoid mCorrTextureEllipsoid
 Preferred orientation (texture) correction following the Ellipsoidal function.
 
TOFCorr mCorrTOF
 Time-Of-Flight intensity correction.
 
CrystVector_REAL mIhklCalc
 Computed intensities for all reflections.
 
std::map< RefinablePar
*, CrystVector_REAL > 
mIhkl_FullDeriv
 
CrystVector_REAL mIhklCalcVariance
 Variance on computed intensities for all reflections.
 
vector< ReflProfilemvReflProfile
 Reflection profiles for ALL reflections during the last powder pattern generation.
 
std::map< RefinablePar
*, vector< CrystVector_REAL > > 
mvReflProfile_FullDeriv
 Derivatives of reflection profiles versus a list of parameters. More...
 
vector< pair< unsigned long,
CrystVector_REAL > > 
mIntegratedProfileFactor
 For each reflection, store the integrated value of the normalized profile over all integration intervals. More...
 
RefinableObjClock mClockIntegratedProfileFactor
 Last time the integrated values of normalized profiles was calculated.
 
bool mExtractionMode
 Extraction mode (Le Bail, Pawley)
 
DiffractionDataSingleCrystalmpLeBailData
 Single crystal data extracted from the powder pattern.
 
CrystVector_REAL mFrozenLatticePar
 a,b and c in Angstroems, angles (stored) in radians This is used to override lattice parameter from the Crystal structure, e.g. More...
 
bool mFreezeLatticePar
 If true, use local cell parameters from mFrozenLatticePar rather than the Crystal.
 
CrystMatrix_REAL mFrozenBMatrix
 Local B Matrix, used if mFreezeLatticePar is true.
 
- Protected Attributes inherited from ObjCryst::PowderPatternComponent
CrystVector_REAL mPowderPatternCalc
 The calculated component of a powder pattern. More...
 
CrystVector_REAL mPowderPatternIntegratedCalc
 The calculated powder pattern, integrated.
 
CrystVector_REAL mPowderPatternCalcVariance
 The variance associated to each point of the calculated powder pattern.
 
CrystVector_REAL mPowderPatternIntegratedCalcVariance
 The variance associated to each point of the calculated powder pattern, integrated.
 
CrystVector_long mIntegratedReflLimits
 Interval limits around each reflection, for integrated R-factors.
 
bool mIsScalable
 Scalable ? (crystal phase = scalable, background= not scalable)
 
RefinableObjClock mClockPowderPatternCalc
 When was the powder pattern last computed ?
 
RefinableObjClock mClockPowderPatternIntegratedCalc
 When was the 'integrated' powder pattern last computed ?
 
RefinableObjClock mClockPowderPatternVarianceCalc
 When was the powder pattern variance last computed ?
 
RefinableObjClock mClockPowderPatternIntegratedVarianceCalc
 When was the 'integrated' powder pattern variance last computed ?
 
PowderPatternmpParentPowderPattern
 The PowderPattern object in which this component is included.
 
RefinableObjClock mClockBraggLimits
 Get last time the Bragg Limits were changed.
 
list< pair< const REAL,const
string > > 
mvLabel
 The labels associated to different points of the pattern.
 
std::map< RefinablePar
*, CrystVector_REAL > 
mPowderPattern_FullDeriv
 
std::map< RefinablePar
*, CrystVector_REAL > 
mPowderPatternIntegrated_FullDeriv
 
- 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< RefinableObjmSubObjRegistry
 Registry of RefinableObject needed for this object (owned by this object or not)
 
ObjRegistry< RefinableObjmClientObjRegistry
 Registry of RefinableObject using this object. More...
 
ObjRegistry< RefObjOptmOptionRegistry
 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...
 
- Protected Attributes inherited from ObjCryst::ScatteringData
long mNbRefl
 Number of H,K,L reflections.
 
CrystVector_REAL mH
 H,K,L coordinates.
 
CrystVector_REAL mK
 
CrystVector_REAL mL
 
CrystVector_long mIntH
 H,K,L integer coordinates.
 
CrystVector_long mIntK
 
CrystVector_long mIntL
 
CrystVector_REAL mH2Pi
 H,K,L coordinates, multiplied by 2PI.
 
CrystVector_REAL mK2Pi
 
CrystVector_REAL mL2Pi
 
CrystVector_REAL mX
 reflection coordinates in an orthonormal base
 
CrystVector_REAL mY
 
CrystVector_REAL mZ
 
CrystVector_int mMultiplicity
 Multiplicity for each reflections (mostly for powder diffraction)
 
CrystVector_int mExpectedIntensityFactor
 Expected intensity factor for all reflections. More...
 
CrystVector_REAL mFhklCalcReal
 real &imaginary parts of F(HKL)calc
 
CrystVector_REAL mFhklCalcImag
 
std::map< RefinablePar
*, CrystVector_REAL > 
mFhklCalcReal_FullDeriv
 
std::map< RefinablePar
*, CrystVector_REAL > 
mFhklCalcImag_FullDeriv
 
CrystVector_REAL mFhklCalcSq
 F(HKL)^2 calc for each reflection.
 
std::map< RefinablePar
*, CrystVector_REAL > 
mFhklCalcSq_FullDeriv
 
CrystalmpCrystal
 Pointer to the crystal corresponding to this experiment. More...
 
REAL mGlobalBiso
 Global Biso, affecting the overall structure factor for all reflections (but not the structure factors of individual atoms or type of atomes).
 
CrystVector_REAL mGlobalTemperatureFactor
 Global Biso factor.
 
bool mUseFastLessPreciseFunc
 Use faster, but less precise, approximations for functions? (integer approximations to compute sin and cos in structure factors, and also to compute interatomic distances). More...
 
CrystVector_REAL mSinThetaLambda
 $ \frac{sin(\theta)}{\lambda} = \frac{1}{2d_{hkl}}$ for the crystal and the reflections in ReciprSpace
 
CrystVector_REAL mTheta
 theta for the crystal and the HKL in ReciprSpace (in radians)
 
map< const ScatteringPower
*, REAL > 
mvFprime
 Anomalous X-Ray scattering term f' and f" are stored here for each ScatteringPower We store here only a value. More...
 
map< const ScatteringPower
*, REAL > 
mvFsecond
 
map< const ScatteringPower
*, CrystVector_REAL > 
mvTemperatureFactor
 Thermic factors for each ScatteringPower, as vectors with NbRefl elements.
 
map< const ScatteringPower
*, CrystVector_REAL > 
mvScatteringFactor
 Scattering factors for each ScatteringPower, as vectors with NbRefl elements.
 
map< const ScatteringPower
*, CrystVector_REAL > 
mvRealGeomSF
 Geometrical Structure factor for each ScatteringPower, as vectors with NbRefl elements.
 
map< const ScatteringPower
*, CrystVector_REAL > 
mvImagGeomSF
 
map< RefinablePar *, map
< const ScatteringPower
*, CrystVector_REAL > > 
mvRealGeomSF_FullDeriv
 
map< RefinablePar *, map
< const ScatteringPower
*, CrystVector_REAL > > 
mvImagGeomSF_FullDeriv
 
RefinableObjClock mClockHKL
 Clock for the list of hkl.
 
RefinableObjClock mClockStructFactor
 Clock for the structure factor.
 
RefinableObjClock mClockStructFactorSq
 Clock for the square modulus of the structure factor.
 
RefinableObjClock mClockTheta
 Clock the last time theta was computed.
 
RefinableObjClock mClockScattFactor
 Clock the last time scattering factors were computed.
 
RefinableObjClock mClockScattFactorResonant
 Clock the last time resonant scattering factors were computed.
 
RefinableObjClock mClockGeomStructFact
 Clock the last time the geometrical structure factors were computed.
 
RefinableObjClock mClockThermicFact
 Clock the last time temperature factors were computed.
 
RefinableObjClock mClockGlobalBiso
 last time the global Biso factor was modified
 
RefinableObjClock mClockGlobalTemperatureFact
 last time the global temperature factor was computed
 
bool mIgnoreImagScattFact
 Ignore imaginary part of scattering factor. More...
 
REAL mMaxSinThetaOvLambda
 Maximum sin(theta)/lambda for all calculations (10 by default). More...
 
long mNbReflUsed
 Number of reflections which are below the max. More...
 
RefinableObjClock mClockNbReflUsed
 Clock recording the last time the number of reflections used has increased.
 
map< const ScatteringPower
*, CrystVector_REAL > 
mvLuzzatiFactor
 The Luzzati 'D' factor for each scattering power and each reflection.
 
CrystVector_REAL mFhklCalcVariance
 The variance on all calculated structure factors, taking into account the positionnal errors and the expected intensity factor. More...
 
RefinableObjClock mClockLuzzatiFactor
 
RefinableObjClock mClockFhklCalcVariance
 
CrystVector_REAL mFhklObsSq
 Observed squared structure factors (zero-sized if none)
 
RefinableObjClock mClockFhklObsSq
 Last time observed squared structure factors were altered.
 

Private Member Functions

void GenHKLFullSpace (const REAL, const bool)
 Generate a list of h,k,l to describe a full reciprocal space, up to a given maximum theta value. More...
 

Detailed Description

Class to compute the contribution to a powder pattern from a crystalline phase.

Definition at line 306 of file PowderPattern.h.

Member Function Documentation

void ObjCryst::PowderPatternDiffraction::BeginOptimization ( const bool  allowApproximations = false,
const bool  enableRestraints = false 
)
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.

Note
this may be called several time for some objects which are used by several other objects, or for nested optimizations (e.g. least-squares optimizations inside a global one).
EndOptimization() must be called at the end of the optimization, the same number of time BeginOptimization() was called !
Parameters
allowApproximationsif true, then the object can use faster but less precise functions during the optimization. This is useful for global optimization not using derivatives.
enableRestraintsxrefitem deprecated 28.

Reimplemented from ObjCryst::ScatteringData.

Definition at line 872 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::CalcIhkl ( ) const
protectedvirtual

Compute the intensity for all reflections (taking into account corrections, but not the multiplicity)

Definition at line 2022 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::CalcIntensityCorr ( ) const
protected

Calc Lorentz-Polarisation-Aperture correction

Definition at line 1944 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::CalcPowderPattern ( ) const
protectedvirtual

Calc the powder pattern.

As always, recomputation is only done if necessary (ie if a parameter has changed since the last computation)

Implements ObjCryst::PowderPatternComponent.

Definition at line 1203 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::CalcPowderPatternIntegrated_FullDeriv ( std::set< RefinablePar * > &  vPar)
protectedvirtual

Calc the integrated powder pattern.

This should be optimized so that the full powder pattern is not explicitely computed.

Reimplemented from ObjCryst::PowderPatternComponent.

Definition at line 1529 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::CalcPowderReflProfile ( ) const
protected

Calc reflection profiles for ALL reflections (powder diffraction)

Definition at line 1614 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::CalcPowderReflProfile_FullDeriv ( std::set< RefinablePar * > &  vPar)
protected

Calc derivatives of reflection profiles for all used reflections, for a given list of refinable parameters

Definition at line 1789 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::EndOptimization ( )
virtual

This should be called by any optimization class at the end of an optimization.

This also affects all sub-objects.

Note
this may be called several time for some objects which are used by several other objects.

Reimplemented from ObjCryst::ScatteringData.

Definition at line 886 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::ExtractLeBail ( unsigned int  nbcycle = 1)

Extract intensities using Le Bail method.

Parameters
nbcyclenumber of cycles

Definition at line 1053 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::GenHKLFullSpace ( const REAL  maxTheta,
const bool  unique 
)
privatevirtual

Generate a list of h,k,l to describe a full reciprocal space, up to a given maximum theta value.

Parameters
maxsithsl:maximumsin(theta)/lambda=1/2d value
uniqueif set to true, only unique reflections will be listed. Bijvoet (Friedel) pairs are NOT merged, for 'anomalous' reasons, unless you have chosen to ignore the imaginary part of the scattering factor.

The multiplicity is always stored in ScatteringData::mMultiplicity.

Warning
The ScatteringData object must already have been assigned a crystal object using SetCrystal(), and the experimental wavelength must also have been set before calling this function.
Deprecated:
Rather use PowderPattern::GenHKLFullSpace2, with a maximum sin(theta)/lambda value, which also works for dispersive experiments.

Reimplemented from ObjCryst::ScatteringData.

Definition at line 846 of file PowderPattern.cpp.

const CrystMatrix_REAL & ObjCryst::PowderPatternDiffraction::GetBMatrix ( ) const
protectedvirtual

This can use either locally stored lattice parameters from mLocalLatticePar, or the Crystal's, depending on mUseLocalLatticePar.

Reimplemented from ObjCryst::ScatteringData.

Definition at line 2244 of file PowderPattern.cpp.

const CrystVector_long & ObjCryst::PowderPatternDiffraction::GetBraggLimits ( ) const
protectedvirtual

Get the pixel positions separating the integration intervals around reflections.

Returns
: an array with the pixel positions, empty if this component has no peaks. The positions should be in increasing order, but could go beyond the pattern limits.

Implements ObjCryst::PowderPatternComponent.

Definition at line 2222 of file PowderPattern.cpp.

const string & ObjCryst::PowderPatternDiffraction::GetClassName ( ) const
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::PowderPatternComponent.

Definition at line 777 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::GetGeneGroup ( const RefinableObj obj,
CrystVector_uint &  groupIndex,
unsigned int &  firstGroup 
) const
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.

Parameters
objthe , 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.
groupIndexa 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).
firstGroupthis 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.
Note
this function is not optimized, and should only be called at the beginning of a refinement.

Reimplemented from ObjCryst::RefinableObj.

Definition at line 917 of file PowderPattern.cpp.

long ObjCryst::PowderPatternDiffraction::GetNbReflBelowMaxSinThetaOvLambda ( ) const
virtual

Recalc, and get the number of reflections which should be actually used, due to the maximuml sin(theta)/lambda value set.

Reimplemented from ObjCryst::ScatteringData.

Definition at line 1147 of file PowderPattern.cpp.

const CrystVector_REAL & ObjCryst::PowderPatternDiffraction::GetPowderPatternCalc ( ) const
virtual

Get the calculated powder pattern for this component.

Note that the pattern is not scaled.

Implements ObjCryst::PowderPatternComponent.

Definition at line 799 of file PowderPattern.cpp.

const CrystVector_REAL & ObjCryst::PowderPatternDiffraction::GetPowderPatternCalcVariance ( ) const
virtual

Get the variance associated to each point of the calculated powder pattern, for this component.

Warning
: this is experimental, with the aim of using Maximum Likelihood to improve structure determination.

Implements ObjCryst::PowderPatternComponent.

Definition at line 937 of file PowderPattern.cpp.

pair< const CrystVector_REAL *, const RefinableObjClock * > ObjCryst::PowderPatternDiffraction::GetPowderPatternIntegratedCalc ( ) const
virtual

Get the integrated values of the powder pattern.

Note
: the integration intervals are those given by the parent PowderPattern, so that all PowderPatternComponent's intervals are taken into account

This avoids explicitely calculating the full profile powder pattern.

Implements ObjCryst::PowderPatternComponent.

Definition at line 806 of file PowderPattern.cpp.

pair< const CrystVector_REAL *, const RefinableObjClock * > ObjCryst::PowderPatternDiffraction::GetPowderPatternIntegratedCalcVariance ( ) const
virtual

Get the variance associated to each point of the calculated powder pattern, for this component (integrated version).

Warning
: this is experimental, with the aim of using Maximum Likelihood to improve structure determination.

Implements ObjCryst::PowderPatternComponent.

Definition at line 944 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::Prepare ( )
protectedvirtual

This will be called by the parent PowderPattern object, before calculating the first powder pattern. Or maybe it should be called automatically by the object itself...

Implements ObjCryst::PowderPatternComponent.

Definition at line 2192 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::SetApproximationFlag ( const bool  allow)
virtual

Enable or disable numerical approximations.

This can be used for global optimization to get faster calculations. Depending on the type of object, this may do something or not (it does not do anything in a base RefinableObj, except calling this function for all sub-objects).

Note
Currently there is no mApproximationFlag in the base class, but maybe there should...

Also see:

Reimplemented from ObjCryst::ScatteringData.

Definition at line 903 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::SetCrystal ( Crystal crystal)
virtual

Set the crystal for this experiment.

Reimplemented from ObjCryst::ScatteringData.

Definition at line 956 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::SetExtractionMode ( const bool  extract = true,
const bool  init = false 
)

Prepare intensity extraction (Le Bail or Pawley)

Parameters
extractif true, begin extraction mode, else enable structure factor calculations
initif true and extract=true, intensities are set to 100. Otherwise if extract==true and init=false, the program will try to re-use existing extracted data (in mpLeBailData), but only if the list of HKL is unchanged. Otherwise initilization to 100 will be forced.

Definition at line 975 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::SetMaxSinThetaOvLambda ( const REAL  max)
protectedvirtual

Set the maximum value for sin(theta)/lambda.

All data above still exist but are ignored for all calculations.

Implements ObjCryst::PowderPatternComponent.

Definition at line 2241 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::SetParentPowderPattern ( PowderPattern )
virtual

Set the PowderPattern object which uses this component.

This sets all necessary pattern parameters (2theta/tof range, wavelength, radiation type...) accordingly.

Implements ObjCryst::PowderPatternComponent.

Definition at line 788 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::SetProfile ( ReflectionProfile prof)

Assign a new profile.

Definition at line 822 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::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.

:TODO: assymmetric profiles

Parameters
fwhmCagliotiW,fwhmCagliotiU,fwhmCagliotiV: these are the U,V and W parameters in the Caglioti's law : $ fwhm^2= U \tan^2(\theta) + V \tan(\theta) +W $ if only W is given, the width is constant
eta0,eta1these are the mixing parameters in the case of a pseudo-Voigt function.

Definition at line 812 of file PowderPattern.cpp.

void ObjCryst::PowderPatternDiffraction::XMLInput ( istream &  is,
const XMLCrystTag tag 
)
virtual

Input From stream.

Todo:
Add an bool XMLInputTag(is,tag) function to recognize all the tags from the stream. So that each inherited class can use the XMLInputTag function from its parent (ie take advantage of inheritance). The children class would first try to interpret the tag, then if unsuccessful would pass it to its parent (thus allowing overloading), etc...

Reimplemented from ObjCryst::RefinableObj.

Definition at line 1689 of file ObjCryst/IO.cpp.

void ObjCryst::PowderPatternDiffraction::XMLOutput ( ostream &  os,
int  indent = 0 
) const
virtual

Output to stream in well-formed XML.

Todo:
Use inheritance.. as for XMLInputTag()...

Reimplemented from ObjCryst::RefinableObj.

Definition at line 1617 of file ObjCryst/IO.cpp.

Member Data Documentation

CrystVector_REAL ObjCryst::PowderPatternDiffraction::mFrozenLatticePar
mutableprotected

a,b and c in Angstroems, angles (stored) in radians This is used to override lattice parameter from the Crystal structure, e.g.

for multiple datasets collected at different temperatures Ignored unless mFreezeLatticePar is true

Definition at line 509 of file PowderPattern.h.

vector< pair<unsigned long, CrystVector_REAL> > ObjCryst::PowderPatternDiffraction::mIntegratedProfileFactor
mutableprotected

For each reflection, store the integrated value of the normalized profile over all integration intervals.

The first field is the first integration interval to which the reflection contributes, and the second field is a vector with all the integrated values for the intervals, listed in ascending 2theta(tof) order.

Definition at line 498 of file PowderPattern.h.

CrystVector_REAL ObjCryst::PowderPatternDiffraction::mIntensityCorr
mutableprotected

Calculated corrections for all reflections.

Calc F^2 must be multiplied by this factor to yield intensities.

Thus we have : $ I_{hkl} = L \times P \times SlitAp \times F_{hkl}^2 $

with $ L = \frac{1}{\sin(2\theta)} $ (Lorentz factor). $ P = \frac{1}{1+A}\left(1+A\cos^2(2\theta)\right) $ (Polarization factor), with $ A = \frac{1-f}{1+f} $, where f is the polarization rate of the incident beam in the plane which (i) includes the incident beam, and (ii) is perpendicular to the diffracting plane. For an X-Ray Tube without monochromator, A=1, and if there is a monochromator : $ A = \cos^2(2\theta_{mono}) $ The factor $ SlitAp = \frac{1}{\sin(\theta)} $ takes into account the fraction of the diffracted cone which falls in the detector slit.

If there is prefereed orientation, this also holds the associated correction.

Todo:
: store all corrections in a registry, so that other corrections can more easily be added (? Maybe not that useful, especially since these correction do not need to be displayed to the user ?).

Definition at line 452 of file PowderPattern.h.

std::map<RefinablePar*,vector<CrystVector_REAL> > ObjCryst::PowderPatternDiffraction::mvReflProfile_FullDeriv
mutableprotected

Derivatives of reflection profiles versus a list of parameters.

This will be limited to the reflections actually used. First and last point of each profile are the same as in mvReflProfile.

Definition at line 488 of file PowderPattern.h.


The documentation for this class was generated from the following files: