24 #include "ObjCryst/ObjCryst/test.h"
25 #include "ObjCryst/ObjCryst/Crystal.h"
26 #include "ObjCryst/ObjCryst/Atom.h"
27 #include "ObjCryst/ObjCryst/DiffractionDataSingleCrystal.h"
28 #include "ObjCryst/ObjCryst/PowderPattern.h"
29 #include "ObjCryst/RefinableObj/GlobalOptimObj.h"
30 #include "ObjCryst/Quirks/VFNStreamFormat.h"
36 const RadiationType radiation,
const unsigned long nbReflections,
37 const unsigned int dataType,
const REAL time)
39 Crystal cryst(9,11,15,1.2,1.3,1.7,spacegroup);
40 for(
int i=0;i<nbAtomType;++i)
44 for(
unsigned int i = 0; i < nbAtom; ++i)
66 if(pDataTmp->
GetNbRefl()>(long)nbReflections)
break;
68 if(maxtheta>=M_PI/2.)
break;
70 CrystVector_REAL hh; hh=pDataTmp->
GetH();hh.resizeAndPreserve(nbReflections);hh+=0.0001;
71 CrystVector_REAL kk; kk=pDataTmp->
GetK();kk.resizeAndPreserve(nbReflections);kk+=0.0001;
72 CrystVector_REAL ll; ll=pDataTmp->
GetL();ll.resizeAndPreserve(nbReflections);ll+=0.0001;
74 CrystVector_long h(nbReflections); h=hh;
75 CrystVector_long k(nbReflections); k=kk;
76 CrystVector_long l(nbReflections); l=ll;
78 CrystVector_REAL iobs(nbReflections);
79 for(
unsigned int i=0;i<nbReflections;++i) iobs(i)=(REAL)rand();
80 CrystVector_REAL sigma(nbReflections);sigma=1;
94 CrystVector_REAL iobs(3140);
95 for(
unsigned int i=0;i<3140;++i) iobs(i)=(REAL)rand()+1.;
100 backgdData->
SetName(
"PbSo4-background");
102 CrystVector_REAL tth(2),backgd(2);
103 tth(0)=0.;tth(1)=3.14;
104 backgd(0)=1.;backgd(1)=9.;
105 backgdData->SetInterpPoints(tth,backgd);
112 diffData->
SetName(
"Crystal phase");
114 .03*DEG2RAD*DEG2RAD,0.,0.,0.3,0);
119 diffData->ScatteringData::GenHKLFullSpace(maxtheta,
true);
120 if(diffData->
GetNbRefl()>(long)nbReflections)
break;
122 if(maxtheta>=M_PI/2.)
break;
124 CrystVector_REAL hh; hh=diffData->
GetH();hh.resizeAndPreserve(nbReflections);
125 CrystVector_REAL kk; kk=diffData->
GetK();kk.resizeAndPreserve(nbReflections);
126 CrystVector_REAL ll; ll=diffData->
GetL();ll.resizeAndPreserve(nbReflections);
128 diffData->
SetHKL (hh, kk, ll);
150 ANNEALING_EXPONENTIAL,8,.125);
154 long nbTrial=50000000;
155 pGlobalOptObj->
Optimize(nbTrial,
true,0,time);
171 delete pGlobalOptObj;
const CrystVector_REAL & GetH() const
Return the 1D array of H coordinates for all reflections.
int GetNbSymmetrics(const bool noCenter=false, const bool noTransl=false) const
Return the number of equivalent positions in the spacegroup, ie the multilicity of the general positi...
virtual void RandomizeStartingConfig()
Randomize starting configuration.
virtual void Optimize(long &nbSteps, const bool silent=false, const REAL finalcost=0, const REAL maxTime=-1)
Launch optimization (a single run) for N steps.
unsigned int mDataType
dataType: 0= single crystal, 1= powder pattern (1 background + 1 crystal phase)
void SetReflectionProfilePar(const ReflectionProfileType prof, const REAL fwhmCagliotiW, const REAL fwhmCagliotiU=0, const REAL fwhmCagliotiV=0, const REAL eta0=0.5, const REAL eta1=0.)
Set reflection profile parameters.
REAL mBogoMRAPS
Million of Reflections-Atoms computed Per Second (considering all atoms in the unit cell) ...
void SetUseDynPopCorr(const int use)
Set the use of dynamical population correction (Crystal::mUseDynPopCorr).
void AddRefinableObj(RefinableObj &)
Add a refined object. All sub-objects are also added.
RadiationType mRadiation
The type of radiation used.
Phase to compute a background contribution to a powder pattern using an interpolation.
void SetParIsFixed(const string &parName, const bool fix)
Fix one parameter.
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
Class to compute the contribution to a powder pattern from a crystalline phase.
REAL GetLastOptimElapsedTime() const
Get the elapsed time (in seconds) during the last optimization.
void SetPowderPatternObs(const CrystVector_REAL &obs)
Set observed powder pattern from vector array.
void FixAllPar()
Fix all parameters.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
unsigned int mNbAtom
Total number of unique atoms in the test structure.
const CrystVector_REAL & GetL() const
Return the 1D array of L coordinates for all reflections.
Generic Refinable Object.
const SpaceGroup & GetSpaceGroup() const
Access to the SpaceGroup object.
unsigned long mNbReflections
The total number of reflections used for the tests.
void AddScatterer(Scatterer *scatt)
Add a scatterer to the crystal.
REAL mBogoMRAPS_reduced
Million of Reflections-Atoms computed Per Second (considering all atoms in the unit cell...
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...
Base object for Monte-Carlo Global Optimization methods.
The basic atom scatterer, in a crystal.
virtual void SetRadiationType(const RadiationType radiation)
Set : neutron or x-ray experiment ? Wavelength ?
void SetAlgorithmParallTempering(const AnnealingSchedule scheduleTemp, const REAL tMax, const REAL tMin, const AnnealingSchedule scheduleMutation=ANNEALING_CONSTANT, const REAL mutMax=16., const REAL mutMin=.125)
Set the refinement method to Parallel Tempering.
DiffractionData object for Single Crystal analysis.
void AddPowderPatternComponent(PowderPatternComponent &)
Add a component (phase, backround) to this pattern.
string mSpacegroup
The symbol for the spacegroup.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
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
Powder pattern class, with an observed pattern and several calculated components to modelize the patt...
void SetPowderPatternPar(const REAL min, const REAL step, unsigned long nbPoint)
the powder pattern angular range & resolution parameter.
void SetRadiationType(const RadiationType radiation)
Set the radiation type.
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
REAL mBogoSPS
Number of Structures evaluated Per Second.
ObjRegistry< ScatteringPower > & GetScatteringPowerRegistry()
Get the registry of ScatteringPower included in this Crystal.
Structure to hold the results of a speedtest (see ObjCryst::SpeedTest())
int mNbAtomType
Total number of atom types in the test structure.
SpeedTestReport SpeedTest(const unsigned int nbAtom, const int nbAtomType, const string spacegroup, const RadiationType radiation, const unsigned long nbReflections, const unsigned int dataType, const REAL time)
virtual void SetWeightToInvSigma2(const REAL minRelatSigma=1e-4, const REAL minIobsSigmaRatio=0)
Set the weight for all observed intensities to 1/sigma^2.
long GetNbRefl() const
Return the number of reflections in this experiment.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
The Scattering Power for an Atom.
void SetWavelength(const REAL lambda)
Set the wavelength of the experiment (in Angstroems).
virtual void SetHKL(const CrystVector_REAL &h, const CrystVector_REAL &k, const CrystVector_REAL &l)
input H,K,L
RadiationType
Type of radiation used.
Crystal class: Unit cell, spacegroup, scatterers.
const CrystVector_REAL & GetK() const
Return the 1D array of K coordinates for all reflections.
void AddScatteringPower(ScatteringPower *scattPow)
Add a ScatteringPower for this Crystal.
virtual void SetName(const string &name)
Name of the object.
void SetWavelength(const REAL)
Set the (monochromatic) wavelength of the beam.