Enhanced simindex to capture all data for fourcircle.tcl Another change
to remove capture
This commit is contained in:
85
simindex.c
85
simindex.c
@ -167,6 +167,88 @@ static int RunIndexCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
|
||||
|
||||
return status;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void InternalOutFunc(void *data, char *text)
|
||||
{
|
||||
pDynString tData = (pDynString) data;
|
||||
if (tData!= NULL) {
|
||||
DynStringConcat(tData, text);
|
||||
}
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int RunIntIndexCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
|
||||
pHdb par[], int nPar)
|
||||
{
|
||||
int i, j, status, err;
|
||||
pSingleDiff diffi;
|
||||
pSICSOBJ reflist;
|
||||
double ang[5], z1[3];
|
||||
IndexSolution is;
|
||||
MATRIX ub;
|
||||
pHdb nSol = NULL;
|
||||
pDynString tData;
|
||||
char fString[512];
|
||||
|
||||
tData = CreateDynString(256,256);
|
||||
|
||||
SimIdxSetLambda(SXGetLambda());
|
||||
SimIdxSetCell((double *) SXGetCell());
|
||||
SimIdxSetSpacegroup(SXGetSpaceGroup());
|
||||
SimIdxOutput(tData, InternalOutFunc, 10);
|
||||
|
||||
reflist = SXGetReflectionList();
|
||||
diffi = SXGetDiffractometer();
|
||||
SimIdxClearReflection();
|
||||
for (i = 0; i < ReflectionListCount(reflist); i++) {
|
||||
GetRefAngles(reflist, i, ang);
|
||||
diffi->calcZ1(diffi, GetRefName(reflist, i), z1);
|
||||
SimIdxAddReflection(z1);
|
||||
}
|
||||
|
||||
nSol = GetHipadabaNode(self->objectNode,"nsolutions");
|
||||
assert(nSol != NULL);
|
||||
|
||||
status = SimIdxRun();
|
||||
filterSolutions();
|
||||
if (status == 1) {
|
||||
if (SimIdxGetNSolutions() < 1) {
|
||||
DynStringConcat(tData,"No solutions were found\n");
|
||||
UpdateHipadabaPar(nSol,MakeHdbInt(0), pCon);
|
||||
return 0;
|
||||
}
|
||||
DynStringConcat(tData, "Indexing Suggestions:\n");
|
||||
UpdateHipadabaPar(nSol,MakeHdbInt(SimIdxGetNSolutions()), pCon);
|
||||
for (i = 0; i < SimIdxGetNSolutions(); i++) {
|
||||
is = SimIdxGetSolution(i);
|
||||
|
||||
snprintf(fString,sizeof(fString), "Solution No : %d, GOF = %6.3f\n", i,
|
||||
is.diff * 100);
|
||||
DynStringConcat(tData,fString);
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (is.originalID[j] != 999) {
|
||||
snprintf(fString,sizeof(fString)," Ref = %2d, HKL = %4d %4d %4d \n",
|
||||
is.originalID[j], is.h[j], is.k[j], is.l[j]);
|
||||
DynStringConcat(tData,fString);
|
||||
}
|
||||
}
|
||||
SCPrintf(pCon,eLog," UB:");
|
||||
DynStringConcat(tData," UB\n");
|
||||
ub = calcUBForSolution(is,&err);
|
||||
if(ub != NULL) { /* should never happen, as filtered */
|
||||
for(j = 0; j < 3; j++){
|
||||
snprintf(fString,sizeof(fString)," %8.5f %8.5f %8.5f\n",
|
||||
ub[j][0], ub[j][1], ub[j][2]);
|
||||
DynStringConcat(tData,fString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCWrite(pCon,GetCharArray(tData),eValue);
|
||||
DeleteDynString(tData);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int ChooseCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
|
||||
pHdb par[], int nPar)
|
||||
@ -315,6 +397,9 @@ void InitSimpleIndex(SConnection * pCon, SicsInterp * pSics)
|
||||
cmd = AddSICSHdbPar(pNew->objectNode, "run", usUser,
|
||||
MakeSICSFunc(RunIndexCmd));
|
||||
|
||||
cmd = AddSICSHdbPar(pNew->objectNode, "runint", usUser,
|
||||
MakeSICSFunc(RunIntIndexCmd));
|
||||
|
||||
cmd = AddSICSHdbPar(pNew->objectNode, "choose", usUser,
|
||||
MakeSICSFunc(ChooseCmd));
|
||||
cmd = AddSICSHdbPar(cmd, "solution", usUser, MakeHdbInt(0));
|
||||
|
Reference in New Issue
Block a user