1#ifndef PSCF_SPACE_GROUP_TPP
2#define PSCF_SPACE_GROUP_TPP
11#include <pscf/crystal/SpaceGroup.h>
12#include <pscf/crystal/groupFile.h>
27 bool isInversion =
false;
29 for (i = 0; i <
size(); ++i) {
31 for (j = 0; j < D; ++j) {
32 for (k = 0; k < D; ++k) {
34 if ((*
this)[i].R(j,k) != -1) isInversion =
false;
36 if ((*
this)[i].R(j,k) != 0) isInversion =
false;
41 for (
int j = 0; j < D; ++j) {
42 center[j] = (*this)[i].t(j)/2;
54 for (
int i = 0; i <
size(); ++i) {
55 (*this)[i].shiftOrigin(origin);
72 int numerator, denominator;
74 for (
int i = 0; i < D; ++i) {
77 for (
int j = 0; j <
size(); ++j) {
78 numerator = (*this)[j].t(i).num();
79 denominator = (*this)[j].t(i).den();
82 if (denominator > divisors[i]) {
83 divisors[i] = denominator;
88 for (
int j = 0; j <
size(); ++j) {
89 numerator = (*this)[j].t(i).num();
90 denominator = (*this)[j].t(i).den();
92 if (denominator < divisors[i]) {
93 if (divisors[i]%denominator != 0) {
94 divisors[i] = divisors[i]*denominator;
102 for (
int i = 0; i < D; ++i) {
103 if (dimensions[i]%divisors[i] != 0) {
106 <<
"Mesh dimensions incompatible with the space group:\n"
107 <<
" dimensions[" << i <<
"] = " << dimensions[i] <<
"\n"
108 <<
" This dimension must be a multiple of " << divisors[i]
110 UTIL_THROW(
"Error: Mesh not incompatible with space group");
120 for (
int i = 0; i < D; ++i) {
121 for (
int j = 0; j < D; ++j) {
122 areRelated(i, j) =
false;
124 areRelated(i, i) =
true;
126 for (
int k = 0; k <
size(); ++k) {
127 for (
int i = 0; i < D; ++i) {
128 for (
int j = 0; j < D; ++j) {
130 if ( (*
this)[k].R(i,j) != 0) {
131 areRelated(i, j) =
true;
132 areRelated(j, i) =
true;
140 for (
int i = 0; i < D; ++i) {
141 for (
int j = 0; j < i; ++j) {
142 if (areRelated(i,j) && (dimensions[i] != dimensions[j])) {
145 <<
"Mesh dimensions incompatible with the space group - \n"
146 <<
"Unequal dimensions for related directions:\n"
147 <<
" dimensions[" << i <<
"] = " << dimensions[i] <<
"\n"
148 <<
" dimensions[" << j <<
"] = " << dimensions[j]
150 UTIL_THROW(
"Error: Mesh not incompatible with space group");
163 if (groupName ==
"I") {
167 bool foundFile =
false;
187 Log::file() <<
"\nFailed to open group file: "
189 Log::file() <<
"\n Error: Unknown space group\n";
An IntVec<D, T> is a D-component vector of elements of integer type T.
Crystallographic space group.
bool hasInversionCenter(typename SpaceSymmetry< D >::Translation ¢er) const
Determines if this space group has an inversion center.
void checkMeshDimensions(IntVec< D > const &dimensions) const
Check if input mesh dimensions are compatible with space group.
void shiftOrigin(typename SpaceSymmetry< D >::Translation const &origin)
Shift the origin of space used in the coordinate system.
FArray< Rational, D > Translation
Typedef for vector used to represent fractional translation.
void clear()
Remove all elements except the identity.
static std::ostream & file()
Get log ostream by reference.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
std::string makeGroupFileName(int D, std::string groupName)
Generates the file name from a group name.
PSCF package top-level namespace.