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>
24 template <
int D>
class SpaceSymmetry;
37 bool operator == (
const SpaceSymmetry<D>& A,
const SpaceSymmetry<D>& B);
48 bool operator != (
const SpaceSymmetry<D>& A,
const SpaceSymmetry<D>& B);
60 operator * (
const SpaceSymmetry<D>& A,
const SpaceSymmetry<D>& B);
74 IntVec<D>
operator * (
const SpaceSymmetry<D>& S,
const IntVec<D>& V);
88 IntVec<D>
operator * (
const IntVec<D>& V,
const SpaceSymmetry<D>& S);
99 std::ostream&
operator << (std::ostream& out,
const SpaceSymmetry<D>& A);
110 std::istream&
operator >> (std::istream& in, SpaceSymmetry<D>& A);
205 int&
R(
int i,
int j);
213 int R(
int i,
int j)
const;
258 static bool hasIdentity_;
261 static void makeIdentity();
286 std::ostream& operator << <> (std::ostream& out,
320 {
return !(A == B); }
361 if (!hasIdentity_) makeIdentity();
374 for (i = 0; i < D; ++i) {
375 if (A.t_[i] != B.t_[i]) {
378 for (j = 0; j < D; ++j) {
379 if (A.R_(i, j) != B.R_(i,j)) {
398 for (i = 0; i < D; ++i) {
399 for (j = 0; j < D; ++j) {
401 for (k = 0; k < D; ++k) {
402 C.R_(i, j) += A.R_(i, k)*B.R_(k, j);
408 for (i = 0; i < D; ++i) {
411 for (i = 0; i < D; ++i) {
412 for (j = 0; j < D; ++j) {
413 C.t_[i] += A.R_(i, j)*B.t_[j];
429 for (i = 0; i < D; ++i) {
431 for (j = 0; j < D; ++j) {
432 U[i] += S.R_(i,j)*V[j];
446 for (i = 0; i < D; ++i) {
448 for (j = 0; j < D; ++j) {
449 U[i] += V[j]*S.R_(j,i);
462 for (i = 0; i < D; ++i) {
463 for (j = 0; j < D; ++j) {
464 out <<
" " <<
Int(A.R_(i,j),2);
468 for (i = 0; i < D; ++i) {
469 out <<
" " << A.t_[i];
482 for (i = 0; i < D; ++i) {
483 for (j = 0; j < D; ++j) {
487 for (i = 0; i < D; ++i) {
501 #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.
friend bool operator==(const SpaceSymmetry< D > &A, const SpaceSymmetry< D > &B)
Are two SpaceSymmetry objects equivalent?
FMatrix< int, D, D > Rotation
Typedef for matrix used to represent point group operation.
FArray< Rational, D > Translation
Typedef for vector used to represent fractional translation.
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.
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).
PSCF package top-level namespace.
Utility classes for scientific computation.
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.