13 #ifndef _OBJCRYST_DIFFDATA_SINGLECRYSTAL_H_
14 #define _OBJCRYST_DIFFDATA_SINGLECRYSTAL_H_
16 #include "ObjCryst/CrystVector/CrystVector.h"
18 #include "ObjCryst/ObjCryst/General.h"
20 #include "ObjCryst/ObjCryst/ScatteringPower.h"
21 #include "ObjCryst/ObjCryst/Crystal.h"
22 #include "ObjCryst/ObjCryst/ScatteringData.h"
81 const CrystVector_REAL&
GetIcalc()
const;
83 std::map<RefinablePar*, CrystVector_REAL> &
GetIcalc_FullDeriv(std::set<RefinablePar *> &vPar);
86 const CrystVector_REAL&
GetIobs()
const;
88 void SetIobs(
const CrystVector_REAL&);
91 const CrystVector_REAL&
GetSigma()
const;
93 void SetSigma(
const CrystVector_REAL&);
99 const CrystVector_REAL&
GetWeight()
const;
112 const CrystVector_long &k,
113 const CrystVector_long &l,
114 const CrystVector_REAL &iObs,
115 const CrystVector_REAL &sigma);
125 void ImportHklIobs(
const string &fileName,
const long nbRefl,
const int skipLines=0);
134 void ImportHklIobsSigma(
const string &fileName,
const long nbRefl,
const int skipLines=0);
177 virtual REAL
GetRw()
const;
183 virtual REAL
GetR()
const;
226 virtual void SetWeightToInvSigma2(
const REAL minRelatSigma=1e-4,
const REAL minIobsSigmaRatio=0);
243 virtual void SetUseOnlyLowAngleData(
const bool useOnlyLowAngle,
const REAL angle=0.);
253 virtual const CrystVector_REAL&
GetLSQCalc(
const unsigned int)
const;
254 virtual const CrystVector_REAL&
GetLSQObs(
const unsigned int)
const;
255 virtual const CrystVector_REAL&
GetLSQWeight(
const unsigned int)
const;
256 virtual std::map<RefinablePar*, CrystVector_REAL> &
GetLSQ_FullDeriv(
const unsigned int,std::set<RefinablePar *> &vPar);
257 virtual void XMLOutput(ostream &os,
int indent=0)
const;
284 void SetWavelength(
const string &XRayTubeElementName,
const REAL alpha2Alpha2ratio=0.5);
290 virtual void InitRefParList();
293 void CalcIcalc_FullDeriv(std::set<RefinablePar *> &vPar);
294 virtual CrystVector_long SortReflectionBySinThetaOverLambda(
const REAL maxTheta=-1.);
316 mutable std::map<RefinablePar*, CrystVector_REAL> mCalcIntensity_FullDeriv;
339 mutable std::map<RefinablePar*, CrystVector_REAL> mGroupIcalc_FullDeriv;
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
RadiationType
Type of radiation used.
const RefParType * gpRefParTypeObjCryst
Top RefParType for the ObjCryst++ library.
ObjRegistry< DiffractionDataSingleCrystal > gDiffractionDataSingleCrystalRegistry("Global DiffractionDataSingleCrystal Registry")
Global registry for all PowderPattern objects.
Crystal class: Unit cell, spacegroup, scatterers.
DiffractionData object for Single Crystal analysis.
RefinableObjClock mClockPrepareTwinningCorr
Clock for twinning, when the preparation of twinning correction was last made.
void ImportHklIobsSigma(const string &fileName, const long nbRefl, const int skipLines=0)
Import h,k,l,I,Sigma from a file.
CrystVector_REAL mGroupIcalc
The calculated intensities summed on all reflections that are grouped.
RefinableObjClock mClockScaleFactor
Last modification of the scale factor.
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
void SetWavelength(const REAL)
Set the (monochromatic) wavelength of the beam.
RefObjOpt mGroupOption
Option for the type of grouping (0:no, 1:by theta values (twinning), 2:user-supplied groups)
CrystVector_REAL mObsIntensity
Observed intensity (after ABS and LP corrections)
void InitOptions()
Init options (currently only twinning).
long mNbGroup
Number of groups.
CrystVector_REAL mGroupIobs
The observed intensities summed on all reflections that are (or could be) overlapped dur to a twinnin...
CrystVector_REAL mCalcIntensity
Calculated intensities.
virtual void FitScaleFactorForRw() const
Compute the best scale factor minimising Rw.
virtual const CrystVector_REAL & GetLSQWeight(const unsigned int) const
Get the weight values for the LSQ function.
virtual const CrystVector_REAL & GetLSQObs(const unsigned int) const
Get the observed values for the LSQ function.
CrystVector_long mGroupIndex
The index of reflections which need to be summed.
const CrystVector_REAL & GetSigma() const
Return the array of sigmas for observed intensities, for all peaks.
virtual REAL GetBestRFactor() const
Compute the best scale factor to minimize R, apply this scale factor and return the R value obtained.
REAL mScaleFactor
Scale factor.
std::map< RefinablePar *, CrystVector_REAL > & GetIcalc_FullDeriv(std::set< RefinablePar * > &vPar)
void SetEnergy(const REAL)
Set the (monochromatic) energy of the beam.
void CalcIcalc() const
Calc intensities.
void ImportHklIobsSigmaJanaM91(const string &fileName)
Import h,k,l,I,Sigma from a Jana98 '*.m91' file.
CrystVector_REAL mWeight
weight for computing R-Factor, for each observed value.
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.
RefinableObjClock mClockChi2
Clock the last time Chi^2 was computed.
virtual void FitScaleFactorForR() const
Compute the best scale factor minimising R.
bool mHasObservedData
Are there observed intensities ?
virtual REAL GetChi2() const
Return conventionnal Chi^2.
virtual void SetSigmaToSqrtIobs()
Set sigma for all observed intensities to sqrt(obs)
virtual void SetRadiationType(const RadiationType radiation)
Set : neutron or x-ray experiment ? Wavelength ?
virtual void SetWeightToInvSigma2(const REAL minRelatSigma=1e-4, const REAL minIobsSigmaRatio=0)
Set the weight for all observed intensities to 1/sigma^2.
void ImportShelxHKLF4(const string &fileName)
Import h,k,l,I,Sigma from a file using shelx HKLF 4 format.
virtual REAL GetRw() const
Return the Crystal R-factor (weighted)
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
CrystVector_REAL mGroupWeight
The weight on each reflection sum in case of grouped reflections.
virtual const Radiation & GetRadiation() const
Get the radiation object for this data.
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
RefinableObjClock mClockIcalc
Last time Icalc was computed.
virtual unsigned int GetNbLSQFunction() const
Number of LSQ functions.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
virtual DiffractionDataSingleCrystal * CreateCopy() const
So-called virtual copy constructor.
void SetIobsToIcalc()
Set Iobs to current values of Icalc. Mostly used for tests.
REAL GetScaleFactor() const
Scale factor (applied to Icalc to match Iobs)
void SetIobs(const CrystVector_REAL &)
Return the array of observed intensities for all peaks.
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
virtual void PrintObsCalcData() const
Print H, K, L Iobs sigma Icalc for all reflections Iobs and sigma (if given) are scaled to Icalc (if ...
DiffractionDataSingleCrystal(const bool regist=true)
Default constructor.
virtual void PrintObsData() const
Print H, K, L Iobs sigma for all reflections.
long mNbGroupUsed
Number of groups below max[sin(theta)/lambda].
void ImportHklIobs(const string &fileName, const long nbRefl, const int skipLines=0)
Import h,k,l,I from a file.
CrystVector_REAL mGroupSigma
The uncertainty on observed grouped intensities.
CrystVector_REAL mObsSigma
Sigma for observed intensities (either individual reflections or spectrum)
virtual const CrystVector_REAL & GetLSQCalc(const unsigned int) const
Get the current calculated value for the LSQ function.
void SetWeight(const CrystVector_REAL &)
Change the weights (for each reflection) used for computing Rw.
void ImportCIF(const string &fileName)
Import diffraction data from a CIF file.
virtual REAL GetR() const
Return the Crystal R-factor (unweighted)
const CrystVector_REAL & GetIobs() const
Return the array of observed intensities for all peaks.
const CrystVector_REAL & GetIcalc() const
returns the calculated diffracted intensity.
void SaveHKLIobsIcalc(const string &filename="hklIobsIcalc.out")
Save H,K,L Iobs Icalc to a file, text format, 3 columns theta Iobs Icalc.
const CrystVector_REAL & GetWeight() const
Return the weights (for each reflection) used for computing Rw.
void PrepareTwinningCalc() const
Determine the index of reflections to be summed because of twinning (GroupOption==1) The reflections ...
void ImportHklIobsGroup(const string &fileName, const unsigned int skipLines=0)
Import h,k,l and grouped intensities from a file.
void SetSigma(const CrystVector_REAL &)
Return the array of sigmas for observed intensities, for all peaks.
Class to define the radiation (type, monochromaticity, wavelength(s)) of an experiment.
Class to compute structure factors for a set of reflections and a Crystal.
class to input or output a well-formatted xml beginning or ending tag.
class of refinable parameter types.
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Abstract base class for all objects in wxCryst.
WX Class for DiffractionDataSingleCrystal objects.