FOX/ObjCryst++  1.10.X (development)
ScatteringCorr.cpp
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2002 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include "ObjCryst/ObjCryst/ScatteringCorr.h"
20 #include "ObjCryst/Quirks/VFNStreamFormat.h"
21 #include <stdio.h> //for sprintf()
22 #include <cstdlib>
23 #ifdef __WX__CRYST__
24 namespace ObjCryst
25 {
26  class TexturePhaseMarchDollase;
27 }
28 #include "ObjCryst/wxCryst/wxPowderPattern.h"
29 #endif
30 namespace ObjCryst
31 {
33 //
34 // ScatteringCorr
35 //
37 
39 mpData(&data)
40 {
41  VFN_DEBUG_MESSAGE("ScatteringCorr::ScatteringCorr(&scattData)",5)
42 }
43 
44 ScatteringCorr::~ScatteringCorr()
45 {
46  VFN_DEBUG_MESSAGE("ScatteringCorr::~ScatteringCorr()",5)
47 }
48 
49 const CrystVector_REAL& ScatteringCorr::GetCorr() const
50 {
51  this->CalcCorr();
52  return mCorr;
53 }
54 
57 //
58 // LorentzCorr
59 //
61 LorentzCorr::LorentzCorr(const ScatteringData & data):
62 ScatteringCorr(data)
63 {}
64 
65 LorentzCorr::~LorentzCorr()
66 {}
67 
68 const string & LorentzCorr::GetName() const
69 {
70  //So far, we do not need a personalized name...
71  const static string mName="LorentzCorr";
72  return mName;
73 }
74 
75 const string & LorentzCorr::GetClassName() const
76 {
77  const static string className="LorentzCorr";
78  return className;
79 }
80 
82 {
83  const CrystVector_REAL *theta=&(mpData->GetTheta());
84  if(mpData->GetClockTheta()<mClockCorrCalc) return;
85  TAU_PROFILE("LorentzCorr::CalcCorr()","void ()",TAU_DEFAULT);
86  mCorr.resize(mpData->GetNbRefl());
87  for(long i=0;i<mpData->GetNbRefl();i++)mCorr(i) =1/sin(2*(*theta)(i));
89 }
90 
92 //
93 // PolarizationCorr
94 //
96 PolarizationCorr::PolarizationCorr(const ScatteringData & data):
97 ScatteringCorr(data),mPolarAfactor(1)
98 {}
99 
100 PolarizationCorr::~PolarizationCorr()
101 {}
102 
103 const string & PolarizationCorr::GetName() const
104 {
105  //So far, we do not need a personalized name...
106  const static string mName="PolarizationCorr";
107  return mName;
108 }
109 
110 const string & PolarizationCorr::GetClassName() const
111 {
112  const static string className="PolarizationCorr";
113  return className;
114 }
115 
117 {
118  const CrystVector_REAL *theta=&(mpData->GetTheta());
119  const REAL f=mpData->GetRadiation().GetLinearPolarRate();
121  && (fabs(mPolarAfactor-((1-f)/(1+f))) <(mPolarAfactor*.0001)) ) return;
122  VFN_DEBUG_MESSAGE("PolarizationCorr::CalcCorr()",10)
123  TAU_PROFILE("PolarizationCorr::CalcCorr()","void ()",TAU_DEFAULT);
124  mPolarAfactor=((1-f)/(1+f));
125  mCorr.resize(mpData->GetNbRefl());
126  // cos^2(2*theta)=0.5+0.5*cos(4*theta)
127  for(long i=0;i<mpData->GetNbRefl();i++)
128  mCorr(i) =(1.+mPolarAfactor*(0.5+0.5*cos(4*(*theta)(i))))/(1.+mPolarAfactor);
130 }
131 
132 
134 //
135 // PowderSlitApertureCorr
136 //
138 PowderSlitApertureCorr::PowderSlitApertureCorr(const ScatteringData & data):
139 ScatteringCorr(data)
140 {}
141 
142 PowderSlitApertureCorr::~PowderSlitApertureCorr()
143 {}
144 
145 const string & PowderSlitApertureCorr::GetName() const
146 {
147  //So far, we do not need a personalized name...
148  const static string mName="PowderSlitApertureCorr";
149  return mName;
150 }
151 
153 {
154  const static string className="PowderSlitApertureCorr";
155  return className;
156 }
157 
159 {
160  const CrystVector_REAL *theta=&(mpData->GetTheta());
161  if(mpData->GetClockTheta()<mClockCorrCalc) return;
162  TAU_PROFILE("PowderSlitApertureCorr::CalcCorr()","void ()",TAU_DEFAULT);
163  mCorr.resize(mpData->GetNbRefl());
164  for(long i=0;i<mpData->GetNbRefl();i++)mCorr(i) =1/sin((*theta)(i));
166 }
168 //
169 // TexturePhaseMarchDollase
170 //
172 TexturePhaseMarchDollase::TexturePhaseMarchDollase(const REAL f,
173  const REAL c,
174  const REAL h,
175  const REAL k,
176  const REAL l,
177  TextureMarchDollase &tex):
178 mFraction(f),mMarchCoeff(c),mH(h),mK(k),mL(l),mpTextureMarchDollase(&tex)
179 #ifdef __WX__CRYST__
180 ,mpWXCrystObj(0)
181 #endif
182 {}
183 
184 TexturePhaseMarchDollase::~TexturePhaseMarchDollase()
185 {
186  #ifdef __WX__CRYST__
187  this->WXDelete();
188  #endif
189 }
190 const string& TexturePhaseMarchDollase::GetClassName()const
191 {
192  const static string className="March-Dollase Texture Phase";
193  return className;
194 }
195 const string& TexturePhaseMarchDollase::GetName()const
196 {
197  const static string name="March-Dollase Texture Phase";
198  return name;
199 }
200 
201 void TexturePhaseMarchDollase::SetPar(const REAL f, const REAL c,const REAL h,const REAL k, const REAL l)
202 {mFraction=f;mMarchCoeff=c;mH=h;mK=k;mL=l;}
203 void TexturePhaseMarchDollase::XMLOutput(ostream &os,int indent)const
204 {
205  VFN_DEBUG_ENTRY("TexturePhaseMarchDollase::XMLOutput():"<<this->GetName(),5)
206  for(int i=0;i<indent;i++) os << " " ;
207  XMLCrystTag tag("TexturePhaseMarchDollase");
208  os <<tag<<endl;
209  indent++;
210 
211  mpTextureMarchDollase->GetPar(&mFraction).XMLOutput(os,"Fraction",indent);
212  os <<endl;
213 
214  mpTextureMarchDollase->GetPar(&mMarchCoeff).XMLOutput(os,"MarchCoeff",indent);
215  os <<endl;
216 
217  mpTextureMarchDollase->GetPar(&mH).XMLOutput(os,"H",indent);
218  os <<endl;
219 
220  mpTextureMarchDollase->GetPar(&mK).XMLOutput(os,"K",indent);
221  os <<endl;
222 
223  mpTextureMarchDollase->GetPar(&mL).XMLOutput(os,"L",indent);
224  os <<endl;
225 
226  indent--;
227  tag.SetIsEndTag(true);
228  for(int i=0;i<indent;i++) os << " " ;
229  os <<tag<<endl;
230  VFN_DEBUG_EXIT("TexturePhaseMarchDollase::XMLOutput():"<<this->GetName(),5)
231 }
232 
233 void TexturePhaseMarchDollase::XMLInput(istream &is,const XMLCrystTag &tagg)
234 {
235  VFN_DEBUG_ENTRY("TexturePhaseMarchDollase::XMLInput():",5)
236  for(unsigned int i=0;i<tagg.GetNbAttribute();i++)
237  {
238  //No attribute to read
239  }
240  while(true)
241  {
242  XMLCrystTag tag(is);
243  if(("TexturePhaseMarchDollase"==tag.GetName())&&tag.IsEndTag())
244  {
245  VFN_DEBUG_EXIT("TexturePhaseMarchDollase::XMLInput()",5)
246  return;
247  }
248  if("Par"==tag.GetName())
249  {
250  for(unsigned int i=0;i<tag.GetNbAttribute();i++)
251  {
252  if("Name"==tag.GetAttributeName(i))
253  {
254  if("Fraction"==tag.GetAttributeValue(i))
255  {
256  mpTextureMarchDollase->GetPar(&mFraction).XMLInput(is,tag);
257  break;
258  }
259  if("MarchCoeff"==tag.GetAttributeValue(i))
260  {
261  mpTextureMarchDollase->GetPar(&mMarchCoeff).XMLInput(is,tag);
262  break;
263  }
264  if("H"==tag.GetAttributeValue(i))
265  {
266  mpTextureMarchDollase->GetPar(&mH).XMLInput(is,tag);
267  break;
268  }
269  if("K"==tag.GetAttributeValue(i))
270  {
271  mpTextureMarchDollase->GetPar(&mK).XMLInput(is,tag);
272  break;
273  }
274  if("L"==tag.GetAttributeValue(i))
275  {
276  mpTextureMarchDollase->GetPar(&mL).XMLInput(is,tag);
277  break;
278  }
279  }
280  }
281  continue;
282  }
283  }
284 }
285 
286 
287 #ifdef __WX__CRYST__
288 WXCrystObjBasic* TexturePhaseMarchDollase::WXCreate(wxWindow* parent)
289 {
290  mpWXCrystObj=new WXTexturePhaseMarchDollase(parent,this,mpTextureMarchDollase);
291  return mpWXCrystObj;
292 }
293 WXCrystObjBasic* TexturePhaseMarchDollase::WXGet()
294 {
295  return mpWXCrystObj;
296 }
297 
298 void TexturePhaseMarchDollase::WXDelete()
299 {
300  if(0!=mpWXCrystObj)
301  {
302  VFN_DEBUG_MESSAGE("TexturePhaseMarchDollase::WXDelete()",5)
303  delete mpWXCrystObj;
304  }
305 }
306 void TexturePhaseMarchDollase::WXNotifyDelete(){mpWXCrystObj=0;}
307 #endif
308 //
310 // TextureMarchDollase
311 //
313 TextureMarchDollase::TextureMarchDollase(const ScatteringData & data):
314 ScatteringCorr(data),mNbReflUsed(0)
315 {
316  mClockMaster.AddChild(mClockTexturePar);
317 }
318 
319 TextureMarchDollase::~TextureMarchDollase()
320 {
321 }
322 
323 const string & TextureMarchDollase::GetName() const
324 {
325  //So far, we do not need a personalized name...
326  const static string name="TextureMarchDollase";
327  return name;
328 }
329 
330 const string & TextureMarchDollase::GetClassName() const
331 {
332  //So far, we do not need a personalized name...
333  const static string name="TextureMarchDollase";
334  return name;
335 }
336 
337 void TextureMarchDollase::AddPhase(const REAL f, const REAL c,
338  const REAL h,const REAL k, const REAL l)
339 
340 {
341  VFN_DEBUG_ENTRY("TextureMarchDollase::AddPhase()",5)
342  TexturePhaseMarchDollase* phase=new TexturePhaseMarchDollase(f,c,h,k,l,*this);
343  this->Print();
344  //Add parameters
345  const unsigned int nbPhase=this->GetNbPhase();
346  char buf [5];
347  sprintf(buf,"%d",nbPhase);
348  {
349  RefinablePar tmp("Fraction_"+(string)buf,&(phase->mFraction),0.,1.,
351  REFPAR_DERIV_STEP_ABSOLUTE,true,true,true,false,1.);
352  tmp.AssignClock(mClockTexturePar);
353  tmp.SetDerivStep(1e-7);
354  tmp.SetGlobalOptimStep(.05);
355  this->AddPar(tmp);
356  }
357  {
358  RefinablePar tmp("MarchCoeff_"+(string)buf,&(phase->mMarchCoeff),.1,10.,
360  REFPAR_DERIV_STEP_ABSOLUTE,true,true,true,false,1.);
361  tmp.AssignClock(mClockTexturePar);
362  tmp.SetDerivStep(1e-7);
363  tmp.SetGlobalOptimStep(.1);
364  this->AddPar(tmp);
365  }
366  {
367  RefinablePar tmp("H_"+(string)buf,&(phase->mH),-10.,10.,
369  REFPAR_DERIV_STEP_ABSOLUTE,false,true,true,false,1.);
370  tmp.AssignClock(mClockTexturePar);
371  tmp.SetDerivStep(1e-7);
372  tmp.SetGlobalOptimStep(.01);
373  this->AddPar(tmp);
374  }
375  {
376  RefinablePar tmp("K_"+(string)buf,&(phase->mK),-10.,10.,
378  REFPAR_DERIV_STEP_ABSOLUTE,false,true,true,false,1.);
379  tmp.AssignClock(mClockTexturePar);
380  tmp.SetDerivStep(1e-7);
381  tmp.SetGlobalOptimStep(.01);
382  this->AddPar(tmp);
383  }
384  {
385  RefinablePar tmp("L_"+(string)buf,&(phase->mL),-10.,10.,
387  REFPAR_DERIV_STEP_ABSOLUTE,false,true,true,false,1.);
388  tmp.AssignClock(mClockTexturePar);
389  tmp.SetDerivStep(1e-7);
390  tmp.SetGlobalOptimStep(.01);
391  this->AddPar(tmp);
392  }
393  this->Print();
394 
395  mPhaseRegistry.Register(*phase);
396  VFN_DEBUG_EXIT("TextureMarchDollase::AddPhase()=",5)
397 }
398 
399 void TextureMarchDollase::SetPhasePar(const unsigned int i, const REAL f, const REAL c,
400  const REAL h,const REAL k, const REAL l)
401 {
402  mPhaseRegistry.GetObj(i).SetPar(f,c,h,k,l);
403 }
404 
405 //void DeletePhase(const unsigned int i);
406 
407 unsigned int TextureMarchDollase::GetNbPhase() const {return mPhaseRegistry.GetNb();}
408 
409 REAL TextureMarchDollase::GetFraction(const unsigned int i)const
410 {return mPhaseRegistry.GetObj(i).mFraction;}
411 
412 REAL TextureMarchDollase::GetMarchCoeff(const unsigned int i)const
413 {return mPhaseRegistry.GetObj(i).mMarchCoeff;}
414 
415 REAL TextureMarchDollase::GetPhaseH(const unsigned int i)const
416 {return mPhaseRegistry.GetObj(i).mH;}
417 
418 REAL TextureMarchDollase::GetPhaseK(const unsigned int i)const
419 {return mPhaseRegistry.GetObj(i).mK;}
420 
421 REAL TextureMarchDollase::GetPhaseL(const unsigned int i)const
422 {return mPhaseRegistry.GetObj(i).mL;}
423 
424 void TextureMarchDollase::GlobalOptRandomMove(const REAL mutationAmplitude,
425  const RefParType *type)
426 {
427  if(mRandomMoveIsDone) return;
429  {
430  mRandomMoveIsDone=true;
431  return;
432  }
433  //if((rand()/(REAL)RAND_MAX)<.3)//only 30% proba to make a random move
434  {
435  VFN_DEBUG_MESSAGE("TextureMarchDollase::GlobalOptRandomMove()",1)
436  for(unsigned int i=0;i<this->GetNbPhase();i++)
437  {
438  // :TODO: Give some probability (1% ?) to invert the March coefficient
439  // with a direction perpendicular to the current one ?
440 
441  RefinablePar *pF=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mFraction)));
442  RefinablePar *pM=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mMarchCoeff)));
443  RefinablePar *pH=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mH)));
444  RefinablePar *pK=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mK)));
445  RefinablePar *pL=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mL)));
446  if(pF->IsFixed()==false)
447  {
448  const REAL delta=pF->GetGlobalOptimStep()*mutationAmplitude;
449  const REAL sig=4*delta;
450  const REAL y0=mPhaseRegistry.GetObj(i).mBiasFraction;
451  REAL y,ymin,ymax;
452  y=pF->GetValue();
453 
454  ymax=.5+1/M_PI*atan((y+delta-y0)/(2.*sig));
455  ymin=.5+1/M_PI*atan((y-delta-y0)/(2.*sig));
456  y=ymin+rand()/(REAL)RAND_MAX*(ymax-ymin);
457  y-=.5;
458  if(y<-.499)y=-.499;//Should not happen but make sure we remain in [-pi/2;pi/2]
459  if(y> .499)y= .499;
460  pF->MutateTo(y0+2*sig*tan(M_PI*y));
461  }
462  if((pH->IsFixed()==false)||(pK->IsFixed()==false)||(pL->IsFixed()==false))
463  {
464  REAL tx=pH->GetValue();
465  REAL ty=pK->GetValue();
466  REAL tz=pL->GetValue();
468  {
469  REAL tx0=mPhaseRegistry.GetObj(i).mBiasH;
470  REAL ty0=mPhaseRegistry.GetObj(i).mBiasK;
471  REAL tz0=mPhaseRegistry.GetObj(i).mBiasL;
473  const REAL delta=pH->GetGlobalOptimStep()*mutationAmplitude*mPhaseRegistry.GetObj(i).mNorm;
474  const REAL sig=2*delta;
475  REAL y,ymin,ymax;
476 
477  ymax=.5+1/M_PI*atan((tx+delta-tx0)/(2.*sig));
478  ymin=.5+1/M_PI*atan((tx-delta-tx0)/(2.*sig));
479  y=ymin+rand()/(REAL)RAND_MAX*(ymax-ymin);
480  y-=.5;
481  if(y<-.499)y=-.499;
482  if(y> .499)y= .499;
483  tx=tx0+2*sig*tan(M_PI*y);
484 
485  ymax=.5+1/M_PI*atan((ty+delta-ty0)/(2.*sig));
486  ymin=.5+1/M_PI*atan((ty-delta-ty0)/(2.*sig));
487  y=ymin+rand()/(REAL)RAND_MAX*(ymax-ymin);
488  y-=.5;
489  if(y<-.499)y=-.499;
490  if(y> .499)y= .499;
491  ty=ty0+2*sig*tan(M_PI*y);
492 
493  ymax=.5+1/M_PI*atan((tz+delta-tz0)/(2.*sig));
494  ymin=.5+1/M_PI*atan((tz-delta-tz0)/(2.*sig));
495  y=ymin+rand()/(REAL)RAND_MAX*(ymax-ymin);
496  y-=.5;
497  if(y<-.499)y=-.499;
498  if(y> .499)y= .499;
499  tz=tz0+2*sig*tan(M_PI*y);
500  }
501  const REAL factor=mPhaseRegistry.GetObj(i).mNorm/sqrt(tx*tx+ty*ty+tz*tz);
502  tx *= factor;
503  ty *= factor;
504  tz *= factor;
506  pH->MutateTo(tx);
507  pK->MutateTo(ty);
508  pL->MutateTo(tz);
509  }
510  if(pM->IsFixed()==false)
511  {
512  // Given the nature of this param, we use a proportionnal max step
513  const REAL delta=pM->GetGlobalOptimStep()*mutationAmplitude;
514  const REAL sig=2*delta;
515  REAL y,ymin,ymax;
516  y=log(pM->GetValue());
517  const REAL y0=log(mPhaseRegistry.GetObj(i).mBiasMarchCoeff);
518 
519  ymin=.5+1/M_PI*atan((y-delta-y0)/(2.*sig));
520  ymax=.5+1/M_PI*atan((y+delta-y0)/(2.*sig));
521  y=ymin+rand()/(REAL)RAND_MAX*(ymax-ymin);
522  y-=.5;
523  if(y<-.499)y=-.499;
524  if(y> .499)y= .499;
525  pM->MutateTo(exp(y0+2*sig*tan(M_PI*y)));
526  }
527  }
528  }
529  //this->RefinableObj::Print();
530  mRandomMoveIsDone=true;
531 }
532 REAL TextureMarchDollase::GetBiasingCost()const
533 {
534  REAL cost=0;
535  REAL tmp;
536  for(unsigned int i=0; i<this->GetNbPhase();i++)
537  {
538  tmp =(mPhaseRegistry.GetObj(i).mBiasFraction-mPhaseRegistry.GetObj(i).mFraction)/.04;
539  cost += tmp*tmp;
540 
541  tmp =log10(mPhaseRegistry.GetObj(i).mBiasMarchCoeff/mPhaseRegistry.GetObj(i).mMarchCoeff)/.04;
542  cost += tmp*tmp;
543 
544  REAL tx=mPhaseRegistry.GetObj(i).mH-mPhaseRegistry.GetObj(i).mBiasH;
545  REAL ty=mPhaseRegistry.GetObj(i).mK-mPhaseRegistry.GetObj(i).mBiasK;
546  REAL tz=mPhaseRegistry.GetObj(i).mL-mPhaseRegistry.GetObj(i).mBiasL;
548 
549  cost +=(tx*tx+ty*ty+tz*tz)/mPhaseRegistry.GetObj(i).mNorm/.04;
550  }
551  VFN_DEBUG_MESSAGE("TextureMarchDollase::GetBiasingCost()="<<cost<<"("<<mName<<")",1)
552  return cost;
553 }
554 void TextureMarchDollase::XMLOutput(ostream &os,int indent)const
555 {
556  VFN_DEBUG_ENTRY("TextureMarchDollase::XMLOutput():",5)
557  for(int i=0;i<indent;i++) os << " " ;
558  XMLCrystTag tag("TextureMarchDollase");
559  os <<tag<<endl;
560  indent++;
561 
562  for(int i=0;i<mPhaseRegistry.GetNb();i++) mPhaseRegistry.GetObj(i).XMLOutput(os,indent);
563 
564  indent--;
565  tag.SetIsEndTag(true);
566  for(int i=0;i<indent;i++) os << " " ;
567  os <<tag<<endl;
568  VFN_DEBUG_EXIT("TextureMarchDollase::XMLOutput():"<<this->GetName(),5)
569 }
570 
571 void TextureMarchDollase::XMLInput(istream &is,const XMLCrystTag &tagg)
572 {
573  VFN_DEBUG_ENTRY("TextureMarchDollase::XMLInput():"<<this->GetName(),5)
574  for(unsigned int i=0;i<tagg.GetNbAttribute();i++)
575  {
576  // No attribute to read
577  }
578  while(true)
579  {
580  XMLCrystTag tag(is);
581  if(("TextureMarchDollase"==tag.GetName())&&tag.IsEndTag())
582  {
583  VFN_DEBUG_EXIT("TextureMarchDollase::XMLInput()",5)
584  return;
585  }
586  if("TexturePhaseMarchDollase"==tag.GetName())
587  {
588  const long nb=mPhaseRegistry.GetNb();
589  this->AddPhase(0.,1.,1.,0.,0.);
590  mPhaseRegistry.GetObj(nb).XMLInput(is,tag);
591  }
592  }
593 }
594 void TextureMarchDollase::BeginOptimization(const bool allowApproximations,
595  const bool enableRestraints)
596 {
597  for(unsigned int i=0; i<this->GetNbPhase();i++)
598  {
599  RefinablePar *pH=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mH)));
600  RefinablePar *pK=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mK)));
601  RefinablePar *pL=&(this->GetPar(&(mPhaseRegistry.GetObj(i).mL)));
602  if((pH->IsFixed()==false)||(pK->IsFixed()==false)||(pL->IsFixed()==false))
603  {
604  pH->SetIsFixed(false);
605  pK->SetIsFixed(false);
606  pL->SetIsFixed(false);
607  }
608  REAL tx=pH->GetValue();
609  REAL ty=pK->GetValue();
610  REAL tz=pL->GetValue();
612  mPhaseRegistry.GetObj(i).mNorm=sqrt(tx*tx+ty*ty+tz*tz);
613  // Something went wrong, preferred orientation vector has null norm !
614  if(mPhaseRegistry.GetObj(i).mNorm<1e-6) mPhaseRegistry.GetObj(i).mNorm=1;
615  }
616  this->RefinableObj::BeginOptimization(allowApproximations,enableRestraints);
617 }
619 {
620  for(unsigned int i=0; i<this->GetNbPhase();i++)
621  {
622  mPhaseRegistry.GetObj(i).mBiasFraction =mPhaseRegistry.GetObj(i).mFraction;
623  mPhaseRegistry.GetObj(i).mBiasMarchCoeff=mPhaseRegistry.GetObj(i).mMarchCoeff;
624  mPhaseRegistry.GetObj(i).mBiasH =mPhaseRegistry.GetObj(i).mH;
625  mPhaseRegistry.GetObj(i).mBiasK =mPhaseRegistry.GetObj(i).mK;
626  mPhaseRegistry.GetObj(i).mBiasL =mPhaseRegistry.GetObj(i).mL;
627  }
628 }
629 
631 {
632  if(this->GetNbPhase()==0)
633  {
634  mCorr.resize(0);
635  return;
636  }
637  const long nbReflUsed=mpData->GetNbReflBelowMaxSinThetaOvLambda();
638  if( (mClockTexturePar<mClockCorrCalc)
639  &&(mpData->GetClockTheta()<mClockCorrCalc)) return;
640  VFN_DEBUG_ENTRY("TextureMarchDollase::CalcCorr()",3)
641  TAU_PROFILE("TextureMarchDollase::CalcCorr()","void ()",TAU_DEFAULT);
642  // normalizer for the sum of fractions, and non-texture fraction
643  // (the sum of fractions must be equal to 1, but we cannot
644  // modify fractions here since this is a const function)
645  REAL fractionNorm=0,nonTexturedFraction;
646  for(unsigned int i=0; i<this->GetNbPhase();i++) fractionNorm+=this->GetFraction(i);
647  if(fractionNorm<1)
648  {
649  nonTexturedFraction= 1.-fractionNorm;
650  fractionNorm=1.;
651  }
652  else nonTexturedFraction=0.;
653  //compute correction for each phase
654  const long nbRefl=mpData->GetNbRefl();
655  mCorr.resize(nbRefl);
656  mCorr=nonTexturedFraction;
657  CrystVector_REAL reflNorm(nbRefl);
658  {
659  const REAL *xx=mpData->GetReflX().data();
660  const REAL *yy=mpData->GetReflY().data();
661  const REAL *zz=mpData->GetReflZ().data();
662  for(long i=0;i<nbReflUsed;i++)
663  {
664  reflNorm(i)= sqrt(*xx * *xx + *yy * *yy + *zz * *zz);
665  xx++;yy++;zz++;
666  }
667  }
668  CrystMatrix_REAL hkl;
669  for(unsigned int i=0; i<this->GetNbPhase();i++)
670  {
671  // We are using multiplicity for powder diffraction, therefore with only
672  // unique reflections. But Equivalent reflections do not have the same
673  // texture correction ! So we must use the symmetry oprators, and it is simpler
674  // to apply the symmetries to the texture vector than to all reflections
676  .GetAllEquivRefl(this->GetPhaseH(i),this->GetPhaseK(i),this->GetPhaseL(i),true);
677  //coefficients
678  const REAL march=1./(this->GetMarchCoeff(i)+1e-6);
679  const REAL march2=this->GetMarchCoeff(i)*this->GetMarchCoeff(i)-march;
680  // Normalized by the number of symmetrical reflections
681  const REAL frac=this->GetFraction(i)/(fractionNorm+1e-6)/hkl.rows();
682 
683  for(long j=0;j<hkl.rows();j++)
684  {
685  //orthonormal coordinates for T (texture) vector
686  REAL tx=hkl(j,0),
687  ty=hkl(j,1),
688  tz=hkl(j,2);
689  // reflection coordinates
690  const REAL *xx=mpData->GetReflX().data();
691  const REAL *yy=mpData->GetReflY().data();
692  const REAL *zz=mpData->GetReflZ().data();
693  const REAL *xyznorm=reflNorm.data();
694  {
696  const REAL norm=sqrt(tx*tx+ty*ty+tz*tz);
697  tx/=(norm+1e-6);
698  ty/=(norm+1e-6);
699  tz/=(norm+1e-6);
700  }
701  // Calculation
702  REAL tmp;
703  for(long k=0;k<nbReflUsed;k++)
704  {
705  tmp=(tx * (*xx++) + ty * (*yy++) + tz * (*zz++))/ (*xyznorm++);
706  tmp=march+march2*tmp*tmp;
707  if(tmp<0) tmp=0;// rounding errors ?
708  mCorr(k)+=frac*pow((float)tmp,(float)-1.5);
709  }
710  }
711  }
712  //if(this->IsbeingRefined()==false)
713  //{
714  // cout <<FormatVertVectorHKLFloats<REAL>(mpData->GetH(),
715  // mpData->GetK(),
716  // mpData->GetL(),
717  // mpData->GetSinThetaOverLambda(),
718  // mCorr)<<endl;
719  // this->Print();
720  //}
722  VFN_DEBUG_EXIT("TextureMarchDollase::CalcCorr()",3)
723 }
724 void TextureMarchDollase::DeleteAllPhase()
725 {
726 }
727 
728 #ifdef __WX__CRYST__
729 WXCrystObjBasic* TextureMarchDollase::WXCreate(wxWindow* parent)
730 {
731  //:TODO: Check mpWXCrystObj==0
732  //mpWXCrystObj=new WXTextureMarchDollase(parent,this);
733  return mpWXCrystObj;
734 }
735 #endif
736 
738 //
739 // TextureEllipsoid
740 //
742 TextureEllipsoid::TextureEllipsoid(const ScatteringData & data,
743  const REAL EPR1, const REAL EPR2, const REAL EPR3,
744  const REAL EPR4, const REAL EPR5, const REAL EPR6):
746 {
747  mClockMaster.AddChild(mClockTextureEllipsoidPar);
748  mEPR[0]=EPR1;
749  mEPR[1]=EPR2;
750  mEPR[2]=EPR3;
751  mEPR[3]=EPR4;
752  mEPR[4]=EPR5;
753  mEPR[5]=EPR6;
754  InitRefParList();
755 }
756 
757 TextureEllipsoid::~TextureEllipsoid()
758 {
759  #ifdef __WX__CRYST__
760  if(mpWXCrystObj!=0)
761  {
762  delete mpWXCrystObj;
763  mpWXCrystObj=0;
764  }
765  #endif
766 }
767 
768 const string & TextureEllipsoid::GetName() const
769 {
770  //So far, we do not need a personalized name...
771  const static string name="TextureEllipsoid";
772  return name;
773 }
774 
775 const string & TextureEllipsoid::GetClassName() const
776 {
777  //So far, we do not need a personalized name...
778  const static string name="TextureEllipsoid";
779  return name;
780 }
781 
782 void TextureEllipsoid::SetParams(const REAL EPR1, const REAL EPR2, const REAL EPR3,
783  const REAL EPR4, const REAL EPR5, const REAL EPR6)
784 {
785  mEPR[0]=EPR1;
786  mEPR[1]=EPR2;
787  mEPR[2]=EPR3;
788  mEPR[3]=EPR4;
789  mEPR[4]=EPR5;
790  mEPR[5]=EPR6;
792 }
793 
794 void TextureEllipsoid::GlobalOptRandomMove(const REAL mutationAmplitude,
795  const RefParType *type)
796 {
797  if(mRandomMoveIsDone) return;
798  /*
799  if(!(gpRefParTypeScattDataCorrInt->IsDescendantFromOrSameAs(type)))
800  {
801  mRandomMoveIsDone=true;
802  return;
803  }
804  */
805  {
806  VFN_DEBUG_MESSAGE("TextureEllipsoid::GlobalOptRandomMove()",1)
807 
808  RefinablePar *pEPR[6];
809  for (int i=0; i<6; i++)
810  {
811  pEPR[i] = &(this->GetPar(&(mEPR[i])));
812  if (pEPR[i]->IsFixed()==false)
813  pEPR[i]->Mutate(pEPR[i]->GetGlobalOptimStep()*2*(rand()/(REAL)RAND_MAX-0.5)*mutationAmplitude);
814  }
816  }
817  //this->RefinableObj::Print();
818  mRandomMoveIsDone=true;
819 }
820 void TextureEllipsoid::XMLOutput(ostream &os,int indent)const
821 {
822  if((mEPR[0]==0) && (mEPR[1]==0) && (mEPR[2]==0) && (mEPR[3]==0) && (mEPR[4]==0) && (mEPR[5]==0))
823  return;
824  VFN_DEBUG_ENTRY("TextureEllipsoid::XMLOutput():"<<this->GetName(),5)
825  for(int i=0;i<indent;i++) os << " " ;
826  XMLCrystTag tag("TextureEllipsoid");
827  os <<tag<<endl;
828  indent++;
829 
830  GetPar(&mEPR[0]).XMLOutput(os,"EPR1",indent);
831  os <<endl;
832  GetPar(&mEPR[1]).XMLOutput(os,"EPR2",indent);
833  os <<endl;
834  GetPar(&mEPR[2]).XMLOutput(os,"EPR3",indent);
835  os <<endl;
836  GetPar(&mEPR[3]).XMLOutput(os,"EPR4",indent);
837  os <<endl;
838  GetPar(&mEPR[4]).XMLOutput(os,"EPR5",indent);
839  os <<endl;
840  GetPar(&mEPR[5]).XMLOutput(os,"EPR6",indent);
841  os <<endl;
842 
843  indent--;
844  tag.SetIsEndTag(true);
845  for(int i=0;i<indent;i++) os << " " ;
846  os <<tag<<endl;
847  VFN_DEBUG_EXIT("TextureEllipsoid::XMLOutput():"<<this->GetName(),5)
848 }
849 
850 void TextureEllipsoid::XMLInput(istream &is,const XMLCrystTag &tagg)
851 {
852  VFN_DEBUG_ENTRY("TextureEllipsoid::XMLInput():"<<this->GetName(),5)
853  for(unsigned int i=0;i<tagg.GetNbAttribute();i++)
854  {
855  //No attribute to read
856  }
857  while(true)
858  {
859  XMLCrystTag tag(is);
860  if(("TextureEllipsoid"==tag.GetName())&&tag.IsEndTag())
861  {
862  VFN_DEBUG_EXIT("TextureEllipsoid::XMLInput()",5)
863  return;
864  }
865  if("Par"==tag.GetName())
866  {
867  for(unsigned int i=0;i<tag.GetNbAttribute();i++)
868  {
869  if("Name"==tag.GetAttributeName(i))
870  {
871  if("EPR1"==tag.GetAttributeValue(i))
872  {
873  GetPar(&mEPR[0]).XMLInput(is,tag);
874  break;
875  }
876  if("EPR2"==tag.GetAttributeValue(i))
877  {
878  GetPar(&mEPR[1]).XMLInput(is,tag);
879  break;
880  }
881  if("EPR3"==tag.GetAttributeValue(i))
882  {
883  GetPar(&mEPR[2]).XMLInput(is,tag);
884  break;
885  }
886  if("EPR4"==tag.GetAttributeValue(i))
887  {
888  GetPar(&mEPR[3]).XMLInput(is,tag);
889  break;
890  }
891  if("EPR5"==tag.GetAttributeValue(i))
892  {
893  GetPar(&mEPR[4]).XMLInput(is,tag);
894  break;
895  }
896  if("EPR6"==tag.GetAttributeValue(i))
897  {
898  GetPar(&mEPR[5]).XMLInput(is,tag);
899  break;
900  }
901  }
902  }
903  continue;
904  }
905  }
907 }
908 void TextureEllipsoid::BeginOptimization(const bool allowApproximations,
909  const bool enableRestraints)
910 {
911  this->RefinableObj::BeginOptimization(allowApproximations,enableRestraints);
912 }
913 
915 {
916  if((mEPR[0]==0) && (mEPR[1]==0) && (mEPR[2]==0) && (mEPR[3]==0) && (mEPR[4]==0) && (mEPR[5]==0))
917  {
918  mCorr.resize(0);
919  return;
920  }
921  const long nbReflUsed=mpData->GetNbReflBelowMaxSinThetaOvLambda();
922  if( (mClockTextureEllipsoidPar<mClockCorrCalc)
925  VFN_DEBUG_ENTRY("TextureEllipsoid::CalcCorr()",3)
926  TAU_PROFILE("TextureEllipsoid::CalcCorr()","void ()",TAU_DEFAULT)
927 
928  //compute correction
929  const long nbRefl=mpData->GetNbRefl();
930  mCorr.resize(nbRefl);
933  REAL tmp, dhkl;
934  REAL sum=0;
935  REAL *pCorr=mCorr.data();
936  const REAL *pH=mpData->GetH().data();
937  const REAL *pK=mpData->GetH().data();
938  const REAL *pL=mpData->GetH().data();
939  const REAL *pstol=mpData->GetSinThetaOverLambda().data();
940  for(long i=0;i<nbReflUsed;i++)
941  {
942  dhkl=1.0/(2* (*pstol++));
943  dhkl=0.001*dhkl*dhkl;
944  tmp=(mEPR[0]* (*pH) * (*pH) +
945  mEPR[1]* (*pK) * (*pK) +
946  mEPR[2]* (*pL) * (*pL) +
947  mEPR[3]*2* (*pH) * (*pK) +
948  mEPR[4]*2* (*pH) * (*pL) +
949  mEPR[5]*2* (*pK) * (*pL)) *
950  dhkl;
951  if(tmp<0) tmp=0;// rounding errors ?
952  tmp=pow((float)(1.0+tmp),(float)-1.5);
953  *pCorr++=tmp;
954  sum+=tmp;
955  pH++;pK++;pL++;
956  }
957  // Normalize correction to 1
958  tmp=nbReflUsed/sum;
959  pCorr=mCorr.data();
960  for(long i=0;i<nbReflUsed;i++)
961  {
962  *pCorr++ *=tmp;
963  }
965  VFN_DEBUG_EXIT("TextureEllipsoid::CalcCorr()",3)
966 }
967 
969 {
970  VFN_DEBUG_ENTRY("TextureEllipsoid::UpdateEllipsoidPar().",3)
971  int num = 1;
972  if (mpData!=NULL)
973  if (mpData->HasCrystal())
975 
976  bool bEPR [6];
977  for (int i=0; i<6; i++)
978  bEPR[i] = true;
979 
980  if(num <=2)
981  {
982  }
983  else if((num <=15) && (0==mpData->GetCrystal().GetSpaceGroup().GetUniqueAxis()))
984  {
985  mEPR[4]=0.0;
986  mEPR[5]=0.0;
987  bEPR[4]=false;
988  bEPR[5]=false;
989  }
990  else if((num <=15) && (1==mpData->GetCrystal().GetSpaceGroup().GetUniqueAxis()))
991  {
992  mEPR[3]=0.0;
993  mEPR[5]=0.0;
994  bEPR[3]=false;
995  bEPR[5]=false;
996  }
997  else if((num <=15) && (2==mpData->GetCrystal().GetSpaceGroup().GetUniqueAxis()))
998  {
999  mEPR[3]=0.0;
1000  mEPR[4]=0.0;
1001  bEPR[3]=false;
1002  bEPR[4]=false;
1003  }
1004  else if(num <=74)
1005  {
1006  mEPR[3]=0.0;
1007  mEPR[4]=0.0;
1008  mEPR[5]=0.0;
1009  bEPR[3]=false;
1010  bEPR[4]=false;
1011  bEPR[5]=false;
1012  }
1013  else if(num <= 142)
1014  {
1015  mEPR[1]=mEPR[0];
1016  mEPR[3]=0.0;
1017  mEPR[4]=0.0;
1018  mEPR[5]=0.0;
1019  bEPR[1]=false;
1020  bEPR[3]=false;
1021  bEPR[4]=false;
1022  bEPR[5]=false;
1023  }
1024  else if(num <= 194)
1025  {//Hexagonal axes, for hexagonal and non-rhomboedral trigonal cells
1026  mEPR[1]=mEPR[0];
1027  mEPR[3]=mEPR[0]*0.5;
1028  mEPR[4]=0.0;
1029  mEPR[5]=0.0;
1030  bEPR[1]=false;
1031  bEPR[3]=false;
1032  bEPR[4]=false;
1033  bEPR[5]=false;
1034  }
1035  else
1036  {
1037  mEPR[1]=mEPR[0];
1038  mEPR[2]=mEPR[0];
1039  mEPR[3]=0.0;
1040  mEPR[4]=0.0;
1041  mEPR[5]=0.0;
1042  bEPR[1]=false;
1043  bEPR[2]=false;
1044  bEPR[3]=false;
1045  bEPR[4]=false;
1046  bEPR[5]=false;
1047  }
1048  for (int i=0; i<6; i++)
1049  this->GetPar(i).SetIsUsed(bEPR[i]);
1050  VFN_DEBUG_EXIT("TextureEllipsoid::UpdateEllipsoidPar().",3)
1051 }
1052 
1054 {
1055  VFN_DEBUG_ENTRY("TextureEllipsoid::InitRefParList()",5)
1056  if(this->GetNbPar()==0)
1057  {
1058  char buf [5];
1059  for (int i=0; i<6; i++)
1060  {
1061  sprintf(buf,"%d",i+1);
1062  RefinablePar tmp("EPR"+(string)buf, &(mEPR[i]), -10., 10.,
1063  gpRefParTypeScattDataCorrInt_Ellipsoid, REFPAR_DERIV_STEP_ABSOLUTE,
1064  false, true, true, false, 1.0);
1065  tmp.AssignClock(mClockTextureEllipsoidPar);
1066  tmp.SetDerivStep(1e-7);
1067  tmp.SetGlobalOptimStep(0.1);
1068  this->AddPar(tmp);
1069  }
1070  }
1071  VFN_DEBUG_EXIT("TextureEllipsoid::InitRefParList():Finished",5)
1072 }
1073 
1074 #ifdef __WX__CRYST__
1075 WXCrystObjBasic* TextureEllipsoid::WXCreate(wxWindow* parent)
1076 {
1077  VFN_DEBUG_ENTRY("TextureEllipsoid::WXCreate()",6)
1078  if(mpWXCrystObj==0)
1079  mpWXCrystObj=new WXTextureEllipsoid(parent,this);
1080  VFN_DEBUG_EXIT("TextureEllipsoid::WXCreate()",6)
1081  return mpWXCrystObj;
1082 }
1083 #endif
1084 
1085 
1087 //
1088 // Time Of Flight correction
1089 //
1091 TOFCorr::TOFCorr(const ScatteringData & data):
1092 ScatteringCorr(data)
1093 {}
1094 
1095 TOFCorr::~TOFCorr()
1096 {}
1097 
1098 const string & TOFCorr::GetName() const
1099 {
1100  //So far, we do not need a personalized name...
1101  const static string mName="TOFCorr";
1102  return mName;
1103 }
1104 
1105 const string & TOFCorr::GetClassName() const
1106 {
1107  const static string className="TOFCorr";
1108  return className;
1109 }
1110 
1111 void TOFCorr::CalcCorr() const
1112 {
1113  const REAL *pstol=mpData->GetSinThetaOverLambda().data();
1114  if(mpData->GetClockTheta()<mClockCorrCalc) return;
1115  TAU_PROFILE("TOFCorr::CalcCorr()","void ()",TAU_DEFAULT);
1116  mCorr.resize(mpData->GetNbRefl());
1117  for(long i=0;i<mpData->GetNbRefl();i++) mCorr(i) = pow((float)(1.0/(2.0* *pstol++)),(int)4);
1119 }
1120 
1121 }//namespace
const RefinableObjClock & GetClockNbReflBelowMaxSinThetaOvLambda() const
Clock the last time the number of reflections used was changed.
void SetDerivStep(const REAL)
Fixed step to use to compute numerical derivative.
const CrystVector_REAL & GetH() const
Return the 1D array of H coordinates for all reflections.
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
virtual long GetNbReflBelowMaxSinThetaOvLambda() const
Recalc, and get the number of reflections which should be actually used, due to the maximuml sin(thet...
Texture correction using the March-Dollase model.
void AddPar(const RefinablePar &newRefPar)
Add a refinable parameter.
const CrystVector_REAL & GetSinThetaOverLambda() const
Return an array with for all reflections.
virtual void CalcCorr() const =0
Do the computation of corrected intensities.
const RefParType * gpRefParTypeScattDataCorrInt
Generic type for correction to calculated intensities.
CrystVector_REAL mCorr
The vector of correction to intensities.
const CrystVector_REAL & GetTheta() const
Return an array with theta values for all reflections.
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
virtual const string & GetClassName() const
Get the name of the class.
virtual void TagNewBestConfig() const
During a global optimization, tells the object that the current config is the latest "best" config...
We need to record exactly when refinable objects have been modified for the last time (to avoid re-co...
Definition: RefinableObj.h:138
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.
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
void MillerToOrthonormalCoords(REAL &x, REAL &y, REAL &z) const
Get Miller H,K, L indices from orthonormal coordinates in reciprocal space.
Definition: UnitCell.cpp:284
bool HasCrystal() const
Has a Crystal structure associated yet ?
virtual void CalcCorr() const
Do the computation of corrected intensities.
Texture correction using the Ellipsoidal preferred orientation function.
void Click()
Record an event for this clock (generally, the 'time' an object has been modified, or some computation has been made)
long GetNbPar() const
Total number of refinable parameter in the object.
void UpdateEllipsoidPar()
Update ellipsoid parameters for tetragonal, trigonal, hexagonal, cubic lattices.
void AddChild(const RefinableObjClock &)
Add a 'child' clock.
const RefParType * gpRefParTypeScattDataCorrInt_Ellipsoid
Parameter type for the ellipsoid coefficient.
unsigned int GetUniqueAxis() const
Which is the unique axis (for monoclinic space groups )
Definition: SpaceGroup.cpp:469
virtual const string & GetName() const
Get the name of this object.
void XMLInput(istream &is, const XMLCrystTag &tag)
XMLInput From stream.
RefinablePar & GetPar(const long i)
Access all parameters in the order they were inputted.
virtual const string & GetClassName() const
Get the name of the class.
void SetIsUsed(const bool)
Is the parameter used (if not, it is simply irrelevant in the model) ?
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.
Class to compute structure factors for a set of reflections and a Crystal.
RefinableObjClock mClockMaster
Master clock, which is changed whenever the object has been altered.
virtual const Radiation & GetRadiation() const =0
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 CalcCorr() const
Do the computation of corrected intensities.
virtual void CalcCorr() const
Do the computation of corrected intensities.
const SpaceGroup & GetSpaceGroup() const
Access to the SpaceGroup object.
Definition: UnitCell.cpp:320
const RefinableObjClock & GetClockCorr() const
Get the value of the clock corresponding to the last time the correction was actually computed...
ScatteringCorr(const ScatteringData &data)
Constructor, with the associated ScatteringData object.
const CrystVector_REAL & GetReflZ() const
Return the 1D array of orthonormal z coordinates for all reflections (recipr. space) ...
Abstract base class for all objects in wxCryst.
Definition: wxCryst.h:127
void OrthonormalToMillerCoords(REAL &x, REAL &y, REAL &z) const
Get orthonormal coordinates given a set of H,K, L indices in reciprocal space.
Definition: UnitCell.cpp:294
string mName
Name for this RefinableObject. Should be unique, at least in the same scope.+.
virtual void CalcCorr() const
Do the computation of corrected intensities.
virtual const string & GetClassName() const
Get the name of the class.
const RefParType * gpRefParTypeScattDataCorrIntPO_Amplitude
Parameter type for the amplitude of preferred orientation.
virtual const string & GetClassName() const
Get the name of the class.
virtual void CalcCorr() const
Do the computation of corrected intensities.
void AssignClock(RefinableObjClock &clock)
Base class to compute all kind of corrections to intensities: Lorentz, Polar, absorption, texcture, extinction, etc...
virtual const string & GetName() const
Get the name of this object.
const CrystVector_REAL & GetReflY() const
Return the 1D array of orthonormal y coordinates for all reflections (recipr. space) ...
void InitRefParList()
Prepare the refinable parameters list.
const CrystVector_REAL & GetReflX() const
Return the 1D array of orthonormal x coordinates for all reflections (recipr. space) ...
virtual const string & GetName() const
Get the name of this object.
virtual void CalcCorr() const
Do the computation of corrected intensities.
virtual const string & GetClassName() const
Get the name of the class.
CrystMatrix_REAL GetAllEquivRefl(const REAL h, const REAL k, const REAL l, const bool excludeFriedelMate=false, const bool forceFriedelLaw=false, const REAL sf_re=0, const REAL sf_im=0) const
Get the list of all equivalent reflections.
Definition: SpaceGroup.cpp:514
const ScatteringData * mpData
The associated ScatteringData object.
const Crystal & GetCrystal() const
Const access to the data's crystal.
RefinableObjClock mClockCorrCalc
The clock marking the last time the correction was calculated.
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
TextureMarchDollase * mpTextureMarchDollase
The parent TextureMarchDollase object.
void MutateTo(const REAL newValue)
Change the current value to the given one.
virtual const string & GetName() const
Get the name of this object.
Class to display one Preferred Orientation phase using the Ellipsoid model.
bool IsDescendantFromOrSameAs(const RefParType *type) const
Returns true if the parameter is a descendant of 'type'.
virtual const string & GetClassName() const
Get the name of the class.
long GetNbRefl() const
Return the number of reflections in this experiment.
const RefinableObjClock & GetClockTheta() const
Clock the last time the sin(theta)/lambda and theta arrays were re-computed.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Definition: Atom.cpp:47
const CrystVector_REAL & GetCorr() const
Get the vector of corrections for all reflections.
Generic class for parameters of refinable objects.
Definition: RefinableObj.h:223
const RefParType * gpRefParTypeScattDataCorrIntPO_Direction
Parameter type for preferred orientation direction.
REAL GetGlobalOptimStep() const
Maximum step to use during Global Optimization algorithms.
int GetSpaceGroupNumber() const
Id number of the spacegroup.
Definition: SpaceGroup.cpp:249
REAL GetValue() const
of the parameter.
const RefParType * gpRefParTypeScattDataCorrIntPO_Fraction
Parameter type for fraction of preferred orientation.
unsigned long mNbReflUsed
Number of reflexion for which the calculation is actually done.
virtual const string & GetName() const
Get the name of this object.
class to input or output a well-formatted xml beginning or ending tag.
class of refinable parameter types.
Definition: RefinableObj.h:78
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.
void SetGlobalOptimStep(const REAL)
Maximum step to use during Global Optimization algorithms.
virtual const string & GetName() const
Get the name of this object.
void XMLOutput(ostream &os, const string &name, int indent=0) const
XMLOutput to stream in well-formed XML.