- Added calculation of UB from 3 reflections to ubcalc - Added calculation of lattice constants from UB to ubcalc - Some fixes in stdscan in order to make the scripted scan work
77 lines
2.7 KiB
C
77 lines
2.7 KiB
C
/**
|
|
* This is a library for calculating UB matrices for four circle diffraction.
|
|
* The algorithm and setting definitions is from:
|
|
* Busing & Levy, Acta Cryst. (1967), 22, 457ff
|
|
*
|
|
* Implemented:
|
|
* - UB from cell cell constants and two reflections.
|
|
* - Brute force index search
|
|
*
|
|
* Mark Koennecke, march 2005
|
|
*/
|
|
#ifndef SICSUBFOUR
|
|
#define SICSUBFOUR
|
|
|
|
#include <stdio.h>
|
|
#include "matrix/matrix.h"
|
|
#include "cell.h"
|
|
|
|
/**
|
|
* error codes: also see cell.h
|
|
*/
|
|
#define UBNOMEMORY -200
|
|
#define INVALID_LAMBDA -201
|
|
#define NOTRIGHTHANDED -202
|
|
/**
|
|
* a reflection data structure holding the indices h,k,l and
|
|
* the magic four circle angles two_theta, om, chi and phi.
|
|
*/
|
|
typedef struct{
|
|
double h,k,l;
|
|
double s2t,om,chi,phi;
|
|
}reflection;
|
|
/**
|
|
* calculate a UB matrix from cell constants and two reflections
|
|
* @param direct The direct cell constants
|
|
* @param r1 The first reflection.
|
|
* @param r2 The second reflection.
|
|
* @param errCode an error indicator if things go wrong.
|
|
* @return The resulting UB matrix or NULL on errors
|
|
*/
|
|
MATRIX calcUBFromCellAndReflections(lattice direct, reflection r1, reflection r2, int *errCode);
|
|
/**
|
|
* calculate the UB matrix from three reflections. The three reflections must not be
|
|
* coplanar and must reflect a right handed
|
|
* @param r1 The first reflection
|
|
* @param r2 The second reflection
|
|
* @param r3 The third reflection.
|
|
* @param errCode a code indictang errors which happened.
|
|
* @return A UB matrix on success or NULL on errors. Then errcode will indicate
|
|
* the type of teh error.
|
|
*/
|
|
MATRIX calcUBFromThreeReflections(reflection r1, reflection r2, reflection r3,
|
|
double lambda, int *errCode);
|
|
/**
|
|
* a data structure holding an indexing suggestion
|
|
*/
|
|
typedef struct {
|
|
double h, k, l; /* suggested index */
|
|
double t2obs, t2calc, t2diff; /* 2 theta observed and calculated and the difference */
|
|
}refIndex, *prefIndex;
|
|
/**
|
|
* search for possible indexes matching the two theta value given. This is a brute force search
|
|
* @param direct The lattice constants of the crystal
|
|
* @param lambda The wavelength used
|
|
* @param two_theta The two theta value of the reflection
|
|
* @param max_deviation maximum allowed diviation of calculated two thetas from tw-Theta given
|
|
* @param limit Index limit for the search
|
|
* @param index Preallocated array for storing index suggestions. The procedure will
|
|
* sort the entries in this array according to the difference in two theta
|
|
* @param maxIndex The number of entries allowed for index.
|
|
* @return The number of indexes in index or a negative error code when an error
|
|
* occurs.
|
|
*/
|
|
int searchIndex(lattice direct, double lambda, double two_theta, double max_deviation,
|
|
int limit, refIndex index[], int maxIndex);
|
|
#endif
|