- Fixed conflicts in ascon.c

- Supressed superfluous message from fmess
- Expanded multicounter to deal with threshold commands nicely
- Fixed an an issue with an uninitialized dummy connection in nserver
- Many changes to simidex to make it work in a more reliable way.
- Added hdbfactory path alias targetpath
- Extended frame to deal with sinqhttp HM
This commit is contained in:
koennecke
2009-03-09 08:28:08 +00:00
parent de4ca7a5e9
commit 10a475f020
21 changed files with 469 additions and 102 deletions

View File

@ -21,10 +21,9 @@ static void SicsOutFunc(void *data, char *text)
{
SConnection *pCon = (SConnection *) data;
if (pCon != NULL) {
SCWrite(pCon, text, eWarning);
SCWrite(pCon, text, eLog);
}
}
/*-----------------------------------------------------------------------*/
static hdbCallbackReturn SetSttLim(pHdb node, void *userData,
pHdbMessage mm)
@ -54,16 +53,68 @@ static hdbCallbackReturn SetAngLim(pHdb node, void *userData,
}
return hdbContinue;
}
/*-----------------------------------------------------------------------*/
MATRIX calcUBForSolution(IndexSolution is, int *err)
{
pSingleDiff diffi;
pSICSOBJ reflist;
int i;
MATRIX UB;
double hkl[3];
diffi = SXGetDiffractometer();
reflist = SXGetReflectionList();
assert(reflist != NULL && diffi != NULL);
for (i = 0; i < 3; i++) {
if (is.originalID[i] != 999) {
hkl[0] = (double) is.h[i];
hkl[1] = (double) is.k[i];
hkl[2] = (double) is.l[i];
SetRefIndex(reflist, is.originalID[i], hkl);
}
}
if (is.originalID[2] == 999) {
UB = diffi->calcUBFromTwo(diffi, GetRefName(reflist, is.originalID[0]),
GetRefName(reflist, is.originalID[1]), err);
} else {
UB = diffi->calcUBFromThree(diffi,
GetRefName(reflist, is.originalID[0]),
GetRefName(reflist, is.originalID[1]),
GetRefName(reflist, is.originalID[2]),
err);
}
return UB;
}
/*-----------------------------------------------------------------------*/
static void filterSolutions(){
int i, err;
IndexSolution is;
MATRIX UB;
for(i = 0; i < SimIdxGetNSolutions(); i++){
is = SimIdxGetSolution(i);
if(is.originalID[0] != -999){
UB = calcUBForSolution(is,&err);
if(UB != NULL){
mat_free(UB);
} else {
SimIdxRemoveSolution(i);
i--;
}
}
}
}
/*-------------------------------------------------------------------------*/
static int RunIndexCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
pHdb par[], int nPar)
{
int i, j, status;
int i, j, status, err;
pSingleDiff diffi;
pSICSOBJ reflist;
double ang[4], z1[3];
IndexSolution is;
MATRIX ub;
SimIdxSetLambda(SXGetLambda());
SimIdxSetCell((double *) SXGetCell());
@ -78,29 +129,37 @@ static int RunIndexCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
diffi->calcZ1(diffi, GetRefName(reflist, i), z1);
SimIdxAddReflection(z1);
}
status = SimIdxRun();
filterSolutions();
if (status == 1) {
if (SimIdxGetNSolutions() < 1) {
SCWrite(pCon, "No solutions were found", eWarning);
SCWrite(pCon, "No solutions were found", eLog);
return 0;
}
SCWrite(pCon, "Indexing Suggestions:", eWarning);
SCWrite(pCon, "Indexing Suggestions:", eLog);
for (i = 0; i < SimIdxGetNSolutions(); i++) {
is = SimIdxGetSolution(i);
SCPrintf(pCon, eWarning, "Solution No : %d, GOF = %6.3f", i,
SCPrintf(pCon, eLog, "Solution No : %d, GOF = %6.3f", i,
is.diff * 100);
for (j = 0; j < 3; j++) {
if (is.originalID[j] != 999) {
SCPrintf(pCon, eWarning, " Ref = %2d, HKL = %4d %4d %4d ",
SCPrintf(pCon, eLog, " Ref = %2d, HKL = %4d %4d %4d ",
is.originalID[j], is.h[j], is.k[j], is.l[j]);
}
}
SCPrintf(pCon,eLog," UB:");
ub = calcUBForSolution(is,&err);
if(ub != NULL) { /* should never happen, as filtered */
for(j = 0; j < 3; j++){
SCPrintf(pCon, eLog," %8.5f %8.5f %8.5f",
ub[j][0], ub[j][1], ub[j][2]);
}
}
}
}
return status;
}
/*-----------------------------------------------------------------------*/
static int ChooseCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
pHdb par[], int nPar)
@ -108,9 +167,7 @@ static int ChooseCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
MATRIX UB;
int err, solution, i;
IndexSolution is;
double hkl[3], ub[9];
pSICSOBJ reflist;
pSingleDiff diffi;
double ub[9];
if (nPar < 1) {
SCWrite(pCon, "ERROR: need the solution number as argument", eError);
@ -123,30 +180,9 @@ static int ChooseCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
return 0;
}
is = SimIdxGetSolution(i);
reflist = SXGetReflectionList();
diffi = SXGetDiffractometer();
assert(reflist != NULL);
assert(diffi != NULL);
for (i = 0; i < 3; i++) {
if (is.originalID[i] != 999) {
hkl[0] = (double) is.h[i];
hkl[1] = (double) is.k[i];
hkl[2] = (double) is.l[i];
SetRefIndex(reflist, is.originalID[i], hkl);
}
}
if (is.originalID[2] == 999) {
UB = diffi->calcUBFromTwo(diffi, GetRefName(reflist, is.originalID[0]),
GetRefName(reflist, is.originalID[1]), &err);
} else {
UB = diffi->calcUBFromThree(diffi,
GetRefName(reflist, is.originalID[0]),
GetRefName(reflist, is.originalID[1]),
GetRefName(reflist, is.originalID[2]),
&err);
}
is = SimIdxGetSolution(solution);
UB = calcUBForSolution(is,&err);
if (UB == NULL) {
switch (err) {
case REFERR:
@ -181,7 +217,6 @@ static int ChooseCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
SCSendOK(pCon);
return 1;
}
/*-----------------------------------------------------------------------*/
static int DiraxCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
pHdb par[], int nPar)