PSCF v1.3
SpaceGroup.h
1#ifndef PRDC_SPACE_GROUP_H
2#define PRDC_SPACE_GROUP_H
3
4/*
5* Simpatico - Simulation Package for Polymeric and Molecular Liquids
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <prdc/crystal/SpaceSymmetry.h>
12#include <prdc/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 {
19namespace Prdc {
20
21 using namespace Util;
22
30 template <int D>
31 class SpaceGroup : public SymmetryGroup< SpaceSymmetry<D> >
32 {
33
34 public:
35
45 bool
47 const;
48
60 void
61 shiftOrigin(typename SpaceSymmetry<D>::Translation const & origin);
62
93 void checkMeshDimensions(IntVec<D> const & dimensions) const;
94
95 // Using declarations for some inherited functions
96 using SymmetryGroup< SpaceSymmetry <D> >::size;
97
98 };
99
100 // Template function definition
101
109 template <int D>
110 std::ostream& operator << (std::ostream& out, SpaceGroup<D> const & g)
111 {
112 int size = g.size();
113 out << "dim " << D << std::endl;
114 out << "size " << size << std::endl;
115 for (int i = 0; i < size; ++i) {
116 out << std::endl;
117 out << g[i];
118 }
119 return out;
120 }
121
130 template <int D>
131 std::istream& operator >> (std::istream& in, SpaceGroup<D>& g)
132 {
133 int dim, size;
134 in >> Label("dim") >> dim;
135 UTIL_CHECK(D == dim);
136 in >> Label("size") >> size;
137
139 g.clear();
140 for (int i = 0; i < size; ++i) {
141 in >> s;
142 g.add(s);
143 }
144 return in;
145 }
146
155 template <int D>
156 void readGroup(std::string groupName, SpaceGroup<D>& group);
157
166 template <int D>
167 void writeGroup(std::string filename, SpaceGroup<D> const & group);
168
169 #ifndef PRDC_SPACE_GROUP_TPP
170 extern template class SpaceGroup<1>;
171 extern template class SpaceGroup<2>;
172 extern template class SpaceGroup<3>;
173 extern template void readGroup(std::string, SpaceGroup<1>& );
174 extern template void readGroup(std::string, SpaceGroup<2>& );
175 extern template void readGroup(std::string, SpaceGroup<3>& );
176 extern template void writeGroup(std::string, SpaceGroup<1> const &);
177 extern template void writeGroup(std::string, SpaceGroup<2> const &);
178 extern template void writeGroup(std::string, SpaceGroup<3> const &);
179 #endif
180
181}
182}
183#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:32
bool hasInversionCenter(typename SpaceSymmetry< D >::Translation &center) 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.
A SpaceSymmetry represents a crystallographic space group symmetry.
FArray< Rational, D > Translation
Typedef for vector used to represent fractional translation.
bool add(Symmetry &symmetry)
Add a new element to the group.
void clear()
Remove all elements except the identity.
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
Periodic fields and crystallography.
Definition CField.cpp:11
PSCF package top-level namespace.
Definition param_pc.dox: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