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;
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
RadiationType
Type of radiation used.
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)
The basic atom scatterer, in a crystal.
Crystal class: Unit cell, spacegroup, scatterers.
void SetUseDynPopCorr(const int use)
Set the use of dynamical population correction (Crystal::mUseDynPopCorr).
void AddScatteringPower(ScatteringPower *scattPow)
Add a ScatteringPower for this Crystal.
ObjRegistry< ScatteringPower > & GetScatteringPowerRegistry()
Get the registry of ScatteringPower included in this Crystal.
void AddScatterer(Scatterer *scatt)
Add a scatterer to the crystal.
DiffractionData object for Single Crystal analysis.
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.
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.
Phase to compute a background contribution to a powder pattern using an interpolation.
Class to compute the contribution to a powder pattern from a crystalline phase.
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
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.
Powder pattern class, with an observed pattern and several calculated components to modelize the patt...
void AddPowderPatternComponent(PowderPatternComponent &)
Add a component (phase, backround) to this pattern.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
void SetPowderPatternObs(const CrystVector_REAL &obs)
Set observed powder pattern from vector array.
void SetRadiationType(const RadiationType radiation)
Set the radiation type.
void SetPowderPatternPar(const REAL min, const REAL step, unsigned long nbPoint)
\briefSet the powder pattern angular range & resolution parameter.
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
const CrystVector_REAL & GetK() const
Return the 1D array of K coordinates for all reflections.
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.
virtual void SetMaxSinThetaOvLambda(const REAL max)
Set the maximum value for sin(theta)/lambda.
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
const CrystVector_REAL & GetH() const
Return the 1D array of H coordinates for all reflections.
const CrystVector_REAL & GetL() const
Return the 1D array of L coordinates for all reflections.
long GetNbRefl() const
Return the number of reflections in this experiment.
The Scattering Power for an Atom.
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...
Structure to hold the results of a speedtest (see ObjCryst::SpeedTest())
unsigned long mNbReflections
The total number of reflections used for the tests.
unsigned int mNbAtom
Total number of unique atoms in the test structure.
string mSpacegroup
The symbol for the spacegroup.
int mNbAtomType
Total number of atom types in the test structure.
REAL mBogoMRAPS_reduced
Million of Reflections-Atoms computed Per Second (considering all atoms in the unit cell,...
RadiationType mRadiation
The type of radiation used.
REAL mBogoSPS
Number of Structures evaluated Per Second.
REAL mBogoMRAPS
Million of Reflections-Atoms computed Per Second (considering all atoms in the unit cell)
unsigned int mDataType
dataType: 0= single crystal, 1= powder pattern (1 background + 1 crystal phase)
const SpaceGroup & GetSpaceGroup() const
Access to the SpaceGroup object.
void AddRefinableObj(RefinableObj &)
Add a refined object. All sub-objects are also added.
REAL GetLastOptimElapsedTime() const
Get the elapsed time (in seconds) during the last optimization.
virtual void RandomizeStartingConfig()
Randomize starting configuration.
void SetParIsFixed(const string &parName, const bool fix)
Fix one parameter.
void FixAllPar()
Fix all parameters.
Base object for Monte-Carlo Global Optimization methods.
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.
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.
Generic Refinable Object.
virtual void SetName(const string &name)
Name of the object.