Simpatico  v1.10
DdMdOrderedConfigIo.h
1 #ifndef DDMD_DDMD_ORDERED_CONFIG_IO_H
2 #define DDMD_DDMD_ORDERED_CONFIG_IO_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 #include <ddMd/configIos/ConfigIo.h>
12 #include <util/space/Vector.h>
13 
14 #include <vector>
15 
16 namespace DdMd
17 {
18 
19  class Simulation;
20 
21  using namespace Util;
22 
33  {
34 
35  public:
36 
42  DdMdOrderedConfigIo(bool hasMolecules);
43 
50  DdMdOrderedConfigIo(Simulation& simulation, bool hasMolecules);
51 
67  virtual void readConfig(std::ifstream& file, MaskPolicy maskPolicy);
68 
78  virtual void writeConfig(std::ofstream& file);
79 
80  private:
81 
82  /*
83  * Struct for atom data required in file format.
84  */
85  struct IoAtom {
86 
87  Vector position;
88  Vector velocity;
89  int typeId;
90  int id;
91  AtomContext context;
92 
93  IoAtom()
94  : position(0.0),
95  velocity(0.0),
96  typeId(-1),
97  id(-1)
98  {}
99 
100  };
101 
102  /*
103  * Struct containing a Group<N> and a group id.
104  */
105  template <int N>
106  struct IoGroup {
107  int id;
108  Group<N> group;
109  };
110 
114  std::vector<IoAtom> atoms_;
115 
119  bool hasMolecules_;
120 
126  template <int N>
127  void readGroups(std::ifstream& file,
128  const char* sectionLabel, const char* nGroupLabel,
129  GroupDistributor<N>& distributor);
130 
136  template <int N>
137  int writeGroups(std::ofstream& file,
138  const char* sectionLabel, const char* nGroupLabel,
139  GroupStorage<N>& storage, GroupCollector<N>& collector);
140 
141  };
142 
143 }
144 #endif
A Vector is a Cartesian vector.
Definition: Vector.h:75
Parallel domain decomposition (DD) MD simulation.
Main object for a domain-decomposition MD simulation.
Native / default format for configuration files.
Descriptor for context of an Atom within a molecule and species.
Definition: AtomContext.h:21
Class for collecting Groups from processors to master processor.
Utility classes for scientific computation.
Definition: accumulators.mod:1
MaskPolicy
Enumeration of policies for suppressing ("masking") some pair interactions.
A container for all the Group<N> objects on this processor.
Abstract reader/writer for configuration files.
A group of covalently interacting atoms.
Class template for distributing Group<N> objects among processors.