UnitCell

UnitCell — Unit cell

Synopsis

#include "cell.h"


typedef             UnitCell;

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);

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                tfn_combine                         (UnitCellTransformation *t,
                                                         double *na,
                                                         double *nb,
                                                         double *nc);
UnitCellTransformation * tfn_identity                   (void);
UnitCellTransformation * tfn_inverse                    (UnitCellTransformation *t);
void                tfn_print                           (UnitCellTransformation *t);
double *            tfn_vector                          (double a,
                                                         double b,
                                                         double c);
void                tfn_free                            (UnitCellTransformation *t);

Description

This structure represents a unit cell.

Details

UnitCell

typedef struct _unitcell UnitCell;

This data structure is opaque. You must use the available accessor functions to read and write its contents.


cell_new ()

UnitCell *          cell_new                            (void);

Create a new UnitCell.

Returns :

the new unit cell, or NULL on failure.

cell_new_from_cell ()

UnitCell *          cell_new_from_cell                  (UnitCell *orig);

cell_new_from_direct_axes ()

UnitCell *          cell_new_from_direct_axes           (struct rvec as,
                                                         struct rvec bs,
                                                         struct rvec cs);

cell_new_from_parameters ()

UnitCell *          cell_new_from_parameters            (double a,
                                                         double b,
                                                         double c,
                                                         double alpha,
                                                         double beta,
                                                         double gamma);

cell_new_from_reciprocal_axes ()

UnitCell *          cell_new_from_reciprocal_axes       (struct rvec as,
                                                         struct rvec bs,
                                                         struct rvec cs);

cell_free ()

void                cell_free                           (UnitCell *cell);

Frees a UnitCell, and all internal resources concerning that cell.

cell :

A UnitCell to free.

cell_get_cartesian ()

int                 cell_get_cartesian                  (UnitCell *cell,
                                                         double *ax,
                                                         double *ay,
                                                         double *az,
                                                         double *bx,
                                                         double *by,
                                                         double *bz,
                                                         double *cx,
                                                         double *cy,
                                                         double *cz);

cell_get_parameters ()

int                 cell_get_parameters                 (UnitCell *cell,
                                                         double *a,
                                                         double *b,
                                                         double *c,
                                                         double *alpha,
                                                         double *beta,
                                                         double *gamma);

cell_get_pointgroup ()

const char *        cell_get_pointgroup                 (UnitCell *cell);

cell_get_reciprocal ()

int                 cell_get_reciprocal                 (UnitCell *cell,
                                                         double *asx,
                                                         double *asy,
                                                         double *asz,
                                                         double *bsx,
                                                         double *bsy,
                                                         double *bsz,
                                                         double *csx,
                                                         double *csy,
                                                         double *csz);

cell_set_cartesian ()

void                cell_set_cartesian                  (UnitCell *cell,
                                                         double ax,
                                                         double ay,
                                                         double az,
                                                         double bx,
                                                         double by,
                                                         double bz,
                                                         double cx,
                                                         double cy,
                                                         double cz);

cell_set_cartesian_a ()

void                cell_set_cartesian_a                (UnitCell *cell,
                                                         double ax,
                                                         double ay,
                                                         double az);

cell_set_cartesian_b ()

void                cell_set_cartesian_b                (UnitCell *cell,
                                                         double bx,
                                                         double by,
                                                         double bz);

cell_set_cartesian_c ()

void                cell_set_cartesian_c                (UnitCell *cell,
                                                         double cx,
                                                         double cy,
                                                         double cz);

cell_set_parameters ()

void                cell_set_parameters                 (UnitCell *cell,
                                                         double a,
                                                         double b,
                                                         double c,
                                                         double alpha,
                                                         double beta,
                                                         double gamma);

cell_set_pointgroup ()

void                cell_set_pointgroup                 (UnitCell *cell,
                                                         const char *sym);

cell_set_reciprocal ()

void                cell_set_reciprocal                 (UnitCell *cell,
                                                         double asx,
                                                         double asy,
                                                         double asz,
                                                         double bsx,
                                                         double bsy,
                                                         double bsz,
                                                         double csx,
                                                         double csy,
                                                         double csz);

tfn_combine ()

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.

t :

A UnitCellTransformation

na :

Pointer to three doubles representing naa, nab, nac

nb :

Pointer to three doubles representing nba, nbb, nbc

nc :

Pointer to three doubles representing nca, ncb, ncc

tfn_identity ()

UnitCellTransformation * tfn_identity                   (void);

Returns :

A UnitCellTransformation corresponding to an identity operation.

tfn_inverse ()

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).

t :

A UnitCellTransformation.

Returns :

The inverse of t.

tfn_print ()

void                tfn_print                           (UnitCellTransformation *t);

Prints information about t to stderr.

t :

A UnitCellTransformation

tfn_vector ()

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));

a :

Amount of "a" to include in new vector

b :

Amount of "b" to include in new vector

c :

Amount of "c" to include in new vector

tfn_free ()

void                tfn_free                            (UnitCellTransformation *t);

Frees all resources associated with t.

t :

A UnitCellTransformation