Package diffpy :: Package Structure :: Module SymmetryUtilities
[hide private]
[frames] | no frames]

Module SymmetryUtilities

source code

Symmetry utility functions such as expansion of asymmetric unit,
and generation of positional constraints.



Classes [hide private]
  _Position2Tuple
Create callable object that converts fractional coordinates to a tuple of integers with given precision.
  GeneratorSite
Storage of data related to a generator positions.
  ExpandAsymmetricUnit
Expand asymmetric unit and anisotropic thermal displacement...
  SymmetryConstraints
Generate symmetry constraints for specified positions Data members: spacegroup -- instance of SpaceGroup positions -- all positions to be constrained Uijs -- thermal factors for all positions (defaults to zeros) sgoffset -- optional offset of space group origin [0, 0, 0] eps -- cutoff for equivalent positions Calculated data members: corepos -- list of of positions in the asymmetric unit coremap -- dictionary mapping indices of asymmetric core positions to indices of all symmetry related positions poseqns -- list of coordinate formula dictionaries per each site.
Functions [hide private]
 
isSpaceGroupLatPar(spacegroup, a, b, c, alpha, beta, gamma)
Check if space group allows passed lattice parameters.
source code
 
isconstantFormula(s)
Check if formula string is constant.
source code
 
positionDifference(xyz0, xyz1)
Smallest difference between two coordinates in periodic lattice.
source code
 
nearestSiteIndex(sites, xyz)
Index of the nearest site to a specified position.
source code
 
equalPositions(xyz0, xyz1, eps=1e-05)
Equality of two coordinates with optional tolerance.
source code
 
expandPosition(spacegroup, xyz, sgoffset=[0, 0, 0], eps=1e-05)
Obtain unique equivalent positions and corresponding operations.
source code
 
nullSpace(A)
Null space of matrix A.
source code
 
_findInvariants(symops)
Find a list of symmetry operations which contains identity.
source code
 
pruneFormulaDictionary(eqdict)
Remove constant items from formula dictionary.
source code
Variables [hide private]
  __id__ = '$Id: SymmetryUtilities.py 2896 2009-03-16 05:45:06Z ...
  epsilon = 1e-05
  stdUsymbols = ['U11', 'U22', 'U33', 'U12', 'U13', 'U23']
  _rx_constant_formula = re.compile(r'[-\+]?(\d+(\.\d*)?|\.\d+)(...
Function Details [hide private]

isSpaceGroupLatPar(spacegroup, a, b, c, alpha, beta, gamma)

source code 
Check if space group allows passed lattice parameters.

spacegroup -- instance of SpaceGroup
a, b, c, alpha, beta, gamma -- lattice parameters

Return bool.

isconstantFormula(s)

source code 
Check if formula string is constant.  True when argument
is a floating point number or a fraction of float with integer.

s   -- formula string

Return bool.

positionDifference(xyz0, xyz1)

source code 
Smallest difference between two coordinates in periodic lattice.

xyz0, xyz1  -- fractional coordinates

Return dxyz, a numpy.array dxyz with 0 <= dxyz <= 0.5.

nearestSiteIndex(sites, xyz)

source code 
Index of the nearest site to a specified position.

sites -- list of coordinates or a 2-dimensional numpy.array
xyz   -- single position

Return integer.

equalPositions(xyz0, xyz1, eps=1e-05)

source code 
Equality of two coordinates with optional tolerance.

xyz0, xyz1 -- fractional coordinates
eps        -- tolerance for equality of coordinates

Return bool.

expandPosition(spacegroup, xyz, sgoffset=[0, 0, 0], eps=1e-05)

source code 
Obtain unique equivalent positions and corresponding operations.

spacegroup -- instance of SpaceGroup
xyz        -- position to be expanded
sgoffset   -- offset of space group origin [0, 0, 0]
eps        -- cutoff for equal positions

Return a tuple with (list of unique equivalent positions, nested
list of SpaceGroups.SymOp instances, site multiplicity).

_findInvariants(symops)

source code 
Find a list of symmetry operations which contains identity.

symops  -- nested list of SymOp instances

Return the list-item in symops which contains identity.
Raise ValueError when identity was not found.

pruneFormulaDictionary(eqdict)

source code 
Remove constant items from formula dictionary.

eqdict -- formula dictionary which maps standard variable symbols
          ("x", "U11") to string formulas ("0", "-x3", "z7 +0.5")

Return pruned formula dictionary.


Variables Details [hide private]

__id__

Value:
'$Id: SymmetryUtilities.py 2896 2009-03-16 05:45:06Z juhas $'

_rx_constant_formula

Value:
re.compile(r'[-\+]?(\d+(\.\d*)?|\.\d+)([eE][-\+]?\d+)??(/[-\+]?\d+)?$'\
)