1#ifndef PSCF_SPACE_GROUP_TPP
2#define PSCF_SPACE_GROUP_TPP
11#include <pscf/crystal/SpaceGroup.h>
12#include <pscf/crystal/groupFile.h>
28 bool isInversion =
false;
30 for (i = 0; i < size(); ++i) {
32 for (j = 0; j < D; ++j) {
33 for (k = 0; k < D; ++k) {
35 if ((*
this)[i].R(j,k) != -1) isInversion =
false;
37 if ((*
this)[i].R(j,k) != 0) isInversion =
false;
42 for (
int j = 0; j < D; ++j) {
43 center[j] = (*this)[i].t(j)/2;
55 for (
int i = 0; i < size(); ++i) {
56 (*this)[i].shiftOrigin(origin);
73 int numerator, denominator;
75 for (
int i = 0; i < D; ++i) {
78 for (
int j = 0; j < size(); ++j) {
79 numerator = (*this)[j].t(i).num();
80 denominator = (*this)[j].t(i).den();
83 if (denominator > divisors[i]) {
84 divisors[i] = denominator;
89 for (
int j = 0; j < size(); ++j) {
90 numerator = (*this)[j].t(i).num();
91 denominator = (*this)[j].t(i).den();
93 if (denominator < divisors[i]) {
94 if (divisors[i]%denominator != 0) {
95 divisors[i] = divisors[i]*denominator;
103 for (
int i = 1; i < D; ++i) {
104 if (dimensions[i]%divisors[i] != 0) {
107 <<
"Mesh dimensions incompatible with the space group:\n"
108 <<
" dimensions[" << i <<
"] = " << dimensions[i] <<
"\n"
109 <<
" This dimension must be a multiple of " << divisors[i]
111 UTIL_THROW(
"Error: Mesh not incompatible with space group");
121 for (
int i = 0; i < D; ++i) {
122 for (
int j = 0; j < D; ++j) {
123 areRelated(i, j) =
false;
125 areRelated(i, i) =
true;
127 for (
int k = 0; k < size(); ++k) {
128 for (
int i = 0; i < D; ++i) {
129 for (
int j = 0; j < D; ++j) {
131 if ( (*
this)[k].R(i,j) != 0) {
132 areRelated(i, j) =
true;
133 areRelated(j, i) =
true;
141 for (
int i = 0; i < D; ++i) {
142 for (
int j = 0; j < i; ++j) {
143 if (areRelated(i,j) && (dimensions[i] != dimensions[j])) {
146 <<
"Mesh dimensions incompatible with the space group - \n"
147 <<
"Unequal dimensions for related directions:\n"
148 <<
" dimensions[" << i <<
"] = " << dimensions[i] <<
"\n"
149 <<
" dimensions[" << j <<
"] = " << dimensions[j]
151 UTIL_THROW(
"Error: Mesh not incompatible with space group");
164 if (groupName ==
"I") {
168 bool foundFile =
false;
188 Log::file() <<
"\nFailed to open group file: "
190 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.
void makeCompleteGroup()
Generate a complete group from the current elements.
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.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.