libcrystfel
0.10.1

Functions  
double  resolution (UnitCell *cell, signed int h, signed int k, signed int l) 
UnitCell *  cell_rotate (UnitCell *in, struct quaternion quat) 
UnitCell *  rotate_cell (UnitCell *in, double omega, double phi, double rot) 
void  cell_print (UnitCell *cell) 
void  cell_print_oneline (UnitCell *cell) 
void  cell_print_full (UnitCell *cell) 
UnitCell *  load_cell_from_pdb (const char *filename) 
UnitCell *  load_cell_from_file (const char *filename) 
void  write_cell (UnitCell *cell, FILE *fh) 
int  cell_is_sensible (UnitCell *cell) 
int  validate_cell (UnitCell *cell) 
UnitCell *  uncenter_cell (UnitCell *in, IntegerMatrix **pC, RationalMatrix **pCi) 
int  bravais_lattice (UnitCell *cell) 
int  has_unique_axis (LatticeType l) 
int  right_handed (UnitCell *cell) 
const char *  str_lattice (LatticeType l) 
LatticeType  lattice_from_str (const char *s) 
int  forbidden_reflection (UnitCell *cell, signed int h, signed int k, signed int l) 
double  cell_get_volume (UnitCell *cell) 
double  lowest_reflection (UnitCell *cell) 
int  compare_cell_parameters (UnitCell *cell, UnitCell *reference, const double *tols) 
int  compare_cell_parameters_and_orientation (UnitCell *cell, UnitCell *reference, const double *tols) 
int  compare_permuted_cell_parameters_and_orientation (UnitCell *cell, UnitCell *reference, const double *tols, IntegerMatrix **pmb) 
int  compare_derivative_cell_parameters (UnitCell *cell, UnitCell *reference, const double *tols, int csl, RationalMatrix **pmb) 
UnitCell *  compare_reindexed_cell_parameters (UnitCell *cell_in, UnitCell *reference_in, const double *tols, RationalMatrix **pmb) 
Unit cell utility functions.
double cell_get_volume  (  UnitCell *  cell  ) 
UnitCell* cell_rotate  (  UnitCell *  in, 
struct quaternion  quat  
) 
in  A UnitCell to rotate 
quat  A quaternion 
Rotate a UnitCell using a quaternion.
in
. cell  A UnitCell 
reference  Another UnitCell 
tols  Pointer to tolerances for a,b,c (fractional), al,be,ga (radians) 
Compare the two unit cells. If the real space parameters match to within the specified tolerances, and the centering matches, this function returns 1. Otherwise 0.
This function considers the cell parameters and centering, but ignores the orientation of the cell. If you want to compare the orientation as well, use compare_cell_parameters_and_orientation() instead.
int compare_cell_parameters_and_orientation  (  UnitCell *  cell, 
UnitCell *  reference,  
const double *  tols  
) 
cell  A UnitCell 
reference  Another UnitCell 
tols  Pointer to six tolerance values (see below) 
Compare the two unit cells. If the axes match in length (to within the specified tolerances), this function returns nonzero.
This function compares the orientation of the cell as well as the parameters. If you just want to see if the parameters are the same, use compare_cell_parameters() instead.
The comparison is done by checking that the lengths of the unit cell axes are the same between the two cells, and that the axes have similar directions in 3D space. The first three tolerance values are the maximum allowable fractional differences between the a,b,c axis lengths (respectively) of the two cells. The last three tolerance values are the maximum allowable angles, in radians, between the directions of the a,b,c axes of the two cells.
cell
and reference
must have the same centering. Otherwise, this function always returns zero.
int compare_derivative_cell_parameters  (  UnitCell *  cell_in, 
UnitCell *  reference_in,  
const double *  tols,  
int  csl,  
RationalMatrix **  pmb  
) 
cell_in  A UnitCell 
reference_in  Another UnitCell 
tols  Pointer to tolerances for a,b,c (fractional), al,be,ga (radians) 
csl  Nonzero to look for coincidence site lattice relationships 
pmb  Place to store pointer to matrix 
Compare the cell_in
with reference_in
. If cell
is a derivative lattice of reference
, within fractional axis length differences tols
[0..2] and absolute angle difference tols
[3..5] (in radians), this function returns nonzero and stores the transformation which needs to be applied to cell_in
at pmb
.
Note that the tolerances will be applied to the primitive unit cell. If the reference cell is centered, a primitive unit cell will first be calculated.
Subject to the tolerances, this function will find the transformation which gives the best match to the reference cell, using the Euclidian norm in G6 [see e.g. Andrews and Bernstein, Acta Cryst. A44 (1988) p1009].
Only the cell parameters will be compared. The relative orientations are irrelevant.
If csl
is zero, the lattices must be derivatives of one another. If nonzero, a coincidence site lattice relationship will be searched for, meaning that the lattice points of the transformed version of cell_in
might not coincide with lattice points of reference_in
.
This function is used by CrystFEL's cell_tool program to find nonobvious relationships between crystal lattices. For most routine comparisons, this function is probably not the one you need!
int compare_permuted_cell_parameters_and_orientation  (  UnitCell *  cell, 
UnitCell *  reference,  
const double *  tols,  
IntegerMatrix **  pmb  
) 
cell  A UnitCell 
reference  Another UnitCell 
tols  Pointer to six tolerance values (see below) 
pmb  Place to store pointer to matrix 
Compare the two unit cells. If, using any permutation of the axes, the axes can be made to match in length and the axes aligned in space, this function returns nonzero and stores the transformation which must be applied to cell
at pmb
.
A "permutation" means a transformation represented by a matrix with all elements equal to +1, 0 or 1, having determinant +1 or 1. That means that this function will find the relationship between a lefthanded and a right handed basis.
Note that the orientations of the cells must match, not just the parameters. The comparison is done after reindexing using compare_cell_parameters_and_orientation(). See that function for more details.
cell
and reference
must have the same centering. Otherwise, this function always returns zero.
UnitCell* compare_reindexed_cell_parameters  (  UnitCell *  cell_in, 
UnitCell *  reference_in,  
const double *  tols,  
RationalMatrix **  pmb  
) 
cell_in  A UnitCell 
reference_in  Another UnitCell 
tols  Pointer to tolerances for a,b,c (fractional), al,be,ga (radians) 
pmb  Place to store pointer to matrix, or NULL if not needed 
Compare the cell_in
with reference_in
. If they represent the same lattice, this function returns a copy of cell_in
transformed to look similar to reference_in
. Otherwise, it returns NULL.
If \pmb is nonNULL, the transformation which needs to be applied to cell_in
will be stored there.
Only the cell parameters will be compared. The relative orientations are irrelevant. The tolerances will be applied to the transformed copy of cell_in
, i.e. the version of the input cell which looks similar to reference_in
. Subject to the tolerances, the cell will be chosen which has the lowest total absolute error in unit cell axis lengths.
There will usually be several transformation matrices which produce exactly the same total absolute error. If one of the matrices is an identity, that one will be used. Otherwise, the matrix will be selected at random from the possibilities. This avoids skewed distributions of unit cell parameters, e.g. the angles always being greater than 90 degrees.
This is the right function to use for deciding if an indexing solution matches a reference cell or not.
int forbidden_reflection  (  UnitCell *  cell, 
signed int  h,  
signed int  k,  
signed int  l  
) 
cell  A UnitCell 
h  h index to check 
k  k index to check 
l  l index to check 
UnitCell* load_cell_from_file  (  const char *  filename  ) 
filename  The filename from which to load the cell 
Loads a unit cell from a file of any type (PDB or CrystFEL format)
UnitCell* load_cell_from_pdb  (  const char *  filename  ) 
filename  The filename from which to load the cell 
Loads a unit cell from the CRYST1 line of a PDB file.
double lowest_reflection  (  UnitCell *  cell  ) 
cell  A UnitCell 
in  A UnitCell to rotate 
omega  Euler angle about +z 
phi  Euler angle about +x 
rot  Euler angle about new +z 
Rotate a UnitCell using Euler angles
in
. UnitCell* uncenter_cell  (  UnitCell *  in, 
IntegerMatrix **  pC,  
RationalMatrix **  pCi  
) 
in  A UnitCell 
pC  Location at which to store the centering transformation 
pCi  Location at which to store the inverse centering transformation 
Turns any cell into a primitive one, e.g. for comparison purposes.
The transformation which was used is stored at Ci
. The centering transformation, which is the transformation you should apply if you want to get back the original cell, will be stored at C
. Either or both of these can be NULL if you don't need that information.
in
. int validate_cell  (  UnitCell *  cell  ) 
cell  A UnitCell to validate 
Perform some checks for crystallographic validity cell
, such as that the lattice is a conventional Bravais lattice. Warnings are printied if any of the checks are failed.
void write_cell  (  UnitCell *  cell, 
FILE *  fh  
) 
cell  a UnitCell 
fh  a file handle 
Writes cell
to fh
, in CrystFEL unit cell file format