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

DiffractionData object for Single Crystal analysis. More...

+ Inheritance diagram for ObjCryst::DiffractionDataSingleCrystal:
+ Collaboration diagram for ObjCryst::DiffractionDataSingleCrystal:

Public Member Functions

 DiffractionDataSingleCrystal (const bool regist=true)
 Default constructor. More...
 
 DiffractionDataSingleCrystal (Crystal &cryst, const bool regist=true)
 Constructor, with an assigned crystal structure. More...
 
 DiffractionDataSingleCrystal (const DiffractionDataSingleCrystal &old)
 Copy constructor.
 
virtual
DiffractionDataSingleCrystal
CreateCopy () const
 So-called virtual copy constructor.
 
virtual const string & GetClassName () const
 Name for this class ("RefinableObj", "Crystal",...). More...
 
const CrystVector_REAL & GetIcalc () const
 returns the calculated diffracted intensity. More...
 
std::map< RefinablePar
*, CrystVector_REAL > & 
GetIcalc_FullDeriv (std::set< RefinablePar * > &vPar)
 
const CrystVector_REAL & GetIobs () const
 Return the array of observed intensities for all peaks.
 
void SetIobs (const CrystVector_REAL &)
 Return the array of observed intensities for all peaks.
 
const CrystVector_REAL & GetSigma () const
 Return the array of sigmas for observed intensities, for all peaks.
 
void SetSigma (const CrystVector_REAL &)
 Return the array of sigmas for observed intensities, for all peaks.
 
void SetIobsToIcalc ()
 Set Iobs to current values of Icalc. Mostly used for tests.
 
const CrystVector_REAL & GetWeight () const
 Return the weights (for each reflection) used for computing Rw.
 
void SetWeight (const CrystVector_REAL &)
 Change the weights (for each reflection) used for computing Rw.
 
void SetHklIobs (const CrystVector_long &h, const CrystVector_long &k, const CrystVector_long &l, const CrystVector_REAL &iObs, const CrystVector_REAL &sigma)
 input H,K,L, Iobs and Sigma More...
 
void ImportHklIobs (const string &fileName, const long nbRefl, const int skipLines=0)
 Import h,k,l,I from a file. More...
 
void ImportHklIobsSigma (const string &fileName, const long nbRefl, const int skipLines=0)
 Import h,k,l,I,Sigma from a file. More...
 
void ImportShelxHKLF4 (const string &fileName)
 Import h,k,l,I,Sigma from a file using shelx HKLF 4 format. More...
 
void ImportCIF (const string &fileName)
 Import diffraction data from a CIF file. More...
 
void ImportHklIobsSigmaJanaM91 (const string &fileName)
 Import h,k,l,I,Sigma from a Jana98 '*.m91' file. More...
 
void ImportHklIobsGroup (const string &fileName, const unsigned int skipLines=0)
 Import h,k,l and grouped intensities from a file. More...
 
virtual REAL GetRw () const
 Return the Crystal R-factor (weighted) More...
 
virtual REAL GetR () const
 Return the Crystal R-factor (unweighted) More...
 
virtual REAL GetChi2 () const
 Return conventionnal Chi^2. More...
 
virtual void FitScaleFactorForRw () const
 Compute the best scale factor minimising Rw. More...
 
virtual void FitScaleFactorForR () const
 Compute the best scale factor minimising R. More...
 
virtual REAL GetBestRFactor () const
 Compute the best scale factor to minimize R, apply this scale factor and return the R value obtained. More...
 
virtual void SetSigmaToSqrtIobs ()
 Set sigma for all observed intensities to sqrt(obs) More...
 
virtual void SetWeightToInvSigma2 (const REAL minRelatSigma=1e-4, const REAL minIobsSigmaRatio=0)
 Set the weight for all observed intensities to 1/sigma^2. More...
 
REAL GetScaleFactor () const
 Scale factor (applied to Icalc to match Iobs)
 
virtual void PrintObsData () const
 Print H, K, L Iobs sigma for all reflections. More...
 
virtual void PrintObsCalcData () const
 Print H, K, L Iobs sigma Icalc for all reflections Iobs and sigma (if given) are scaled to Icalc (if available).
 
virtual void SetUseOnlyLowAngleData (const bool useOnlyLowAngle, const REAL angle=0.)
 
void SaveHKLIobsIcalc (const string &filename="hklIobsIcalc.out")
 Save H,K,L Iobs Icalc to a file, text format, 3 columns theta Iobs Icalc. 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...
 
virtual const RadiationGetRadiation () const
 Get the radiation object for this data.
 
RadiationGetRadiation ()
 
virtual void SetRadiationType (const RadiationType radiation)
 Set : neutron or x-ray experiment ? Wavelength ?
 
void SetWavelength (const REAL)
 Set the (monochromatic) wavelength of the beam.
 
void SetWavelength (const string &XRayTubeElementName, const REAL alpha2Alpha2ratio=0.5)
 \ brief Set X-Ray tube radiation. More...
 
void SetEnergy (const REAL)
 Set the (monochromatic) energy of the beam.
 
- 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...
 
virtual void GenHKLFullSpace (const REAL maxTheta, 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 ?
 
virtual void SetCrystal (Crystal &crystal)
 Set the crystal for this experiment. More...
 
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.
 
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 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.
 
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...
 
const RefinableObjClockGetClockNbReflBelowMaxSinThetaOvLambda () const
 Clock the last time the number of reflections used was changed.
 
- 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...
 
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.
 
RefObjOptGetOption (const unsigned int i)
 Access to the options.
 
const RefObjOptGetOption (const unsigned int i) const
 const access to the options
 
virtual void GetGeneGroup (const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
 Get the gene group assigned to each parameter. More...
 
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.
 

Private Member Functions

virtual void InitRefParList ()
 
void CalcIcalc () const
 Calc intensities.
 
void CalcIcalc_FullDeriv (std::set< RefinablePar * > &vPar)
 
virtual CrystVector_long SortReflectionBySinThetaOverLambda (const REAL maxTheta=-1.)
 
void InitOptions ()
 Init options (currently only twinning).
 
void PrepareTwinningCalc () const
 Determine the index of reflections to be summed because of twinning (GroupOption==1) The reflections must have been sorted by increasing theta beforehand. More...
 

Private Attributes

bool mHasObservedData
 Are there observed intensities ?
 
CrystVector_REAL mObsIntensity
 Observed intensity (after ABS and LP corrections) More...
 
CrystVector_REAL mObsSigma
 Sigma for observed intensities (either individual reflections or spectrum)
 
CrystVector_REAL mWeight
 weight for computing R-Factor, for each observed value.
 
CrystVector_REAL mCalcIntensity
 Calculated intensities.
 
std::map< RefinablePar
*, CrystVector_REAL > 
mCalcIntensity_FullDeriv
 
REAL mScaleFactor
 Scale factor. More...
 
REAL mChi2
 Chi^2.
 
RefinableObjClock mClockIcalc
 Last time Icalc was computed.
 
RefinableObjClock mClockScaleFactor
 Last modification of the scale factor.
 
RefinableObjClock mClockChi2
 Clock the last time Chi^2 was computed.
 
RefObjOpt mGroupOption
 Option for the type of grouping (0:no, 1:by theta values (twinning), 2:user-supplied groups)
 
CrystVector_REAL mGroupIobs
 The observed intensities summed on all reflections that are (or could be) overlapped dur to a twinning.
 
CrystVector_REAL mGroupSigma
 The uncertainty on observed grouped intensities.
 
CrystVector_REAL mGroupIcalc
 The calculated intensities summed on all reflections that are grouped.
 
std::map< RefinablePar
*, CrystVector_REAL > 
mGroupIcalc_FullDeriv
 
CrystVector_REAL mGroupWeight
 The weight on each reflection sum in case of grouped reflections. More...
 
CrystVector_long mGroupIndex
 The index of reflections which need to be summed. More...
 
long mNbGroup
 Number of groups.
 
long mNbGroupUsed
 Number of groups below max[sin(theta)/lambda].
 
RefinableObjClock mClockPrepareTwinningCorr
 Clock for twinning, when the preparation of twinning correction was last made.
 
Radiation mRadiation
 

Additional Inherited Members

- Protected Member Functions inherited from ObjCryst::ScatteringData
virtual void PrepareHKLarrays ()
 
CrystVector_long EliminateExtinctReflections ()
 
virtual void CalcSinThetaLambda () const
 
REAL CalcSinThetaLambda (REAL h, REAL k, REAL l) const
 Calculate sin(theta)/lambda for a single reflection.
 
virtual const CrystMatrix_REAL & GetBMatrix () const
 Get access to the B matrix used to compute reflection positions. More...
 
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 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)
 
virtual void Prepare ()
 
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 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.
 
- 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...
 

Detailed Description

DiffractionData object for Single Crystal analysis.

Currently this handles only in the simplest way single crystal dat: ie only data which has been completely corrected for Lorentz/Polarization and absorption.

What needs to be developped: define the geometry of the experiment (incident and emerging angles), the polarization of the beam, etc...

Definition at line 50 of file DiffractionDataSingleCrystal.h.

Constructor & Destructor Documentation

ObjCryst::DiffractionDataSingleCrystal::DiffractionDataSingleCrystal ( const bool  regist = true)

Default constructor.

Parameters
registif false, do not add to the global registry of single crystal data or refinable objects - this is only useful for data to be used internally only.
Deprecated:
Use the constructor passing a crystal structure instead.

Definition at line 57 of file DiffractionDataSingleCrystal.cpp.

ObjCryst::DiffractionDataSingleCrystal::DiffractionDataSingleCrystal ( Crystal cryst,
const bool  regist = true 
)

Constructor, with an assigned crystal structure.

Parameters
registif false, do not add to the global registry of single crystal data or refinable objects - this is only useful for data to be used internally only.

Definition at line 68 of file DiffractionDataSingleCrystal.cpp.

Member Function Documentation

void ObjCryst::DiffractionDataSingleCrystal::FitScaleFactorForR ( ) const
virtual

Compute the best scale factor minimising R.

The computed scale factor is immediatly applied to Icalc

Definition at line 855 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::FitScaleFactorForRw ( ) const
virtual

Compute the best scale factor minimising Rw.

The computed scale factor is immediatly applied to Icalc

Definition at line 810 of file DiffractionDataSingleCrystal.cpp.

REAL ObjCryst::DiffractionDataSingleCrystal::GetBestRFactor ( ) const
virtual

Compute the best scale factor to minimize R, apply this scale factor and return the R value obtained.

Definition at line 897 of file DiffractionDataSingleCrystal.cpp.

REAL ObjCryst::DiffractionDataSingleCrystal::GetChi2 ( ) const
virtual

Return conventionnal Chi^2.

Returns
$ \chi^2 = \sum_i w_i \left(I_i^{obs}-I_i^{calc} \right)^2 $

Definition at line 733 of file DiffractionDataSingleCrystal.cpp.

const string & ObjCryst::DiffractionDataSingleCrystal::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::RefinableObj.

Definition at line 116 of file DiffractionDataSingleCrystal.cpp.

const CrystVector_REAL & ObjCryst::DiffractionDataSingleCrystal::GetIcalc ( ) const

returns the calculated diffracted intensity.

This is an array of calculated intensities for each reflections in the single crystal case, and the array with the full powder powder profile for powder diffraction.

Definition at line 166 of file DiffractionDataSingleCrystal.cpp.

std::map< RefinablePar *, CrystVector_REAL > & ObjCryst::DiffractionDataSingleCrystal::GetIcalc_FullDeriv ( std::set< RefinablePar * > &  vPar)
Todo:

Definition at line 172 of file DiffractionDataSingleCrystal.cpp.

REAL ObjCryst::DiffractionDataSingleCrystal::GetLogLikelihood ( ) const
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.

Note
contrary to the old "Cost Function" approach, with log(Likelihood) there is no 'choice' of cost function, so that it is the task of the object to give the optimized likelihood (possibly with user options).

Reimplemented from ObjCryst::RefinableObj.

Definition at line 1013 of file DiffractionDataSingleCrystal.cpp.

std::map< RefinablePar *, CrystVector_REAL > & ObjCryst::DiffractionDataSingleCrystal::GetLSQ_FullDeriv ( const unsigned int  n,
std::set< RefinablePar * > &  vPar 
)
virtual

Get the first derivative for the LSQ function for each parameter supplied in a list.

Returns
: a map, with a RefinablePar pointer as key, and as value the corresponding derivative vector. Note that the value of the map for the NULL key is the current value for the LSQ function, which is also returned. The map will include derivatives only for parameters which have been supplied in vPar - but if a parameter is listed in vPar and has a null derivative, the returned vecor will be empty.
Warning
: currently in development, to provide faster, analytic derivatives
Note
:ideally, this function should be const - but since numerical derivatives may be used before all analytical formulas are entered, a non-const version is required.
Todo:

Reimplemented from ObjCryst::RefinableObj.

Definition at line 1042 of file DiffractionDataSingleCrystal.cpp.

REAL ObjCryst::DiffractionDataSingleCrystal::GetR ( ) const
virtual

Return the Crystal R-factor (unweighted)

Returns
$ R= \sqrt {\frac{\sum_i \left( I_i^{obs}-I_i^{calc} \right)^2} {\sum_i (I_i^{obs})^2} }$

Definition at line 694 of file DiffractionDataSingleCrystal.cpp.

REAL ObjCryst::DiffractionDataSingleCrystal::GetRw ( ) const
virtual

Return the Crystal R-factor (weighted)

Returns
$ R_{w}= \sqrt {\frac{\sum_i w_i\left( I_i^{obs}-I_i^{calc} \right)^2} {\sum_i w_i (I_i^{obs})^2} }$

Definition at line 654 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::GlobalOptRandomMove ( const REAL  mutationAmplitude,
const RefParType type = gpRefParTypeObjCryst 
)
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.

Warning
: this makes a random move for the parameter declared for this object, and it is the duty of the object to decide whether the included objects should be moved and how. (eg an algorithm should only call for a move with the top object, and this object decides how he and his sub-objects moves). By default (RefinableObj implementation) all included objects are moved recursively.

RefinableObj::

Parameters
mutationAmplitudemultiplier for the maximum move amplitude, for all parameters
typerestrain the change exclusively to parameters of a given type (same type or descendant from this RefParType).

Reimplemented from ObjCryst::RefinableObj.

Definition at line 1006 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::ImportCIF ( const string &  fileName)

Import diffraction data from a CIF file.

The file is assumed to correspond to a single crystal diffraction file.

Parameters
fileNameThe name of the data file.

Definition at line 438 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::ImportHklIobs ( const string &  fileName,
const long  nbRefl,
const int  skipLines = 0 
)

Import h,k,l,I from a file.

The file is assumed to correspond to a single crystal diffraction file.

Parameters
fileNameThe name of the data file. This file should be formatted with H,k,l, Iobs separated by spaces.
nbReflThe number of reflections to extract.
skipLinesThe number of lines to skip at the beginning of the file.

Definition at line 231 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::ImportHklIobsGroup ( const string &  fileName,
const unsigned int  skipLines = 0 
)

Import h,k,l and grouped intensities from a file.

The file is assumed to correspond to a single crystal diffraction file.

Parameters
fileNameThe name of the data file. This file should be formatted with H,k,l, Iobs separated by spaces.
skipLinesThe number of lines to skip at the beginning of the file.

File format (the reflection which has an intensity entry marks the end of the group) h k l Igroup -2 4 2 -2 -4 2 100.4 2 -4 1 2 4 1 193.2 ...

Definition at line 539 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::ImportHklIobsSigma ( const string &  fileName,
const long  nbRefl,
const int  skipLines = 0 
)

Import h,k,l,I,Sigma from a file.

The file is assumed to correspond to a single crystal diffraction file.

Parameters
fileNameThe name of the data file. This file should be formatted with H,k,l, Iobs and Sigma separated by spaces.
nbReflThe number of reflections to extract.
skipLinesThe number of lines to skip at the beginning of the file.

Definition at line 294 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::ImportHklIobsSigmaJanaM91 ( const string &  fileName)

Import h,k,l,I,Sigma from a Jana98 '*.m91' file.

The file is assumed to correspond to a single crystal diffraction file.

Parameters
fileNameThe name of the data file.

Definition at line 458 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::ImportShelxHKLF4 ( const string &  fileName)

Import h,k,l,I,Sigma from a file using shelx HKLF 4 format.

The file is assumed to correspond to a single crystal diffraction file.This file should be formatted with H,k,l, Iobs and Sigma using a strict formatting 3I4+2F8, and the last line should contain 0 0 0 for hkl values.

Parameters
fileNameThe name of the data file.

Definition at line 359 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::PrepareTwinningCalc ( ) const
private

Determine the index of reflections to be summed because of twinning (GroupOption==1) The reflections must have been sorted by increasing theta beforehand.

Definition at line 1305 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::PrintObsData ( ) const
virtual

Print H, K, L Iobs sigma for all reflections.

Definition at line 929 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::SaveHKLIobsIcalc ( const string &  filename = "hklIobsIcalc.out")

Save H,K,L Iobs Icalc to a file, text format, 3 columns theta Iobs Icalc.

If Iobs is missing, the column is omitted.

Definition at line 979 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::SetHklIobs ( const CrystVector_long &  h,
const CrystVector_long &  k,
const CrystVector_long &  l,
const CrystVector_REAL &  iObs,
const CrystVector_REAL &  sigma 
)

input H,K,L, Iobs and Sigma

Parameters
h,k,lREAL arrays (vectors with NbRefl elements -same size) with the h, k and l coordinates of all reflections.
iobs,sigmaREAL arrays (vectors with NbRefl elements -same size) with the Observed intensity and sigma for all reflections.

Definition at line 122 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::SetSigmaToSqrtIobs ( )
virtual

Set sigma for all observed intensities to sqrt(obs)

Definition at line 905 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::SetWavelength ( const string &  XRayTubeElementName,
const REAL  alpha2Alpha2ratio = 0.5 
)

\ brief Set X-Ray tube radiation.

Parameters
XRayTubeElementName: name of the anticathode element name. Known ones are Cr, Fe, Cu, Mo, Ag.
alpha2Alpha2ratioKalpha2/Kalpha1 ratio (0.5 by default)

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 1077 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::SetWeightToInvSigma2 ( const REAL  minRelatSigma = 1e-4,
const REAL  minIobsSigmaRatio = 0 
)
virtual

Set the weight for all observed intensities to 1/sigma^2.

For sigmas which are smaller than minRelatSigma times the max value of sigma, the output weight is set to 0.

For reflections where the intensity is below minIobsSigmaRatio*sigma, the weight is set to zero so that this reflection is ignored.

Definition at line 912 of file DiffractionDataSingleCrystal.cpp.

CrystVector_long ObjCryst::DiffractionDataSingleCrystal::SortReflectionBySinThetaOverLambda ( const REAL  maxSTOL = -1.)
privatevirtual

sort reflections by theta values (also get rid of [0,0,0] if present) If maxSTOL >0, then only reflections where sin(theta)/lambda<maxSTOL are kept

Returns
an array with the subscript of the kept reflections (for inherited classes)

Reimplemented from ObjCryst::ScatteringData.

Definition at line 1168 of file DiffractionDataSingleCrystal.cpp.

void ObjCryst::DiffractionDataSingleCrystal::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 1280 of file ObjCryst/IO.cpp.

void ObjCryst::DiffractionDataSingleCrystal::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 1180 of file ObjCryst/IO.cpp.

Member Data Documentation

CrystVector_long ObjCryst::DiffractionDataSingleCrystal::mGroupIndex
mutableprivate

The index of reflections which need to be summed.

They must have been sorted by increasing theta values. Each entry (the reflection index) marks the beginning of a new batch of reflections to be summed.

Here only the groups of reflections are roughly sorted by sin(theta)/lambda. It is assumed, howver, that grouped reflections are of approximately the same d_hkl. After ScatteringData::GetNbReflBelowMaxSinThetaOvLambda(), the number of groups for which all reflections are below the limit are taken into account for the statistics.

Note that DiffractionDataSingleCrystal::SortReflectionBySinThetaOverLambda() is called (i.e. immediately after importing the reflections)

Definition at line 356 of file DiffractionDataSingleCrystal.h.

CrystVector_REAL ObjCryst::DiffractionDataSingleCrystal::mGroupWeight
mutableprivate

The weight on each reflection sum in case of grouped reflections.

The sum is the inverse of the sum of all sigma^2

Definition at line 342 of file DiffractionDataSingleCrystal.h.

CrystVector_REAL ObjCryst::DiffractionDataSingleCrystal::mObsIntensity
private

Observed intensity (after ABS and LP corrections)

In the single crystal case, this is a list of intensity corresponding to (h,k,l). For a powder sample, this is a list of all peaks intensities.

Definition at line 308 of file DiffractionDataSingleCrystal.h.

REAL ObjCryst::DiffractionDataSingleCrystal::mScaleFactor
mutableprivate

Scale factor.

It is applied when computing intensities. The scale applies to intensities

Definition at line 319 of file DiffractionDataSingleCrystal.h.


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