Simpatico  v1.10
tools/chemistry/Group.h
1 #ifndef TOOLS_GROUP_H
2 #define TOOLS_GROUP_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 namespace Tools
12 {
13 
19  template <int N>
20  class Group
21  {
22  public:
23 
27  int atomIds[N];
28 
32  int typeId;
33 
37  int id;
38 
39  };
40 
41 
42  // Associated function declarations
43 
51  template <int N>
52  std::istream& operator>>(std::istream& in, Group<N> &group)
53  {
54  in >> group.id;
55  in >> group.typeId;
56  for (int i=0; i < N; ++i) {
57  in >> group.atomIds[i];
58  }
59  return in;
60  }
61 
71  template <int N>
72  std::ostream& operator << (std::ostream& out, const Group<N> &group)
73  {
74  out.width(10);
75  out << group.id;
76  out.width(10);
77  out << group.typeId;
78  for (int i = 0; i < N; ++i) {
79  out.width(10);
80  out << group.atomIds[i];
81  }
82  return out;
83  }
84 
85 }
86 #endif
int typeId
Integer index for the type of group.
std::istream & operator>>(std::istream &in, Group< N > &group)
istream extractor (>>) for a Group.
int atomIds[N]
Array of integer ids of atoms in this group.
Single-processor classes for pre- and post-processing MD trajectories.
A group of covalently interacting atoms.
int id
Global id for this group.