Lattice

#### Next topic

Overview: Reflections in IPLT

# Spatial and Reciprocal Unit Cells¶

The unit cell defined by the two classes SpatialUnitCell and ReciprocalUnitCell is a special case of a full 3D unit cell, tailored for use in 2D crystallography: it’s parameters are given by the two axis lengths A and B, the angle γ between them, and a thickness C which represents the third dimension along the z-axis.

The distinction between spatial and reciprocal unit cell is for convenience purposes, since one form is implicitly convertible to the other (see Examples below).

## Examples¶

```import math, ex
ru=ex.ReciprocalUnitCell(su) # conversion spatial->reciprocal
print "Reciprocal parameters: %g %g %g"%(ru.GetA(),ru.GetB(),ru.GetGamma())
su2=ex.SpatialUnitCell(ru) # conversion reciprocal->spatial
```

## Interface¶

class iplt.SpatialUnitCell((object)self, (float)a, (float)b, (float)gamma[, (float)c=1.0[, (str)symmetry='P 1']])
GetA((_CellImpl)self) → float :

returns length of A

GetB((_CellImpl)self) → float :

returns length of B

GetC((_CellImpl)self) → float :

returns thickness

GetGamma((_CellImpl)self) → float :

returns angle (in rad) between A and B

GetPosition((_CellImpl)self, (Point)hk) → Vec2 :

retrieve position at index hk

GetSymmetry((_CellImpl)self) → Symmetry :

returns symmetry

GetVecA((_CellImpl)self) → Vec2 :

returns the A vector

GetVecB((_CellImpl)self) → Vec2 :

returns the B vector

SetC((_CellImpl)self, (float)c) → None :

sets thickness

SetSymmetry((_CellImpl)self, (str)sym) → None :
sets symmetry by name
SetSymmetry( (_CellImpl)self, (Symmetry)sym) -> None :
sets symmetry by sym object
__init__((object)self, (float)a, (float)b, (float)gamma[, (float)c=1.0[, (str)symmetry='P 1']]) → None :
Creates a spatial unit cell with the given values for A, B and gamma, plus an optional thickness C and symmetry
__init__( (object)self, (ReciprocalUnitCell)reciprocal_unitcell) -> None :
Creates a spatial unit cell from a reciprocal one
__init__( (object)self, (Lattice)lattice, (Vec3)spatial_sampling [, (float)c=1.0 [, (str)symmetry=’P 1’]]) -> None :
Creates a spatial unit cell from a lattice, using the provided spatial pixel sampling and an optional thicknes C and symmetry
class iplt.ReciprocalUnitCell((object)self, (float)a, (float)b, (float)gamma[, (float)c=1.0[, (str)symmetry='P 1']])
GetA((_CellImpl)self) → float :

returns length of A

GetB((_CellImpl)self) → float :

returns length of B

GetC((_CellImpl)self) → float :

returns thickness

GetGamma((_CellImpl)self) → float :

returns angle (in rad) between A and B

GetPosition((_CellImpl)self, (Point)hk) → Vec2 :

retrieve position at index hk

GetSymmetry((_CellImpl)self) → Symmetry :

returns symmetry

GetVecA((_CellImpl)self) → Vec2 :

returns the A vector

GetVecB((_CellImpl)self) → Vec2 :

returns the B vector

SetC((_CellImpl)self, (float)c) → None :

sets thickness

SetSymmetry((_CellImpl)self, (str)sym) → None :
sets symmetry by name
SetSymmetry( (_CellImpl)self, (Symmetry)sym) -> None :
sets symmetry by sym object
__init__((object)self, (float)a, (float)b, (float)gamma[, (float)c=1.0[, (str)symmetry='P 1']]) → None :
Creates a reciprocal unit cell with the given values for A, B and gamma, plus an optional thickness C and symmetry
__init__( (object)self, (SpatialUnitCell)spatial_unitcell) -> None :
Creates a reciprocal unit cell from a spatial one
__init__( (object)self, (Lattice)lattice, (Vec3)reciprocal_sampling [, (float)c=1.0 [, (str)symmetry=’P 1’]]) -> None :
Creates a reciprocal unit cell from a lattice, using the provided reciprocal pixel sampling and an optional thicknes C and symmetry

### Construction¶

SpatialUnitCell()
Creates a default spatial unit cell with A, B and C of length 1.0, and an angle γ of 90 degrees.
SpatialUnitCell(double A, double B, double gamma, double C=1.0)
Creates a spatial unit cell with the given values for A, B and γ, plus an optional thickness C.
SpatialUnitCell(ReciprocalUnitCell c)
Creates a spatial unit cell from a reciprocal one.
SpatialUnitCell(Lattice lat, Vec3 spatial_sampling, double C=1.0)
Creates a spatial unit cell from a lattice object, using the provided spatial pixel sampling.
ReciprocalUnitCell()
Creates a default reciprocal unit cell with A, B and C of length 1.0, and an angle γ of 90 degrees.
ReciprocalUnitCell(double A, double B, double gamma, double C=1.0)
Creates a reciprocal unit cell with the given values for A, B and γ, plus an optional thickness C.
ReciprocalUnitCell(SpatialUnitCell c)
Creates a reciprocal unit cell from a spatial one.
ReciprocalUnitCell(Lattice lat, Vec3 reciprocal_sampling, double C=1.0)
Creates a spatial unit cell from a lattice object, using the provided reciprocal pixel sampling.

### Parameter Getter/Setter¶

double GetA()
Returns either the spatial or reciprocal length of unit cell axis A
double GetB()
Returns either the spatial or reciprocal length of unit cell axis B
double GetGamma()
Returns either the spatial or reciprocal angle γ