UnitCell

UnitCell — Unit cell

Functions

Types and Values

typedef UnitCell
enum LatticeType
typedef UnitCellTransformation
struct rvec

Includes

#include "cell.h"

Description

This structure represents a unit cell.

Functions

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.

Parameters

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_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_get_centering ()

char
cell_get_centering (UnitCell *cell);

cell_get_lattice_type ()

LatticeType
cell_get_lattice_type (UnitCell *cell);

cell_get_unique_axis ()

char
cell_get_unique_axis (UnitCell *cell);

cell_has_parameters ()

int
cell_has_parameters (UnitCell *cell);

Parameters

cell

A UnitCell

 

Returns

True if cell has its parameters specified.


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_parameters ()

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

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

cell_set_centering ()

void
cell_set_centering (UnitCell *cell,
                    char centering);

cell_set_lattice_type ()

void
cell_set_lattice_type (UnitCell *cell,
                       LatticeType lattice_type);

cell_set_unique_axis ()

void
cell_set_unique_axis (UnitCell *cell,
                      char unique_axis);

cell_transform ()

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.

Parameters

cell

A UnitCell.

 

t

A UnitCellTransformation.

 

Returns

Transformed copy of cell .


cell_transform_inverse ()

UnitCell *
cell_transform_inverse (UnitCell *cell,
                        UnitCellTransformation *t);

Applies the inverse of t to cell .

Parameters

cell

A UnitCell.

 

t

A UnitCellTransformation.

 

Returns

Transformed copy of cell .


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.

Parameters

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_from_intmat ()

UnitCellTransformation *
tfn_from_intmat (IntegerMatrix *m);

Parameters

m

An IntegerMatrix

 

Returns

A UnitCellTransformation corresponding to m .


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

Parameters

Returns

The inverse of t .


tfn_print ()

void
tfn_print (UnitCellTransformation *t);

Prints information about t to stderr.

Parameters


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

Parameters

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 .

Parameters


cell_rep ()

const char *
cell_rep (UnitCell *cell);

Types and Values

UnitCell

typedef struct _unitcell UnitCell;

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


enum LatticeType

An enumeration of the possible lattice types: triclinic, monoclinic, orthorhombic, tetragonal, rhombohedral, hexagonal and cubic.

Members

L_TRICLINIC

Triclinic lattice

 

L_MONOCLINIC

Monoclinic lattice

 

L_ORTHORHOMBIC

Orthorhombic lattice

 

L_TETRAGONAL

Tetragonal lattice

 

L_RHOMBOHEDRAL

Rhombohedral lattice

 

L_HEXAGONAL

Hexagonal lattice

 

L_CUBIC

Cubic lattice

 

UnitCellTransformation

typedef struct _unitcelltransformation UnitCellTransformation;

This opaque data structure represents a tranformation of a unit cell, such as a rotation or a centering operation.


struct rvec

struct rvec {
	double   u;
	double   v;
	double   w;
};

Structure representing a 3D vector in reciprocal space. Note: Heavily abused to serve as a real space vector as well.

Members

double u;

x component (in reciprocal space)

 

double v;

y component (in reciprocal space)

 

double w;

z component (in reciprocal space)