Simpatico  v1.10
PointGroup.h
1 #ifndef UTIL_POINT_GROUP_H
2 #define UTIL_POINT_GROUP_H
3 
4 #include <util/crystal/PointSymmetry.h>
5 #include <util/crystal/SymmetryGroup.h>
6 #include <util/containers/FSArray.h>
7 #include <util/space/IntVector.h>
8 
9 #include <iostream>
10 
11 namespace Util {
12 
18  class PointGroup : public SymmetryGroup<PointSymmetry>
19  {
20 
21  public:
22 
29  template <int N>
30  void makeStar(const IntVector& root, FSArray<IntVector, N>& star);
31 
32  // friends:
33 
34  friend
35  std::ostream& operator << (std::ostream& out, const PointGroup& A);
36 
37  };
38 
42  std::ostream& operator << (std::ostream& out, const PointGroup& A);
43 
44  // Template function definition
45 
46  template <int N>
48  {
49  // Precondition
50  if (star.capacity() < size()) {
51  UTIL_THROW("Star array capacity is less than order of group");
52  }
53 
54  IntVector vector;
55  int i, j;
56  bool found;
57  star.clear();
58  for (i = 0; i < size(); ++i) {
59  vector = root*(*this)[i];
60  found = false;
61  for (j = 0; j < star.size(); ++j) {
62  if (vector == star[j]) {
63  found = true;
64  break;
65  }
66  }
67  if (!found) {
68  star.append(vector);
69  }
70  }
71 
72  }
73 
74 }
75 #endif
Class template for a group of elements of type Symmetry.
Definition: SymmetryGroup.h:29
friend std::ostream & operator<<(std::ostream &out, const PointGroup &A)
Output stream inserter operator writing a PointGroup to stream.
Definition: PointGroup.cpp:8
void clear()
Set logical size to zero.
Definition: FSArray.h:271
void append(const Data &data)
Append data to the end of the array.
Definition: FSArray.h:258
int capacity() const
Return physical capacity of array.
Definition: FSArray.h:200
A fixed capacity (static) contiguous array with a variable logical size.
Definition: FSArray.h:37
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition: global.h:51
Utility classes for scientific computation.
Definition: accumulators.mod:1
void makeStar(const IntVector &root, FSArray< IntVector, N > &star)
Generate a set of reciprocal vectors that are related by symmetry.
Definition: PointGroup.h:47
Group of crystal symmetries with no translations.
Definition: PointGroup.h:18
An IntVector is an integer Cartesian vector.
Definition: IntVector.h:73
int size() const
Return logical size of this array (i.e., number of elements).
Definition: FSArray.h:207
int size() const
Return number of elements in group.