Fixed an incommensurate problem

No duplicate reflections are created with propagation vectors containing .5
This commit is contained in:
2014-08-27 16:26:44 +02:00
parent 8f704ebab9
commit c3fe7555db
3 changed files with 47 additions and 16 deletions

View File

@ -753,11 +753,11 @@ static int GenInconsumerate(pSICSOBJ self, SConnection * pCon,
{ {
double hkl[3], qvec[3]; double hkl[3], qvec[3];
pFourMess priv = self->pPrivate; pFourMess priv = self->pPrivate;
int i, j; int i, j, iGen = 0, startCount;
if (nPar < 3) { if (nPar < 3) {
SCWrite(pCon, SCWrite(pCon,
"ERROR: need q displacement vector with three compononts", "ERROR: need q displacement vector with three components",
eError); eError);
return 0; return 0;
} }
@ -765,31 +765,32 @@ static int GenInconsumerate(pSICSOBJ self, SConnection * pCon,
qvec[1] = par[1]->value.v.doubleValue; qvec[1] = par[1]->value.v.doubleValue;
qvec[2] = par[2]->value.v.doubleValue; qvec[2] = par[2]->value.v.doubleValue;
for (i = 0; i < priv->masterCount; i++) { startCount = priv->masterCount;
for (i = 0; i < startCount; i++) {
GetRefIndex(priv->messList, i, hkl); GetRefIndex(priv->messList, i, hkl);
if(ABS(hkl[0])+ABS(hkl[1])+ABS(hkl[2]) < .3){
/*
* Stop generation for 0,0,0,
*/
continue;
}
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
hkl[j] += qvec[j]; hkl[j] += qvec[j];
} }
AddRefIdx(priv->messList, hkl); AddRefIdx(priv->messList, hkl);
iGen++;
GetRefIndex(priv->messList, i, hkl); GetRefIndex(priv->messList, i, hkl);
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
hkl[j] -= qvec[j]; hkl[j] -= qvec[j];
} }
AddRefIdx(priv->messList, hkl); if(FindHKL(priv->messList, hkl[0], hkl[1], hkl[2]) == NULL){
AddRefIdx(priv->messList, hkl);
iGen++;
}
if(SCGetInterrupt(pCon) != eContinue){ if(SCGetInterrupt(pCon) != eContinue){
SCWrite(pCon,"ERROR: generating incommensurate reflections aborted", eError); SCWrite(pCon,"ERROR: generating incommensurate reflections aborted", eError);
return 0; return 0;
} }
if( (i % 50) == 0 ){
SCPrintf(pCon,eLog, "%d of %d input reflections processed", i, startCount);
}
} }
SCPrintf(pCon, eValue, SCPrintf(pCon, eValue,
"%d additional inconsumerate reflections generated", "%d additional inconsumerate reflections generated", iGen);
priv->masterCount*2);
return 1; return 1;
} }

View File

@ -25,6 +25,8 @@ static char undef[] = "Undefined";
#define IDXFMT " %8.4f" #define IDXFMT " %8.4f"
#define ANGFMT " %8.2f" #define ANGFMT " %8.2f"
#define ABS(x) (x < 0 ? -(x) : (x))
int CountTblCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode, int CountTblCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
pHdb par[], int nPar); /* from hdbtable.c */ pHdb par[], int nPar); /* from hdbtable.c */
@ -369,6 +371,32 @@ static int ShowCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
return 1; return 1;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
const char *FindHKL(pSICSOBJ self, double h, double k, double l)
{
pHdb node, idx;
node = GetHipadabaNode(self->objectNode, "data");
node = node->child;
while(node != NULL){
idx = node->child;
if(ABS(idx->value.v.doubleValue-h) > .1){
node = node->next;
continue;
}
idx = idx->next;
if(ABS(idx->value.v.doubleValue-k) > .1){
node = node->next;
continue;
}
idx = idx->next;
if(ABS(idx->value.v.doubleValue-l) < .1){
return node->name;
}
node = node->next;
}
return NULL;
}
/*-----------------------------------------------------------------------*/
static int NamesCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode, static int NamesCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
pHdb par[], int nPar) pHdb par[], int nPar)
{ {
@ -687,10 +715,10 @@ int GetRefIndexID(pSICSOBJ refl, char *id, double hkl[])
snprintf(path, 132, "data/%s", id); snprintf(path, 132, "data/%s", id);
node = GetHipadabaNode(refl->objectNode, path); node = GetHipadabaNode(refl->objectNode, path);
if (node != NULL) { if (node != NULL) {
child = node->child; child = node->child;
for(i = 0; i < 3; i++, child = child->next){ for(i = 0; i < 3; i++, child = child->next){
hkl[i] = child->value.v.doubleValue; hkl[i] = child->value.v.doubleValue;
} }
return 1; return 1;
} else { } else {
return 0; return 0;

View File

@ -57,4 +57,6 @@ int GetRefFlag(pSICSOBJ refl, int idx);
char *GetRefName(pSICSOBJ refl, int idx); char *GetRefName(pSICSOBJ refl, int idx);
const char *FindHKL(pSICSOBJ self, double h, double k, double l);
#endif /*REFLIST_H_ */ #endif /*REFLIST_H_ */