FOX/ObjCryst++  1.10.X (development)
ObjCryst::ScatteringData Class Referenceabstract

Class to compute structure factors for a set of reflections and a Crystal. More...

+ Inheritance diagram for ObjCryst::ScatteringData:
+ Collaboration diagram for ObjCryst::ScatteringData:

Public Member Functions

 ScatteringData (const ScatteringData &old)
 
virtual ScatteringDataCreateCopy () const =0
 So-called virtual copy constructor.
 
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 const RadiationGetRadiation () const =0
 Get the radiation object for this data.
 
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 & GetClassName () const
 Name for this class ("RefinableObj", "Crystal",...). More...
 
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 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 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.
 

Protected Member Functions

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.
 
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

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

Class to compute structure factors for a set of reflections and a Crystal.

This class only computes structure factor, but no intensity. i.e. it does not include any correction such as absorption, Lorentz or Polarization.

Does this really need to be a RefinableObj ?

Todo:
Optimize computation for Bijvoet/Friedel mates. To do this, generate an internal list of 'true independent reflections', with two entries for each, for both mates, and make the 'real' reflections only a reference to these reflections.
Todo:
a lot of cleaning is necessary in the computing of structure factors, for (1) the 'preparation' part (deciding what needs to be recomputed) and (2) to allow anisotropic temperature factors (or other anisotropic parts)

Definition at line 305 of file ScatteringData.h.

Member Function Documentation

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

Reimplemented in ObjCryst::PowderPatternDiffraction.

Definition at line 826 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcGeomStructFactor ( ) const
protected

Compute the 'Geometrical Structure Factor' for each ScatteringPower of the Crystal.

Definition at line 1579 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcResonantScattFactor ( ) const
protectedvirtual

get f' and f" for ScatteringPower of the crystal, at the exp. wavelength

This could be specialized for multi-wavelength experiments...

Definition at line 1221 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcScattFactor ( ) const
protected

Get scattering factors for all ScatteringPower & reflections

Definition at line 1172 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcSinThetaLambda ( ) const
protectedvirtual

Compute sin(theta)/lambda as well a orthonormal coordinates for all reflections. theta and tan(theta), are also re-computed, provided a wavelength has been supplied.

Definition at line 1064 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcStructFactor ( ) const
protected

Compute the overall structure factor (real and imaginary part).

This function is optimized for speed (geometrical structure factors are computed for all atoms and all reflections in two loops, avoiding re-calculation). So use this function for repetitive calculations.

This function recognizes the type of radiation (XRay or neutron) and uses the corresponding scattering factor/length.

Returns
the result (real and imaginary part of the structure factor) (mRealFhklCalc, mImagFhklCalc) are stored in ScatteringData.

Definition at line 1272 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcStructFactVariance ( ) const
protected

Calculate the variance associated to the calculated structure factor.

Definition at line 2365 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::CalcTemperatureFactor ( ) const
protected

Compute thermic factors for all ScatteringPower & reflections

Definition at line 1198 of file ScatteringData.cpp.

CrystVector_long ObjCryst::ScatteringData::EliminateExtinctReflections ( )
protected

Get rid of extinct reflections. Useful after GenHKLFullSpace(). Do not use this if you have a list of observed reflections !

Currently done using (brute-force) numerical evaluation. Should rather use SpaceGroup info... To do !

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

Definition at line 1020 of file ScatteringData.cpp.

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

Reimplemented in ObjCryst::PowderPatternDiffraction.

Definition at line 838 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::GenHKLFullSpace ( const REAL  maxTheta,
const bool  unique = false 
)
virtual

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

Definition at line 579 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::GenHKLFullSpace2 ( const REAL  maxsithsl,
const bool  unique = false 
)
virtual

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

Parameters
maxTheta:maximumtheta 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.

Definition at line 483 of file ScatteringData.cpp.

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

Get access to the B matrix used to compute reflection positions.

May be overridden by derived classes to use different lattice parameters than the Crystal's unitcell (used for multiple datasets).

Reimplemented in ObjCryst::PowderPatternDiffraction.

Definition at line 1167 of file ScatteringData.cpp.

const CrystVector_REAL & ObjCryst::ScatteringData::GetH2Pi ( ) const

Return the 1D array of H coordinates for all reflections, multiplied by 2*pi.

Should be private

Definition at line 616 of file ScatteringData.cpp.

const CrystVector_REAL & ObjCryst::ScatteringData::GetK2Pi ( ) const

Return the 1D array of K coordinates for all reflections, multiplied by 2*pi.

Should be private

Definition at line 617 of file ScatteringData.cpp.

const CrystVector_REAL & ObjCryst::ScatteringData::GetL2Pi ( ) const

Return the 1D array of L coordinates for all reflections, multiplied by 2*pi.

Should be private

Definition at line 618 of file ScatteringData.cpp.

long ObjCryst::ScatteringData::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 in ObjCryst::PowderPatternDiffraction.

Definition at line 920 of file ScatteringData.cpp.

bool ObjCryst::ScatteringData::IsIgnoringImagScattFact ( ) const

If true, then the imaginary part of the scattering factor is ignored during Structure factor computation.

Definition at line 763 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::PrepareHKLarrays ( )
protectedvirtual

This function is called after H,K and L arrays have been initialized or modified.

Definition at line 865 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::PrintFhklCalc ( ostream &  os = cout) const
virtual

Print H, K, L F^2 Re(F) Im(F) theta sin(theta)/lambda for all reflections.

Definition at line 765 of file ScatteringData.cpp.

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

Reimplemented in ObjCryst::PowderPatternDiffraction.

Definition at line 853 of file ScatteringData.cpp.

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

Set the crystal for this experiment.

Reimplemented in ObjCryst::PowderPatternDiffraction.

Definition at line 593 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::SetHKL ( const CrystVector_REAL &  h,
const CrystVector_REAL &  k,
const CrystVector_REAL &  l 
)
virtual

input H,K,L

Parameters
h,k,lREAL arrays (vectors with NbRefl elements -same size), with the h, k and l coordinates of all reflections.

Definition at line 469 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::SetIsIgnoringImagScattFact ( const bool  b)

If true, then the imaginary part of the scattering factor is ignored during Structure factor computation.

(default value=false)

Todo:
this should become useless once we take fully advantage of coupled computation of Structure Factors for Fridel/Bijvoet mates using an internal list of 'fully unique' reflections. Then only one of the mates need to be computed..

Definition at line 756 of file ScatteringData.cpp.

void ObjCryst::ScatteringData::SetMaxSinThetaOvLambda ( const REAL  max)
virtual

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

All data (reflections,..) still exist but are ignored for all calculations.

Reimplemented in ObjCryst::PowderPatternDiffraction.

Definition at line 918 of file ScatteringData.cpp.

CrystVector_long ObjCryst::ScatteringData::SortReflectionBySinThetaOverLambda ( const REAL  maxSTOL = -1.)
protectedvirtual

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 in ObjCryst::DiffractionDataSingleCrystal.

Definition at line 947 of file ScatteringData.cpp.

Member Data Documentation

CrystVector_int ObjCryst::ScatteringData::mExpectedIntensityFactor
protected

Expected intensity factor for all reflections.

See SpaceGroup::GetExpectedIntensityFactor()

Definition at line 549 of file ScatteringData.h.

CrystVector_REAL ObjCryst::ScatteringData::mFhklCalcVariance
mutableprotected

The variance on all calculated structure factors, taking into account the positionnal errors and the expected intensity factor.

Actually this is the variance on both real and imaginary parts.

Definition at line 672 of file ScatteringData.h.

bool ObjCryst::ScatteringData::mIgnoreImagScattFact
protected

Ignore imaginary part of scattering factor.

This can be used either to speed up computation, or when f" has a small effect on calculated intensities, mostly for powder diffraction (GenHKLFullSpace will not generate Friedel pairs, reducing the number of reflections by a factor up to 2 for some structures).

Practically this makes f"=0 during computation. The real resonant contribution (f') is not affected.

This may be removed later on...

Definition at line 643 of file ScatteringData.h.

REAL ObjCryst::ScatteringData::mMaxSinThetaOvLambda
protected

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.

This affects the computing of structure factors, intensities (for single crystal and powder patterns), R and Rw.

The reflections must be sorted by increasing sin(theta)/lambda for this to work correctly.

Definition at line 657 of file ScatteringData.h.

long ObjCryst::ScatteringData::mNbReflUsed
mutableprotected

Number of reflections which are below the max.

This is updated automatically from ScatteringData::mMaxSinThetaOvLambda

Definition at line 660 of file ScatteringData.h.

Crystal* ObjCryst::ScatteringData::mpCrystal
protected

Pointer to the crystal corresponding to this experiment.

This gives an access to the UB matrix for the crystal, as well as to the list of Scatterer.

Definition at line 563 of file ScatteringData.h.

bool ObjCryst::ScatteringData::mUseFastLessPreciseFunc
protected

Use faster, but less precise, approximations for functions? (integer approximations to compute sin and cos in structure factors, and also to compute interatomic distances).

This is activated by global optimization algortithms, only during the optimization.

Definition at line 579 of file ScatteringData.h.

map<const ScatteringPower*,REAL> ObjCryst::ScatteringData::mvFprime
mutableprotected

Anomalous X-Ray scattering term f' and f" are stored here for each ScatteringPower We store here only a value.

For multi-wavelength support this should be changed to a vector... or to a matrix to take into account anisotropy of anomalous scattering...

Definition at line 595 of file ScatteringData.h.


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