1#ifndef PRDC_SPACE_SYMMETRY_H
2#define PRDC_SPACE_SYMMETRY_H
11#include <pscf/math/IntVec.h>
12#include <util/math/Rational.h>
13#include <util/containers/FMatrix.h>
14#include <util/containers/FArray.h>
15#include <util/format/Int.h>
206 int&
R(
int i,
int j);
214 int R(
int i,
int j)
const;
259 static bool hasIdentity_;
262 static void makeIdentity();
287 std::ostream& operator << <> (std::ostream& out,
321 {
return !(A == B); }
362 if (!hasIdentity_) makeIdentity();
375 for (i = 0; i < D; ++i) {
376 if (A.t_[i] != B.t_[i]) {
379 for (j = 0; j < D; ++j) {
380 if (A.R_(i, j) != B.R_(i,j)) {
399 for (i = 0; i < D; ++i) {
400 for (j = 0; j < D; ++j) {
402 for (k = 0; k < D; ++k) {
403 C.R_(i, j) += A.R_(i, k)*B.R_(k, j);
409 for (i = 0; i < D; ++i) {
412 for (i = 0; i < D; ++i) {
413 for (j = 0; j < D; ++j) {
414 C.t_[i] += A.R_(i, j)*B.t_[j];
430 for (i = 0; i < D; ++i) {
432 for (j = 0; j < D; ++j) {
433 U[i] += S.R_(i,j)*V[j];
447 for (i = 0; i < D; ++i) {
449 for (j = 0; j < D; ++j) {
450 U[i] += V[j]*S.R_(j,i);
463 for (i = 0; i < D; ++i) {
464 for (j = 0; j < D; ++j) {
465 out <<
" " <<
Int(A.R_(i,j),2);
469 for (i = 0; i < D; ++i) {
470 out <<
" " << A.t_[i];
483 for (i = 0; i < D; ++i) {
484 for (j = 0; j < D; ++j) {
488 for (i = 0; i < D; ++i) {
499 bool SpaceSymmetry<D>::hasIdentity_ =
false;
502 #ifndef PRDC_SPACE_SYMMETRY_TPP
An IntVec<D, T> is a D-component vector of elements of integer type T.
A SpaceSymmetry represents a crystallographic space group symmetry.
friend std::istream & operator>>(std::istream &in, SpaceSymmetry< D > &A)
Input stream extractor for a SpaceSymmetry<D>
SpaceSymmetry< D > inverse() const
Compute and return the inverse of this symmetry element.
friend bool operator!=(const SpaceSymmetry< D > &A, const SpaceSymmetry< D > &B)
Are two SpaceSymmetry objects not equivalent?
static const SpaceSymmetry< D > & identity()
Return the identity element.
int determinant() const
Compute and return the determinant of the rotation matrix.
FArray< Rational, D > Translation
Typedef for vector used to represent fractional translation.
friend bool operator==(const SpaceSymmetry< D > &A, const SpaceSymmetry< D > &B)
Are two SpaceSymmetry objects equivalent?
SpaceSymmetry< D >::Rotation inverseRotation() const
Compute and return the inverse of the rotation matrix.
friend SpaceSymmetry< D > operator*(const SpaceSymmetry< D > &A, const SpaceSymmetry< D > &B)
Return the product A*B of two symmetry objects.
SpaceSymmetry< D > & operator=(const SpaceSymmetry< D > &other)
Assignment operator.
Rational & t(int i)
Return a component of the translation by reference.
void normalize()
Shift components of translation to [0,1).
int & R(int i, int j)
Return an element of the matrix by reference.
FMatrix< int, D, D > Rotation
Typedef for matrix used to represent point group operation.
void shiftOrigin(Translation const &origin)
Shift the origin of space used in the coordinate system.
SpaceSymmetry()
Default constructor.
A fixed size (static) contiguous array template.
Wrapper for an int, for formatted ostream output.
A Rational number (a ratio of integers).
Periodic fields and crystallography.
PSCF package top-level namespace.
Rational operator*(Rational const &a, Rational const &b)
Compute product of rationals.
bool operator==(Polynomial< T > const &a, Polynomial< T > const &b)
Equality operator for polynomials.
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
bool operator!=(Polynomial< T > const &a, Polynomial< T > const &b)
Inequality operator for polynomials.