- Improved centering in DIFRAC

- Fixed a bug in UserWait
- Improved scan message in scancom
- Added zero point correction in lin2ang
- fixed an issue with uuencoded messages
This commit is contained in:
cvs
2000-04-06 12:18:53 +00:00
parent 8ba6bf7758
commit ff5e8cf0b2
35 changed files with 227 additions and 47 deletions

121
hkl.c
View File

@ -442,7 +442,8 @@
z[i] = self->fUB[ii]*fHKL[0] + self->fUB[ii+1]*fHKL[1] +
self->fUB[ii+2]*fHKL[2];
}
/* bissecting calculation! */
if(!self->iNOR)
{
/* four circle calculation */
@ -590,7 +591,7 @@
} /* end four circle */
else
{
/* start normal beam calculation */
/* start normal bissecting calculation */
/* ignore psi values */
d2 = 0.;
for(i = 0; i < 3; i++)
@ -634,7 +635,8 @@
}
}
/*-------------------------------------------------------------------------*/
int CalculateSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
/* This may become dead code if the looping show does not work */
int CulculuteSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
float fSet[4], SConnection *pCon)
{
int iRet, iSuccess = 0, iRes = 1, iRetry = 1;
@ -678,7 +680,8 @@
if(!iTest)
{
/* this cannot be fixed */
sprintf(pBueffel,"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
fSet[0], fHKL[0], fHKL[1],fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
@ -708,7 +711,8 @@
else
{
/* this cannot be fixed */
sprintf(pBueffel,"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates omega limits",
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates omega limits",
fSet[1], fHKL[0], fHKL[1],fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
@ -774,6 +778,113 @@
}
return 1;
}
/*-------------------------------------------------------------------------
calculates the four circle settings. If the position can not be reached
because of a limit violation, then psi is rotated in 10 degree steps
until either the loop ends or we finally succed.
*/
int CalculateSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
float fSet[4], SConnection *pCon)
{
int iRet,iRetry, i;
int iQuad = 0;
int iTest;
float fDelom = 0.;
char pError[132];
char pBueffel[512];
float fHard;
float fVal;
float myPsi = fPsi;
/* catch shitty input */
if( (fHKL[0] == 0.) && (fHKL[1] == 0.) && (fHKL[2] == 0.))
{
SCWrite(pCon,"ERROR: I will not calculate angles for HKL = (0,0,0) ",
eError);
return 0;
}
/* no retries if normal beam calculation
or specific Hamilton or specific
psi requested */
if( (self->iNOR) || (iHamil != 0) || (myPsi > 0.1) )
{
iRetry = 1;
}
else
{
iRetry = 35;
}
/* loop till success */
for(i = 0, myPsi = 0.; i < iRetry; i++, myPsi += 10.);
{
/* just try it*/
iRet = ICAL(self,fHKL, myPsi, iHamil, self->iQuad,fSet,fDelom);
if(iRet < 0 ) /* could not do it */
{
sprintf(pBueffel,"ERROR: cannot calculate %4.1f %4.1f %4.1f",
fHKL[0], fHKL[1], fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
/* check two theta */
iTest = MotorCheckBoundary(self->pTheta,fSet[0], &fHard,pError,131);
if(!iTest)
{
/* this cannot be fixed */
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
fSet[0], fHKL[0], fHKL[1],fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
/* check nu and omega if normal beam */
if(self->iNOR)
{
/* check omega */
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pNu,fSet[2], &fHard,pError,131);
if(iTest != 2)
{
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f %5.2f %5.2f violates nu limits",
fHKL[0], fHKL[1],fHKL[2],fSet[0], fSet[1],fSet[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
else
{
return 1;
}
}
/* check chi and phi and omega, but first put into 0-360 degrees */
if(fSet[2] < 0.0)
{
fSet[2] = 360.0 + fSet[2];
}
if(fSet[3] < 0.0)
{
fSet[3] = 360.0 + fSet[3];
}
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pChi,fSet[2], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pPhi,fSet[4], &fHard,pError,131);
if(iTest == 3) /* none of them burns */
{
return 1;
}
}
sprintf(pBueffel,
"ERROR: failed to find a possible setting for %4.1f %4.1f %4.1f %s",
fHKL[0], fHKL[1], fHKL[2], "\n Even tried 36 psi settings");
SCWrite(pCon,pBueffel,eError);
return 0;
}
/*-------------------------------------------------------------------------*/
int RunHKL(pHKL self, float fHKL[3],
float fPsi, int iHamil, SConnection *pCon)