- Many fixes to the triple axis stuff

* update after a1-a6 drive
  * intrduction of targets
- POLDI writing
- Moved HKL calculation 4 TRICS to fourlib
This commit is contained in:
cvs
2002-01-25 14:48:50 +00:00
parent 8c043c8cd1
commit 1e60f3be82
39 changed files with 3513 additions and 1160 deletions

215
tasutil.c
View File

@@ -131,7 +131,66 @@ void prepare2Parse(char *line)
}
return 1;
}
/*--------------------------------------------------------------------
print calculation errors.
*/
static int printError(int ier, SConnection *pCon)
{
/*
error messages taken from erreso
*/
switch(ier)
{
case 1:
SCWrite(pCon,"ERROR: Bad lattice parameters(AS,BS,CS)",eError);
return 0;
break;
case 2:
SCWrite(pCon,"ERROR: Bad cell angles",eError);
return 0;
break;
case 3:
SCWrite(pCon,"ERROR: Bad scattering plane ",eError);
return 0;
break;
case 4:
SCWrite(pCon,"ERROR: Bad lattice or lattice plane",eError);
return 0;
break;
case 5:
SCWrite(pCon,"ERROR: Check Lattice and Scattering Plane",eError);
return 0;
break;
case 6:
SCWrite(pCon,"ERROR: Q not in scattering plane",eError);
return 0;
break;
break;
case 7:
SCWrite(pCon,"ERROR: Q-modulus to small",eError);
return 0;
break;
case 8:
case 12:
SCWrite(pCon,"ERROR: KI,KF,Q triangle cannot close",eError);
return 0;
break;
case 9:
SCWrite(pCon,"ERROR: KI or K, check d-spacings",eError);
return 0;
break;
case 10:
SCWrite(pCon,"ERROR: KI or KF cannot be obtained",eError);
return 0;
break;
case 11:
SCWrite(pCon,"ERROR: KI or KF to small",eError);
return 0;
break;
default:
break;
}
}
/*----------------------------------------------------------------------
TASCalc does the triple axis spectrometer calculations. This function is
invoked whenever energy or Q needs to be driven. The parameters:
@@ -266,14 +325,14 @@ int TASCalc(pTASdata self, SConnection *pCon,
This done, we painstackingly initialize the tons of parameters required
by the t_conv
*/
ei = (real)self->tasPar[EI]->fVal;
aki = (real)self->tasPar[KI]->fVal;
ef = (real)self->tasPar[EF]->fVal;
akf = (real)self->tasPar[KF]->fVal;
qhkl[0] = (real)self->tasPar[QH]->fVal;
qhkl[1] = (real)self->tasPar[QK]->fVal;
qhkl[2] = (real)self->tasPar[QL]->fVal;
en = (real)self->tasPar[EN]->fVal;
ei = (real)self->tasPar[TEI]->fVal;
aki = (real)self->tasPar[TKI]->fVal;
ef = (real)self->tasPar[TEF]->fVal;
akf = (real)self->tasPar[TKF]->fVal;
qhkl[0] = (real)self->tasPar[TQH]->fVal;
qhkl[1] = (real)self->tasPar[TQK]->fVal;
qhkl[2] = (real)self->tasPar[TQL]->fVal;
en = (real)self->tasPar[TEN]->fVal;
hx = (real)self->tasPar[HX]->fVal;
hy = (real)self->tasPar[HY]->fVal;
hz = (real)self->tasPar[HZ]->fVal;
@@ -288,6 +347,9 @@ int TASCalc(pTASdata self, SConnection *pCon,
ldf = (logical)tasMask[9];
if(self->tasPar[LPA]->iVal > 0)
lpa = (logical)1;
else
lpa = (logical)0;
dm = (real)self->tasPar[DM]->fVal;
da = (real)self->tasPar[DA]->fVal;
qm = (real)self->tasPar[QM]->fVal;
@@ -323,7 +385,7 @@ int TASCalc(pTASdata self, SConnection *pCon,
{
ldra[i] = 0;
}
l_RA = l_RM = l_ALM = 0;
l_RA = l_RM = l_ALM = ier = 0;
/* now we can call */
t_conv__(&ei, &aki, &ef, &akf,
@@ -334,58 +396,11 @@ int TASCalc(pTASdata self, SConnection *pCon,
angles, &tRM, &tALM, &tRA, &qm, ldra,
&l_RM, &l_ALM,&l_RA, currents,helmconv,
&ier);
/*
error messages taken from erreso
*/
switch(ier)
if(ier != 0)
{
case 1:
SCWrite(pCon,"ERROR: Bad lattice parameters",eError);
return 0;
break;
case 2:
SCWrite(pCon,"ERROR: Bad cell angles",eError);
return 0;
break;
case 3:
SCWrite(pCon,"ERROR: Bad scattering plane ",eError);
return 0;
break;
case 4:
SCWrite(pCon,"ERROR: Bad lattice or lattice plane",eError);
return 0;
break;
case 5:
SCWrite(pCon,"ERROR: Q not in scattering plane",eError);
return 0;
break;
case 6:
SCWrite(pCon,"ERROR: Q modulus to small",eError);
return 0;
break;
case 7:
case 12:
SCWrite(pCon,"ERROR: KI, KF, Q triangle cannot close ",eError);
return 0;
break;
case 8:
SCWrite(pCon,"ERROR: in KI, KF, check d-spacings",eError);
return 0;
break;
case 9:
SCWrite(pCon,"ERROR: KI or KF cannot be obtained",eError);
return 0;
break;
case 10:
SCWrite(pCon,"ERROR: KI or KF to small",eError);
return 0;
break;
case 11:
SCWrite(pCon,"ERROR: KI or KF cannot be obtained",eError);
return 0;
break;
default:
break;
printError(ier,pCon);
return 0;
}
/*
@@ -409,12 +424,12 @@ int TASCalc(pTASdata self, SConnection *pCon,
{
motorTargets[17+i] = helmconv[i];
}
self->tasPar[EI]->fVal = (float)ei;
self->tasPar[KI]->fVal = (float)aki;
self->tasPar[EF]->fVal = (float)ef;
self->tasPar[KF]->fVal = (float)akf;
self->tasPar[EN]->fVal = (float)en;
self->tasPar[TEI]->fVal = (float)ei;
self->tasPar[TKI]->fVal = (float)aki;
self->tasPar[TEF]->fVal = (float)ef;
self->tasPar[TKF]->fVal = (float)akf;
self->tasPar[TEN]->fVal = (float)en;
self->tasPar[QM]->fVal = (float)qm;
return 1;
}
@@ -578,6 +593,9 @@ int TASUpdate(pTASdata self, SConnection *pCon)
*/
if(self->tasPar[LPA]->iVal > 0)
lpa = (logical)1;
else
lpa = (logical)0;
da = (real)self->tasPar[DA]->fVal;
dm = (real)self->tasPar[DM]->fVal;
isa = (integer)self->tasPar[SA]->iVal;
@@ -593,76 +611,28 @@ int TASUpdate(pTASdata self, SConnection *pCon)
/*
now call t_update to do the calculation
*/
ier = 0;
t_update__(amot, helmCurrent, convH, &lpa, &dm, &da, &isa, &helm,
&f1h, &f1v, &f2h, &f2v, &f, &ei, &aki, &ef, &akf,
qhkl, &en, &hx, &hy, &hz, &if1, &if2, &qm, &ier);
/*
!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
t_update's function ex_up must be dited manually after conversion
t_update's function ex_up must be edited manually after conversion
to c by f2c. The reason is a different definition of the abs function.
The line:
arg = (d__1 = *dx * sin(*ax2 / 114.59155902616465, abs(d__1));
has to be changed to:
has to be changed to:
arg = *dx * sin(*ax2 / 114.59155902616465);
if(arg < .0)
arg = -arg;
!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/*
error messages taken from erreso
*/
switch(ier)
if(ier != 0)
{
case 1:
SCWrite(pCon,"ERROR: Bad lattice parameters",eError);
return 0;
break;
case 2:
SCWrite(pCon,"ERROR: Bad cell angles",eError);
return 0;
break;
case 3:
SCWrite(pCon,"ERROR: Bad scattering plane ",eError);
return 0;
break;
case 4:
SCWrite(pCon,"ERROR: Bad lattice or lattice plane",eError);
return 0;
break;
case 5:
SCWrite(pCon,"ERROR: Q not in scattering plane",eError);
return 0;
break;
case 6:
SCWrite(pCon,"ERROR: Q modulus to small",eError);
return 0;
break;
case 7:
case 12:
SCWrite(pCon,"ERROR: KI, KF, Q triangle cannot close ",eError);
return 0;
break;
case 8:
SCWrite(pCon,"ERROR: in KI, KF, check d-spacings",eError);
return 0;
break;
case 9:
SCWrite(pCon,"ERROR: KI or KF cannot be obtained",eError);
return 0;
break;
case 10:
SCWrite(pCon,"ERROR: KI or KF to small",eError);
return 0;
break;
case 11:
SCWrite(pCon,"ERROR: KI or KF cannot be obtained",eError);
return 0;
break;
default:
break;
printError(ier,pCon);
return 0;
}
/*
@@ -711,3 +681,4 @@ int TASUpdate(pTASdata self, SConnection *pCon)
return 1;
}