1#ifndef PSCF_SPACE_SYMMETRY_H
2#define PSCF_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>
23 template <
int D>
class SpaceSymmetry;
36 bool operator == (
const SpaceSymmetry<D>& A,
const SpaceSymmetry<D>& B);
47 bool operator != (
const SpaceSymmetry<D>& A,
const SpaceSymmetry<D>& B);
59 operator * (
const SpaceSymmetry<D>& A,
const SpaceSymmetry<D>& B);
73 IntVec<D>
operator * (
const SpaceSymmetry<D>& S,
const IntVec<D>& V);
87 IntVec<D>
operator * (
const IntVec<D>& V,
const SpaceSymmetry<D>& S);
98 std::ostream&
operator << (std::ostream& out,
const SpaceSymmetry<D>& A);
109 std::istream&
operator >> (std::istream& in, SpaceSymmetry<D>& A);
204 int&
R(
int i,
int j);
212 int R(
int i,
int j)
const;
257 static bool hasIdentity_;
260 static void makeIdentity();
285 std::ostream& operator << <> (std::ostream& out,
289 std::istream& operator >> <> (std::istream& in,
319 {
return !(A == B); }
360 if (!hasIdentity_) makeIdentity();
373 for (i = 0; i < D; ++i) {
374 if (A.t_[i] != B.t_[i]) {
377 for (j = 0; j < D; ++j) {
378 if (A.R_(i, j) != B.R_(i,j)) {
397 for (i = 0; i < D; ++i) {
398 for (j = 0; j < D; ++j) {
400 for (k = 0; k < D; ++k) {
401 C.R_(i, j) += A.R_(i, k)*B.R_(k, j);
407 for (i = 0; i < D; ++i) {
410 for (i = 0; i < D; ++i) {
411 for (j = 0; j < D; ++j) {
412 C.t_[i] += A.R_(i, j)*B.t_[j];
428 for (i = 0; i < D; ++i) {
430 for (j = 0; j < D; ++j) {
431 U[i] += S.R_(i,j)*V[j];
445 for (i = 0; i < D; ++i) {
447 for (j = 0; j < D; ++j) {
448 U[i] += V[j]*S.R_(j,i);
461 for (i = 0; i < D; ++i) {
462 for (j = 0; j < D; ++j) {
463 out <<
" " <<
Int(A.R_(i,j),2);
467 for (i = 0; i < D; ++i) {
468 out <<
" " << A.t_[i];
481 for (i = 0; i < D; ++i) {
482 for (j = 0; j < D; ++j) {
486 for (i = 0; i < D; ++i) {
500 #ifndef PSCF_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.
int determinant() const
Compute and return the determinant of the rotation matrix.
void normalize()
Shift components of translation to [0,1).
SpaceSymmetry< D >::Rotation inverseRotation() const
Compute and return the inverse of the rotation matrix.
SpaceSymmetry< D > inverse() const
Compute and return the inverse of this symmetry element.
SpaceSymmetry< D > & operator=(const SpaceSymmetry< D > &other)
Assignment operator.
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.
Rational & t(int i)
Return a component of the translation by reference.
FArray< Rational, D > Translation
Typedef for vector used to represent fractional translation.
static const SpaceSymmetry< D > & identity()
Return the identity element.
SpaceSymmetry()
Default constructor.
int & R(int i, int j)
Return an element of the matrix by reference.
A fixed size (static) contiguous array template.
Wrapper for an int, for formatted ostream output.
A Rational number (a ratio of integers).
C++ namespace for polymer self-consistent field theory (PSCF).
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.