PSCF v1.1
SpaceGroup.h
1#ifndef PSCF_SPACE_GROUP_H
2#define PSCF_SPACE_GROUP_H
3
4/*
5* Simpatico - Simulation Package for Polymeric and Molecular Liquids
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/crystal/SpaceSymmetry.h>
12#include <pscf/crystal/SymmetryGroup.h>
13#include <pscf/math/IntVec.h>
14#include <util/containers/FSArray.h>
15#include <util/param/Label.h>
16#include <iostream>
17
18namespace Pscf
19{
20
21 using namespace Util;
22
28 template <int D>
29 class SpaceGroup : public SymmetryGroup< SpaceSymmetry<D> >
30 {
31
32 public:
33
43 bool
45 const;
46
58 void
59 shiftOrigin(typename SpaceSymmetry<D>::Translation const & origin);
60
91 void checkMeshDimensions(IntVec<D> const & dimensions) const;
92
93 // Using declarations for some inherited functions
94 using SymmetryGroup< SpaceSymmetry <D> >::size;
95
96 };
97
98 // Template function definition
99
107 template <int D>
108 std::ostream& operator << (std::ostream& out, SpaceGroup<D> const & g)
109 {
110 int size = g.size();
111 out << "dim " << D << std::endl;
112 out << "size " << size << std::endl;
113 for (int i = 0; i < size; ++i) {
114 out << std::endl;
115 out << g[i];
116 }
117 return out;
118 }
119
128 template <int D>
129 std::istream& operator >> (std::istream& in, SpaceGroup<D>& g)
130 {
131 int dim, size;
132 in >> Label("dim") >> dim;
133 UTIL_CHECK(D == dim);
134 in >> Label("size") >> size;
135
137 g.clear();
138 for (int i = 0; i < size; ++i) {
139 in >> s;
140 g.add(s);
141 }
142 return in;
143 }
144
153 template <int D>
154 void readGroup(std::string groupName, SpaceGroup<D>& group);
155
164 template <int D>
165 void writeGroup(std::string filename, SpaceGroup<D> const & group);
166
167 #ifndef PSCF_SPACE_GROUP_TPP
168 extern template class SpaceGroup<1>;
169 extern template class SpaceGroup<2>;
170 extern template class SpaceGroup<3>;
171 extern template void readGroup(std::string, SpaceGroup<1>& );
172 extern template void readGroup(std::string, SpaceGroup<2>& );
173 extern template void readGroup(std::string, SpaceGroup<3>& );
174 extern template void writeGroup(std::string, SpaceGroup<1> const &);
175 extern template void writeGroup(std::string, SpaceGroup<2> const &);
176 extern template void writeGroup(std::string, SpaceGroup<3> const &);
177 #endif
178
179}
180#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition: IntVec.h:27
Crystallographic space group.
Definition: SpaceGroup.h:30
bool hasInversionCenter(typename SpaceSymmetry< D >::Translation &center) const
Determines if this space group has an inversion center.
Definition: SpaceGroup.tpp:24
void checkMeshDimensions(IntVec< D > const &dimensions) const
Check if input mesh dimensions are compatible with space group.
Definition: SpaceGroup.tpp:64
void shiftOrigin(typename SpaceSymmetry< D >::Translation const &origin)
Shift the origin of space used in the coordinate system.
Definition: SpaceGroup.tpp:52
A SpaceSymmetry represents a crystallographic space group symmetry.
Class template for a group of elements.
Definition: SymmetryGroup.h:37
void clear()
Remove all elements except the identity.
int size() const
Return number of elements in group (i.e., the order of the group).
bool add(Symmetry &symmetry)
Add a new element to the group.
A label string in a file format.
Definition: Label.h:73
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition: global.h:68
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition: Pair.h:44
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition: Pair.h:57