- Many fixes to the four circle codes during taking the new code into

operation.
- Fixed some missing output
- Second generation histogram memory and velocity selector objects
- Fixed a problem in diffscan
This commit is contained in:
koennecke
2009-05-15 13:21:20 +00:00
parent 8c6d95bee6
commit 3f3f0810e5
34 changed files with 1014 additions and 117 deletions

View File

@ -167,7 +167,7 @@ static int FourMessStart(pSICSOBJ self, SConnection * pCon,
/* open the reflection file */
sprintf(pBueffel, "Writing to %s.ccl, .rfl", pRoot);
SCWrite(pCon, pBueffel, eValue);
SCWrite(pCon, pBueffel, eLog);
strcpy(pFilename, pRoot);
strcat(pFilename, "ccl");
priv->profFile = fopen(pFilename, "w");
@ -230,6 +230,41 @@ static int FourMessStart(pSICSOBJ self, SConnection * pCon,
priv->count = 0;
return 1;
}
/*-----------------------------------------------------------------------------*/
static int FourMessReopen(pSICSOBJ self, SConnection * pCon,
pHdb commandNode, pHdb par[], int nPar)
{
pFourMess priv = NULL;
char pFilename[1024];
priv = self->pPrivate;
if(priv->hklFile != NULL){
return 1; /* still open! */
}
if(priv->currentFileRoot == NULL){
SCWrite(pCon,"ERROR: nothing to append too", eLogError);
return 0;
}
strcpy(pFilename, priv->currentFileRoot);
strcat(pFilename, "ccl");
priv->profFile = fopen(pFilename, "a");
if(priv->profFile == NULL){
SCPrintf(pCon,eLogError,"ERROR: failed to reopen %s", pFilename);
return 0;
}
strcpy(pFilename, priv->currentFileRoot);
strcat(pFilename, "rfl");
priv->hklFile = fopen(pFilename, "a");
if(priv->hklFile == NULL){
SCPrintf(pCon,eLogError,"ERROR: failed to reopen %s", pFilename);
return 0;
}
SCPrintf(pCon,eValue,"Reopened %s.ccl,.rfl", priv->currentFileRoot);
return 1;
}
/*----------------------------------------------------------------------------*/
static int FourMessScanPar(pSICSOBJ self, SConnection * pCon,
pHdb commandNode, pHdb par[], int nPar)
@ -351,7 +386,7 @@ static double getProtonAverage(pFourMess self)
/*---------------------------------------------------------------------------*/
static int FourMessStoreIntern(pSICSOBJ self, SConnection * pCon,
double fHkl[3], double fPosition[4])
double fHkl[3], double fPosition[4], char *extra)
{
pFourMess priv = self->pPrivate;
float fSum, fSigma, fTemp, fStep, fPreset;
@ -453,8 +488,13 @@ static int FourMessStoreIntern(pSICSOBJ self, SConnection * pCon,
GetScanVarStep(priv->pScanner, 0, &fStep);
fPreset = GetScanPreset(priv->pScanner);
prot = getProtonAverage(priv);
fprintf(priv->profFile, "%3d %7.4f %9.0f %7.3f %12f %s\n", iNP, fStep,
fPreset, fTemp, prot, pBueffel);
if(extra == NULL){
fprintf(priv->profFile, "%3d %7.4f %9.0f %7.3f %12f %s\n", iNP, fStep,
fPreset, fTemp, prot, pBueffel);
} else {
fprintf(priv->profFile, "%3d %7.4f %9.0f %7.3f %12f %s %s\n", iNP, fStep,
fPreset, fTemp, prot, extra, pBueffel);
}
for (i = 0; i < iNP; i++) {
for (ii = 0; ii < 10 && i < iNP; ii++) {
fprintf(priv->profFile, " %7ld", lCounts[i]);
@ -518,7 +558,32 @@ static int FourMessStore(pSICSOBJ self, SConnection * pCon,
fPosition[i] = par[i + 3]->value.v.doubleValue;
}
return FourMessStoreIntern(self, pCon, fHkl, fPosition);
return FourMessStoreIntern(self, pCon, fHkl, fPosition, NULL);
}
/*----------------------------------------------------------------------------*/
static int FourMessStoreExtra(pSICSOBJ self, SConnection * pCon,
pHdb commandNode, pHdb par[], int nPar)
{
double fHkl[3], fPosition[4];
int i;
if (nPar < 8) {
SCWrite(pCon, "ERROR: not enough arguments for storeextra", eError);
return 0;
}
/* load hkl */
for (i = 0; i < 3; i++) {
fHkl[i] = par[i]->value.v.doubleValue;
}
/* load positions */
for (i = 0; i < 4; i++) {
fPosition[i] = par[i + 3]->value.v.doubleValue;
}
return FourMessStoreIntern(self, pCon, fHkl, fPosition, par[7]->value.v.text);
}
/*------------------------------------------------------------------*/
@ -619,18 +684,21 @@ static int GenIndex(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
H = mat_creat(3, 1, ZERO_MATRIX);
for (h = hkllim.v.intArray[0]; h < hkllim.v.intArray[3]; h++) {
for (k = hkllim.v.intArray[1]; k < hkllim.v.intArray[4]; k++) {
for (l = hkllim.v.intArray[2]; l < hkllim.v.intArray[5]; l++) {
for (h = hkllim.v.intArray[0]; h <= hkllim.v.intArray[3]; h++) {
for (k = hkllim.v.intArray[1]; k <= hkllim.v.intArray[4]; k++) {
for (l = hkllim.v.intArray[2]; l <= hkllim.v.intArray[5]; l++) {
/* SCPrintf(pCon,eLog, "Testing %d, %d, %d", h,k,l); */
/* first test: extinct */
if (IsSysAbsent_hkl(sginfo, h, k, l, NULL) != 0) {
/* SCPrintf(pCon,eLog, "%d, %d, %d rejected for sys absent", h, k, l); */
continue;
}
}
/* second test: a symmetrically equivalent already seen */
if ((suppress != 0) && IsSuppressed_hkl(sginfo, minh, mink, minl,
hkllim.v.intArray[1],
hkllim.v.intArray[2], h, k,
l) != 0) {
/* SCPrintf(pCon,eLog, "%d, %d, %d rejected for symmetrical eqiv", h, k, l); */
continue;
}
/* third test: within stt limits */
@ -647,7 +715,7 @@ static int GenIndex(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
hkl[2] = (double) l;
AddRefIdx(priv->messList, hkl);
count++;
}
}
}
}
}
@ -827,6 +895,9 @@ void InstallFourMess(SConnection * pCon, SicsInterp * pSics)
cmd =
AddSICSHdbPar(pNew->objectNode, "close", usUser,
MakeSICSFunc(FourMessClose));
cmd =
AddSICSHdbPar(pNew->objectNode, "reopen", usUser,
MakeSICSFunc(FourMessReopen));
cmd =
AddSICSHdbPar(pNew->objectNode, "prepare", usUser,
@ -847,6 +918,19 @@ void InstallFourMess(SConnection * pCon, SicsInterp * pSics)
AddSICSHdbPar(cmd, "om", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "chi", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "phi", usUser, MakeHdbFloat(.0));
cmd =
AddSICSHdbPar(pNew->objectNode, "storeextra", usUser,
MakeSICSFunc(FourMessStoreExtra));
AddSICSHdbPar(cmd, "h", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "k", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "l", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "stt", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "om", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "chi", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "phi", usUser, MakeHdbFloat(.0));
AddSICSHdbPar(cmd, "extra", usUser, MakeHdbText(""));
cmd =
AddSICSHdbPar(pNew->objectNode, "weak", usUser,
MakeSICSFunc(FourMessWeak));