Fixed addauxref for the triple axis code
Added a writing state to status
This commit is contained in:
57
tasublib.c
57
tasublib.c
@ -184,7 +184,7 @@ double tasAngleBetweenReflections(MATRIX B, tasReflection r1,
|
||||
chi1 = mat_mul(B, h1);
|
||||
chi2 = mat_mul(B, h2);
|
||||
if (chi1 != NULL && chi2 != NULL) {
|
||||
angle = angleBetween(chi1, chi2);
|
||||
angle = tasAngleBetween(chi1, chi2);
|
||||
killVector(chi1);
|
||||
killVector(chi2);
|
||||
}
|
||||
@ -271,8 +271,9 @@ int makeAuxReflection(MATRIX B, tasReflection r1, tasReflection * r2,
|
||||
r2->qe.ki = r1.qe.ki;
|
||||
r2->qe.kf = r1.qe.kf;
|
||||
|
||||
theta = calcTheta(r1.qe.ki, r1.qe.kf, r1.angles.sample_two_theta);
|
||||
om = r1.angles.a3 - theta;
|
||||
theta = calcTheta(r1.qe.ki, r1.qe.kf,
|
||||
ss*r1.angles.sample_two_theta);
|
||||
om = r1.angles.a3 - ss*theta;
|
||||
om += tasAngleBetweenReflections(B, r1, *r2);
|
||||
|
||||
QC = tasReflectionToHC(r2->qe, B);
|
||||
@ -289,12 +290,17 @@ int makeAuxReflection(MATRIX B, tasReflection r1, tasReflection * r2,
|
||||
return TRIANGLENOTCLOSED;
|
||||
}
|
||||
r2->angles.sample_two_theta = ss * Acosd(cos2t);
|
||||
theta = calcTheta(r1.qe.ki, r1.qe.kf, r2->angles.sample_two_theta);
|
||||
r2->angles.a3 = om + theta;
|
||||
theta = calcTheta(r1.qe.ki, r1.qe.kf, ss*r2->angles.sample_two_theta);
|
||||
r2->angles.a3 = om + ss*theta;
|
||||
|
||||
r2->angles.a3 = fmod(r2->angles.a3 + ss*180.,360.) - ss*180.;
|
||||
|
||||
/*
|
||||
r2->angles.a3 -= 180.;
|
||||
if (r2->angles.a3 < -180.) {
|
||||
r2->angles.a3 += 360.;
|
||||
}
|
||||
*/
|
||||
mat_free(QC);
|
||||
|
||||
return 1;
|
||||
@ -415,22 +421,16 @@ MATRIX calcPlaneNormalQ(MATRIX UB, tasReflection r1, tasReflection r2)
|
||||
|
||||
return planeNormal;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
MATRIX calcTestUB(lattice cell, double om, double sgu, double sgl)
|
||||
/*--------------------------------------------------------------------
|
||||
This is shot. The resulting UB is invalid. This needs more throught.
|
||||
|
||||
*/
|
||||
MATRIX calcUBFromAngles(MATRIX B, double om, double sgu, double sgl)
|
||||
{
|
||||
MATRIX B, M, N, OM, UB;
|
||||
|
||||
MATRIX M, N, OM, UB;
|
||||
int status;
|
||||
|
||||
/*
|
||||
* create matrices
|
||||
*/
|
||||
B = mat_creat(3, 3, ZERO_MATRIX);
|
||||
|
||||
status = calculateBMatrix(cell, B);
|
||||
if (status < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
M = mat_creat(3, 3, ZERO_MATRIX);
|
||||
N = mat_creat(3, 3, ZERO_MATRIX);
|
||||
OM = mat_creat(3, 3, ZERO_MATRIX);
|
||||
@ -468,11 +468,30 @@ MATRIX calcTestUB(lattice cell, double om, double sgu, double sgl)
|
||||
mat_free(OM);
|
||||
mat_free(N);
|
||||
mat_free(M);
|
||||
mat_free(B);
|
||||
|
||||
return UB;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
MATRIX calcTestUB(lattice cell, double om, double sgu, double sgl)
|
||||
{
|
||||
MATRIX B, UB;
|
||||
int status;
|
||||
|
||||
/*
|
||||
* create matrices
|
||||
*/
|
||||
B = mat_creat(3, 3, ZERO_MATRIX);
|
||||
|
||||
status = calculateBMatrix(cell, B);
|
||||
if (status < 0) {
|
||||
return NULL;
|
||||
}
|
||||
UB = calcUBFromAngles(B,om,sgu,sgl);
|
||||
|
||||
mat_free(B);
|
||||
return UB;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
MATRIX calcTestNormal(double sgu, double sgl)
|
||||
{
|
||||
MATRIX M, N, Z, NORM;
|
||||
|
Reference in New Issue
Block a user