Package diffpy :: Package Structure :: Module lattice :: Class Lattice
[hide private]
[frames] | no frames]

Class Lattice

source code

Lattice --> general coordinate system

Data members:

    a, b, c, alpha, beta, gamma -- read-only lattice parameters,
           unit cell angles are in degrees.  The values of lattice
           parameters are set by setLatPar() and setLatBase().
    ar, br, cr, alphar, betar, gammar -- read-only parameters of
           reciprocal lattice, set by setLatPar() and setLatBase().
           All reciprocal angles are in degrees.
    ca, cb, cg, sa, sb, sg -- read-only cosines and sines of direct
           lattice angles, they get set by setLatPar() and setLatBase()
    car, cbr, cgr, sar, sbr, sgr -- read-only cosines and sines of
           reciprocal lattice angles, set by setLatPar() and setLatBase()
    metrics  -- metrics tensor
    base     -- matrix of row base vectors in cartesian coordinates,
                base = stdbase*baserot
    stdbase  -- matrix of base vectors in standard orientation
    baserot  -- base rotation matrix
    recbase  -- inverse of base matrix, its columns are reciprocal
                vectors in cartesian coordinates
    normbase -- base with magnitudes of reciprocal vectors
    recnormbase -- inverse of normbase

Note: All data members are read-only, their values get set by calling
setLatPar() or setLatBase() methods.



Instance Methods [hide private]
 
__init__(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=array([[ 1., 0., 0..., base=None)
define new coordinate system, the default is Cartesian There are 4 ways how to create Lattice instance: Lattice() -- create cartesian coordinates Lattice(a, b, c, alpha, beta, gamma) -- define coordinate system from specified lattice parameters.
source code
 
setLatPar(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=None)
set lattice parameters and all related tensors a, b, c, alpha, beta, gamma -- lattice parameters, unit cell angles are in degrees.
source code
 
setLatBase(self, base)
Set matrix of unit cell base vectors and calculate corresponding lattice parameters and stdbase, baserot and metrics tensors.
source code
 
abcABG(self)
Return a tuple of 6 lattice parameters.
source code
 
reciprocal(self)
Return the reciprocal lattice to self.
source code
 
cartesian(self, u)
return cartesian coordinates of a lattice vector
source code
 
fractional(self, rc)
return fractional coordinates of a cartesian vector
source code
 
dot(self, u, v)
return dot product of 2 lattice vectors
source code
 
norm(self, u)
return norm of a lattice vector
source code
 
dist(self, u, v)
Return distance of 2 points in lattice coordinates.
source code
 
angle(self, u, v)
Return angle(u, v) --> angle of 2 lattice vectors in degrees.
source code
 
__repr__(self)
String representation of this lattice.
source code
Method Details [hide private]

__init__(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=array([[ 1., 0., 0..., base=None)
(Constructor)

source code 
define new coordinate system, the default is Cartesian
There are 4 ways how to create Lattice instance:

Lattice()         -- create cartesian coordinates
Lattice(a, b, c, alpha, beta, gamma) -- define coordinate system
                     from specified lattice parameters.  Unit cell
                     angles are all in degrees.
Lattice(base=abc) -- create coordinate system using the given base,
                     abc is a 3x3 matrix (or nested list), of row
                     base vectors
Lattice(lat)      -- create a copy of existing Lattice lat

setLatPar(self, a=None, b=None, c=None, alpha=None, beta=None, gamma=None, baserot=None)

source code 
set lattice parameters and all related tensors

a, b, c, alpha, beta, gamma -- lattice parameters, unit cell angles
            are in degrees.
baserot  -- unit cell rotation, base = stdbase*baserot

Note: parameters with value None will remain unchanged.

Return self.

setLatBase(self, base)

source code 
Set matrix of unit cell base vectors and calculate corresponding
lattice parameters and stdbase, baserot and metrics tensors.

Return self.