22 #ifndef _OBJCRYST_INDEXING_H_ 
   23 #define _OBJCRYST_INDEXING_H_ 
   31 #include "ObjCryst/RefinableObj/RefinableObj.h" 
   32 #include "ObjCryst/RefinableObj/LSQNumObj.h" 
   39 { TRICLINIC, MONOCLINIC, ORTHOROMBIC, HEXAGONAL, RHOMBOEDRAL, TETRAGONAL, CUBIC};
 
   42 { LATTICE_P,LATTICE_I,LATTICE_A,LATTICE_B,LATTICE_C,LATTICE_F};
 
   52                          const CrystalSystem system,
const CrystalCentering centering,
const float kappa=1);
 
   61       RecUnitCell(
const float zero=0,
const float par0=0,
const float par1=0,
const float par2=0,
 
   62                   const float par3=0,
const float par4=0,
const float par5=0,
CrystalSystem lattice=CUBIC,
 
   63                   const CrystalCentering cent=LATTICE_P);
 
   72       float hkl2d(
const float h,
const float k,
const float l,REAL *derivpar=NULL,
const unsigned int derivhkl=0) 
const;
 
   78       void hkl2d_delta(
const float h,
const float k,
const float l,
const RecUnitCell &delta, 
float & dmin, 
float &dmax) 
const;
 
  107       CrystalCentering mCentering;
 
  119       void operator=(
const PeakList &rhs);
 
  121       void ImportDhklDSigmaIntensity(std::istream &is,
float defaultsigma=.001);
 
  122       void ImportDhklIntensity(std::istream &is);
 
  123       void ImportDhkl(std::istream &is);
 
  124       void Import2ThetaIntensity(std::istream &is, 
const float wavelength=1.5418);
 
  137       float Simulate(
float zero, 
float a, 
float b, 
float c,
 
  138                     float alpha, 
float beta, 
float gamma,
 
  139                     bool deg, 
unsigned int nb=20, 
unsigned int nbspurious=0,
 
  140                     float sigma=0, 
float percentMissing=0, 
const bool verbose=
false);
 
  141       void ExportDhklDSigmaIntensity(std::ostream &out)
const;
 
  144       void AddPeak(
const float d, 
const float iobs=1.0,
const float dobssigma=0.0,
const float iobssigma=0.0,
 
  145                    const int h=0,
const int k=0, 
const int l=0,
const float d2calc=0);
 
  146       void RemovePeak(
unsigned int i);
 
  147       void Print(std::ostream &os) 
const;
 
  151          hkl0(
const int h=0,
const int k=0, 
const int l=0);
 
  161              const int h=0,
const int k=0, 
const int l=0,
const float d2calc=0);
 
  206             const bool verbose=
false,
const bool storehkl=
false,
 
  207             const bool storePredictedHKL=
false);
 
  216       void Evolution(
unsigned int ng,
const bool randomize=
true,
const float f=0.7,
const float cr=0.5,
unsigned int np=100);
 
  217       void SetLengthMinMax(
const float min,
const float max);
 
  218       void SetAngleMinMax(
const float min,
const float max);
 
  219       void SetVolumeMinMax(
const float min,
const float max);
 
  220       void SetNbSpurious(
const unsigned int nb);
 
  223       void SetMinMaxZeroShift(
const float min,
const float max);
 
  225       void SetCrystalCentering(
const CrystalCentering cent);
 
  227       virtual const string& 
GetName() 
const;
 
  228       virtual void Print() 
const;
 
  230       virtual const CrystVector_REAL& 
GetLSQCalc(
const unsigned int) 
const;
 
  231       virtual const CrystVector_REAL & 
GetLSQObs(
const unsigned int) 
const;
 
  232       virtual const CrystVector_REAL & 
GetLSQWeight(
const unsigned int) 
const;
 
  234       virtual void BeginOptimization(
const bool allowApproximations=
false, 
const bool enableRestraints=
false);
 
  235       void LSQRefine(
int nbCycle=1, 
bool useLevenbergMarquardt=
true, 
const bool silent=
false);
 
  241       void DicVol(
const float minScore=10,
const unsigned int minDepth=3,
const float stopOnScore=50.0,
const unsigned int stopOnDepth=6);
 
  248       float GetBestScore()
const;
 
  249       const std::list<std::pair<RecUnitCell,float> >& GetSolutions()
const;
 
  250       std::list<std::pair<RecUnitCell,float> >& GetSolutions();
 
  252       unsigned int RDicVol(
RecUnitCell uc0, 
RecUnitCell uc1, 
unsigned int depth,
unsigned long &nbCalc,
const float minV,
const float maxV,vector<unsigned int> vdepth=vector<unsigned int>());
 
  258       float mLengthMin,mLengthMax;
 
  259       float mAngleMin,mAngleMax;
 
  260       float mVolumeMin,mVolumeMax;
 
  261       float mZeroShiftMin,mZeroShiftMax;
 
  271       unsigned int mNbSpurious;
 
  274       mutable CrystVector_REAL mObs;
 
  275       mutable CrystVector_REAL mCalc;
 
  276       mutable CrystVector_REAL mWeight;
 
  277       mutable CrystVector_REAL mDeriv;
 
  284       float mMinScoreReport;
 
  285       unsigned int mMaxDicVolDepth,mDicVolDepthReport;
 
unsigned int mNbLSQExcept
Number of exceptions caught during LSQ, in a given search - above 20 LSQ is disabled. 
vector< hkl > & GetPeakList()
Get peak list. 
virtual const string & GetName() const 
Name of the object. 
void SetD2Error(const float err)
Allowed error on 1/d (squared!), used for dicvol. 
RecUnitCell mRecUnitCell
Reciprocal unit cell used for least squares refinement. 
float mCosAngMax
Stored value of cos(max ang) for tricilinic search - we do not want to recompute the cos at every dic...
list< hkl > mvPredictedHKL
Full list of calculated HKL positions for a given solution, up to a given resolution After finding a ...
std::list< std::pair< RecUnitCell, float > > mvSolution
Max number of obs reflections to use. 
Algorithm class to find the correct indexing from observed peak positions. 
unsigned long stats
Indexing statistics. 
float EstimateCellVolume(const float dmin, const float dmax, const float nbrefl, const CrystalSystem system, const CrystalCentering centering, const float kappa)
Estimate volume from number of peaks at a given dmin See J. 
CrystalSystem
Different lattice types. 
CrystalCentering mCentering
Centering type. 
float iobs
Observed peak intensity. 
float hkl2d(const float h, const float k, const float l, REAL *derivpar=NULL, const unsigned int derivhkl=0) const 
Compute d*^2 for hkl reflection if deriv != -1, compute derivate versus the corresponding parameter...
Generic Refinable Object. 
Class to store positions of observed reflections. 
bool isIndexed
Is this line indexed ? 
float Score(const PeakList &dhkl, const RecUnitCell &rpar, const unsigned int nbSpurious, const bool verbose, const bool storehkl, const bool storePredictedHKL)
Compute score for a candidate RecUnitCell and a PeakList. 
float d2obs
Observed peak position 1/d^2. 
float d2obsmin
Min value for observed peak position 1/(d+disgma/2)^2. 
vector< hkl > mvHKL
Predict peak positions Best h,k,l for each observed peak (for least-squares refinement) This is store...
virtual const CrystVector_REAL & GetLSQDeriv(const unsigned int, RefinablePar &)
Get the first derivative values for the LSQ function, for a given parameter. 
One set of Miller indices, a possible indexation for a reflection. 
float mAmp[7]
Max amplitude (max=min+amplitude) for all parameters All parameters are treated as periodic for DE (...
float d2calc
Calculated position, 1/d^2. 
std::list< hkl0 > vDicVolHKL
Possible Miller indices, stored during a dichotomy search. 
float d2obsmax
Min value for observed peak position 1/(d-disgma/2)^2. 
CrystalSystem mlattice
Lattice type for which we search. 
void ReduceSolutions(const bool updateReportThreshold=false)
Sort all solutions by score, remove duplicates. 
virtual const CrystVector_REAL & GetLSQCalc(const unsigned int) const 
Get the current calculated value for the LSQ function. 
void DicVol(const float minScore=10, const unsigned int minDepth=3, const float stopOnScore=50.0, const unsigned int stopOnDepth=6)
Run DicVOl algorithm, store only solutions with score >minScore or depth>=minDepth, stop at the end of one volume interval (~400 A^3) if best score>stopOnScore, or if one solution was found at depth>=stopOnDepth. 
virtual const CrystVector_REAL & GetLSQObs(const unsigned int) const 
Get the observed values for the LSQ function. 
REAL par[7]
The 6 parameters defining 1/d_hkl^2 = d*_hkl^2, for different crystal classes, from: d*_hkl^2 = zero ...
float d2diff
1/d^2 difference, obs-calc 
void AddPeak(const float d, const float iobs=1.0, const float dobssigma=0.0, const float iobssigma=0.0, const int h=0, const int k=0, const int l=0, const float d2calc=0)
Add one peak. 
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. 
float iobssigma
Error on observed peak intensity. 
virtual unsigned int GetNbLSQFunction() const 
Number of LSQ functions. 
Lightweight class describing the reciprocal unit cell, for the fast computation of d*_hkl^2...
float mBestScore
Current best score. 
float dobssigma
Error on peak position. 
One observed diffraction line, to be indexed. 
virtual const string & GetClassName() const 
Name for this class ("RefinableObj", "Crystal",...). 
float Simulate(float zero, float a, float b, float c, float alpha, float beta, float gamma, bool deg, unsigned int nb=20, unsigned int nbspurious=0, float sigma=0, float percentMissing=0, const bool verbose=false)
Generate a list of simulated peak positions, from given lattice parameters. 
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++. 
float dobs
Observed peak position 1/d. 
bool isSpurious
Is this an impurity line ? 
Generic class for parameters of refinable objects. 
int h
Miller indices, after line is indexed. 
float mMin[7]
Min values for all parameters (7=unit cell +zero) 
std::vector< unsigned int > mvNbSolutionDepth
Number of solutions found during dicvol search, at each depth. 
void hkl2d_delta(const float h, const float k, const float l, const RecUnitCell &delta, float &dmin, float &dmax) const 
Compute d*^2 for one hkl reflection: this functions computes a d*^2 range (min,max) for a given range...
RecUnitCell(const float zero=0, const float par0=0, const float par1=0, const float par2=0, const float par3=0, const float par4=0, const float par5=0, CrystalSystem lattice=CUBIC, const CrystalCentering cent=LATTICE_P)
light-weight class storing the reciprocal space unitcell 
(Quick & dirty) Least-Squares Refinement Object with Numerical derivatives 
std::vector< float > DirectUnitCell(const bool equiv=false) const 
Compute real space unit cell from reciprocal one. 
virtual const CrystVector_REAL & GetLSQWeight(const unsigned int) const 
Get the weight values for the LSQ function.