| CrystFEL Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include "cell.h" typedef UnitCell; enum LatticeType; typedef UnitCellTransformation; UnitCell * cell_new (void); UnitCell * cell_new_from_cell (UnitCell *orig); UnitCell * cell_new_from_direct_axes (struct rvec as,struct rvec bs,struct rvec cs); UnitCell * cell_new_from_parameters (double a,double b,double c,double alpha,double beta,double gamma); UnitCell * cell_new_from_reciprocal_axes (struct rvec as,struct rvec bs,struct rvec cs); void cell_free (UnitCell *cell); int cell_get_cartesian (UnitCell *cell,double *ax,double *ay,double *az,double *bx,double *by,double *bz,double *cx,double *cy,double *cz); int cell_get_parameters (UnitCell *cell,double *a,double *b,double *c,double *alpha,double *beta,double *gamma); const char * cell_get_pointgroup (UnitCell *cell); int cell_get_reciprocal (UnitCell *cell,double *asx,double *asy,double *asz,double *bsx,double *bsy,double *bsz,double *csx,double *csy,double *csz); char cell_get_centering (UnitCell *cell); LatticeType cell_get_lattice_type (UnitCell *cell); char cell_get_unique_axis (UnitCell *cell); void cell_set_cartesian (UnitCell *cell,double ax,double ay,double az,double bx,double by,double bz,double cx,double cy,double cz); void cell_set_cartesian_a (UnitCell *cell,double ax,double ay,double az); void cell_set_cartesian_b (UnitCell *cell,double bx,double by,double bz); void cell_set_cartesian_c (UnitCell *cell,double cx,double cy,double cz); void cell_set_parameters (UnitCell *cell,double a,double b,double c,double alpha,double beta,double gamma); void cell_set_pointgroup (UnitCell *cell,const char *sym); void cell_set_reciprocal (UnitCell *cell,double asx,double asy,double asz,double bsx,double bsy,double bsz,double csx,double csy,double csz); void cell_set_centering (UnitCell *cell,char centering); void cell_set_lattice_type (UnitCell *cell,LatticeType lattice_type); void cell_set_unique_axis (UnitCell *cell,char unique_axis); UnitCell * cell_transform (UnitCell *cell,UnitCellTransformation *t); UnitCell * cell_transform_inverse (UnitCell *cell,UnitCellTransformation *t); void tfn_combine (UnitCellTransformation *t,double *na,double *nb,double *nc); UnitCellTransformation * tfn_identity (void); UnitCellTransformation * tfn_from_intmat (IntegerMatrix *m); UnitCellTransformation * tfn_inverse (UnitCellTransformation *t); void tfn_print (UnitCellTransformation *t); double * tfn_vector (double a,double b,double c); void tfn_free (UnitCellTransformation *t); const char * cell_rep (UnitCell *cell);
typedef struct _unitcell UnitCell;
This data structure is opaque. You must use the available accessor functions to read and write its contents.
typedef enum {
L_TRICLINIC,
L_MONOCLINIC,
L_ORTHORHOMBIC,
L_TETRAGONAL,
L_RHOMBOHEDRAL,
L_HEXAGONAL,
L_CUBIC
} LatticeType;
An enumeration of the possible lattice types: triclinic, monoclinic, orthorhombic, tetragonal, rhombohedral, hexagonal and cubic.
typedef struct _unitcelltransformation UnitCellTransformation;
This opaque data structure represents a tranformation of a unit cell, such as a rotation or a centering operation.
UnitCell * cell_new (void);
Create a new UnitCell.
Returns : |
the new unit cell, or NULL on failure. |
UnitCell * cell_new_from_direct_axes (struct rvec as,struct rvec bs,struct rvec cs);
UnitCell * cell_new_from_parameters (double a,double b,double c,double alpha,double beta,double gamma);
UnitCell * cell_new_from_reciprocal_axes (struct rvec as,struct rvec bs,struct rvec cs);
void cell_free (UnitCell *cell);
Frees a UnitCell, and all internal resources concerning that cell.
|
A UnitCell to free. |
int cell_get_cartesian (UnitCell *cell,double *ax,double *ay,double *az,double *bx,double *by,double *bz,double *cx,double *cy,double *cz);
int cell_get_parameters (UnitCell *cell,double *a,double *b,double *c,double *alpha,double *beta,double *gamma);
int cell_get_reciprocal (UnitCell *cell,double *asx,double *asy,double *asz,double *bsx,double *bsy,double *bsz,double *csx,double *csy,double *csz);
void cell_set_cartesian (UnitCell *cell,double ax,double ay,double az,double bx,double by,double bz,double cx,double cy,double cz);
void cell_set_cartesian_a (UnitCell *cell,double ax,double ay,double az);
void cell_set_cartesian_b (UnitCell *cell,double bx,double by,double bz);
void cell_set_cartesian_c (UnitCell *cell,double cx,double cy,double cz);
void cell_set_parameters (UnitCell *cell,double a,double b,double c,double alpha,double beta,double gamma);
void cell_set_reciprocal (UnitCell *cell,double asx,double asy,double asz,double bsx,double bsy,double bsz,double csx,double csy,double csz);
UnitCell * cell_transform (UnitCell *cell,UnitCellTransformation *t);
Applies t to cell. Note that the lattice type, centering and unique axis
information will not be preserved.
|
A UnitCell. |
|
A UnitCellTransformation. |
Returns : |
Transformed copy of cell. |
UnitCell * cell_transform_inverse (UnitCell *cell,UnitCellTransformation *t);
Applies the inverse of t to cell.
|
A UnitCell. |
|
A UnitCellTransformation. |
Returns : |
Transformed copy of cell. |
void tfn_combine (UnitCellTransformation *t,double *na,double *nb,double *nc);
Updates t such that it represents its previous transformation followed by
a new transformation, corresponding to letting a = naa*a + nab*b + nac*c.
Likewise, a = nba*a + nbb*b + nbc*c and c = nca*a + ncb*b + ncc*c.
|
A UnitCellTransformation
|
|
Pointer to three doubles representing naa, nab, nac |
|
Pointer to three doubles representing nba, nbb, nbc |
|
Pointer to three doubles representing nca, ncb, ncc |
UnitCellTransformation * tfn_identity (void);
Returns : |
A UnitCellTransformation corresponding to an identity operation. |
UnitCellTransformation * tfn_from_intmat (IntegerMatrix *m);
|
An IntegerMatrix
|
Returns : |
A UnitCellTransformation corresponding to m. |
UnitCellTransformation * tfn_inverse (UnitCellTransformation *t);
Calculates the inverse of t. That is, if you apply cell_transform() to a
UnitCell using t, and then apply cell_transform() to the result using
tfn_inverse(t) instead of t, you will recover the same lattice vectors
(but note that the lattice type, centering and unique axis information will
be lost).
|
A UnitCellTransformation. |
Returns : |
The inverse of t. |
void tfn_print (UnitCellTransformation *t);
Prints information about t to stderr.
|
A UnitCellTransformation
|
double * tfn_vector (double a,double b,double c);
This is a convenience function to use when sending vectors to tfn_combine():
tfn_combine(tfn, tfn_vector(1,0,0),
tfn_vector(0,2,0),
tfn_vector(0,0,1));
|
Amount of "a" to include in new vector |
|
Amount of "b" to include in new vector |
|
Amount of "c" to include in new vector |
void tfn_free (UnitCellTransformation *t);
Frees all resources associated with t.
|
A UnitCellTransformation
|