7 #include <QScriptEngine>
15 m_IsUsed(saver, this,
"isUsed", 0,
"Is Calibrant used?"),
16 m_Flags(saver, this,
"flags", 0,
"Calibrant flags"),
17 m_Description(saver, this,
"description",
"Description",
"Calibrant Description"),
18 m_Symmetry(saver, this,
"symmetry", 0,
"Calibrant Symmetry"),
19 m_A(saver, this,
"a", 1,
"calibrant a-axis"),
20 m_B(saver, this,
"b", 1,
"calibrant b-axis"),
21 m_C(saver, this,
"c", 1,
"calibrant c-axis"),
22 m_Alpha(saver, this,
"alpha", 90,
"calibrant alpha angle (deg)"),
23 m_Beta(saver, this,
"beta", 90,
"calibrant beta angle (deg)"),
24 m_Gamma(saver, this,
"gamma", 90,
"calibrant gamma angle (deg)"),
38 return (get_Flags() & 1) == 0;
43 return engine->newQObject(cal.data());
48 QObject *qobj = obj.toQObject();
82 int s = get_Symmetry();
103 int s = get_Symmetry();
105 double lambda = (energy>100 ? 12398.4187/energy : energy);
107 int mmax = 2.0*a/lambda + 1;
113 QVector<QxrdCalibrantQuadInt> ex(mmax*mmax);
115 for (
int h=1; h<=mmax; h++) {
116 for (
int k=0; k<=h; k++) {
117 for (
int l=0; l<=k; l++) {
129 ok = ((h + k + l) % 2) == 0;
134 int n = h%2 + k%2 + l%2;
135 ok = (n==0) || (n==3);
141 int nn = h%2 + k%2 + l%2;
143 if (nn==0 || nn==3) {
157 if (ex[r].n() == 0) {
170 for (
int i=1; i<mmax*mmax; i++) {
173 double d = a/sqrt(i);
174 double tth = 2.0*asin(lambda/(2.0*d))*180.0/M_PI;
180 printMessage(tr(
"%1(%2): [%3,%4,%5], d:%6, tth:%7").arg(i).arg(e.
n()).arg(e.
h()).arg(e.
k()).arg(e.
l()).arg(d).arg(tth));
191 return d1.
tth() < d2.
tth();
196 int s = get_Symmetry();
200 double lambda = (energy>100 ? 12398.4187/energy : energy);
202 int hkmax = 2.0*a/lambda + 1;
203 int lmax = 2.0*c/lambda + 1;
216 for (
int l=lmin; l<=lmax+1; l++) {
217 for (
int k=0; k<=hkmax+1; k++) {
224 for (
int h=hmin; h<=hkmax+1; h++) {
230 ok = ((-h+k+l)%3 == 0);
238 double d = 1.0/sqrt((4.0/3.0)*(h*h + h*k + k*k)/(a*a) + (l*l)/(c*c));
239 double tth = 2.0*asin(lambda/(2.0*d))*180.0/M_PI;
250 qSort(pts.begin(), pts.end(),
lessThan);
QWeakPointer< QxrdCalibrant > QxrdCalibrantWPtr
qint64 qcepDebug(int cond)
void insertUnique(int index, int h, int k, int l, double d, double tth)
QxrdCalibrantDSpacings dSpacingsHexagonal(double energy)
QxrdCalibrantDSpacing dSpacing(int h, int k, int l)
bool lessThan(const QxrdCalibrantDSpacing &d1, const QxrdCalibrantDSpacing &d2)
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
QSharedPointer< QxrdCalibrant > QxrdCalibrantPtr
static void fromScriptValue(const QScriptValue &obj, QxrdCalibrantWPtr &cal)
QxrdCalibrant(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr exp, QxrdCalibrantLibraryWPtr lib, int index)
QxrdCalibrantLibraryWPtr m_CalibrantLibrary
QWeakPointer< QxrdCalibrantLibrary > QxrdCalibrantLibraryWPtr
QxrdCalibrantQuadInt(int n=0, int h=-1, int k=-1, int l=-1)
static QScriptValue toScriptValue(QScriptEngine *engine, const QxrdCalibrantWPtr &cal)
QxrdCalibrantDSpacings dSpacingsCubic(double energy)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime()) const
QxrdExperimentWPtr m_Experiment
QxrdCalibrantDSpacings dSpacings(double energy)
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr