- 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

@ -30,7 +30,7 @@
#define MAXCANDIDATES 20
#define MAXREF 20
#define MAXIDX 20
#define MAXSOLUTION 20
#define MAXSOLUTION 50
#define ABS(x) (x < 0 ? -(x) : (x))
/*======================== types =============================*/
typedef struct {
@ -250,7 +250,10 @@ static int calcIndexes()
mink = -MAXIDX;
minl = -MAXIDX;
SetListMin_hkl(spgrp, MAXIDX, MAXIDX, &minh, &mink, &minl);
for(i = 0; i < nReflections; i++){
reflections[i].nHKL = 0;
}
for (h = MAXIDX; h > -MAXIDX; h--) {
for (k = MAXIDX; k > -MAXIDX; k--) {
for (l = MAXIDX; l > -MAXIDX; l--) {
@ -269,7 +272,14 @@ static int calcIndexes()
}
}
mat_free(B);
return 1;
status = 1;
for(i = 0; i < nReflections; i++){
if(reflections[i].nHKL < 1) {
SimIdxPrint(10,"Failed to find candidate indices for %4d", reflections[i].originalID);
status = 0;
}
}
return status;
}
/*-------------------------------------------------------------*/
@ -346,13 +356,27 @@ static int areCoplanar(MATRIX v1, MATRIX v2, MATRIX v3)
} else {
dot = .0;
}
if (ABS(dot) > .00001) {
if (ABS(dot) > .01) {
return 0;
} else {
return 1;
}
}
/*-------------------------------------------------------------*/
static double calcCoplanar(MATRIX v1, MATRIX v2, MATRIX v3)
{
MATRIX norm;
double dot;
norm = vectorCrossProduct(v1, v2);
if (norm != NULL) {
dot = vectorDotProduct(norm, v3);
mat_free(norm);
} else {
dot = .0;
}
return ABS(dot);
}
/*--------------------------------------------------------------
* - We want the shortest vectors
* - We do not want vectors at 180 to each other
@ -361,15 +385,17 @@ static int areCoplanar(MATRIX v1, MATRIX v2, MATRIX v3)
static int chooseTriplet(int triplet[3])
{
double angle, vol;
int idx = 1;
int idx = 1, coIdx = 0;
double coplanarVector[MAXREF], coMax = -9999999.99;
memset(coplanarVector,0,MAXREF*sizeof(double));
triplet[0] = 0;
/*
* test for 180
*/
while (idx < nReflections) {
angle = angleBetweenScatVec(reflections[0].UVW, reflections[idx].UVW);
if (angle < 160 && angle > -160) {
if (angle < 140 && angle > -140) {
triplet[1] = idx;
break;
}
@ -380,16 +406,28 @@ static int chooseTriplet(int triplet[3])
return 0;
}
/*
* Try to find a reflection which is most out of the plane build by the first
* two. A good angular separation will give a better UB
*/
for (idx = 1; idx < nReflections; idx++) {
if (idx != triplet[1]) {
if (!areCoplanar(reflections[triplet[0]].UVW,
coplanarVector[idx] = calcCoplanar(reflections[triplet[0]].UVW,
reflections[triplet[1]].UVW,
reflections[idx].UVW)) {
triplet[2] = idx;
return 1;
}
reflections[idx].UVW);
}
}
for(idx = 0; idx < nReflections; idx++){
if(coplanarVector[idx] > coMax){
coMax = coplanarVector[idx];
coIdx = idx;
}
}
if(coMax > .01){
triplet[2] = coIdx;
return 1;
}
SimIdxPrint(1, "ERROR: no three non coplanar reflections found");
return 0;
}
@ -464,10 +502,9 @@ static int testRightHandedness(int r1, int r1idx,
vol = mat_det(T);
mat_free(T);
if (vol > .0) {
return 1;
} else {
return 0;
}
}
return 1;
}
/*-------------------------------------------------------------*/
@ -502,8 +539,12 @@ static void storeSolution(int r1, int r1idx,
}
is.diff += diff;
solutions[nSolutions] = is;
nSolutions++;
if(nSolutions < MAXSOLUTION){
solutions[nSolutions] = is;
nSolutions++;
} else {
SimIdxPrint(10,"WARNING: more solutions then solution space");
}
}
/*----------------------------------------------------------------------*/
@ -685,6 +726,7 @@ int SimIdxRun()
calcRefTheta();
if (!calcIndexes()) {
SimIdxPrint(10,"ERROR: Problems finding candidate indices for reflections\nCannot continue\nCheck limits, cell and spacegroup");
return 0;
}
@ -720,12 +762,18 @@ int SimIdxRun()
return status;
}
/*=========================== solution retrieval ===================*/
/*=========================== solution management ===================*/
int SimIdxGetNSolutions()
{
return nSolutions;
}
/*------------------------------------------------------------------*/
void SimIdxRemoveSolution(int id){
if(id >= 0 && id < nSolutions){
solutions[id] = solutions[nSolutions-1];
nSolutions--;
}
}
/*------------------------------------------------------------------*/
IndexSolution SimIdxGetSolution(int id)
{