Simpatico  v1.10
BoundaryEnsemble.h
1 #ifndef UTIL_BOUNDARY_ENSEMBLE_H
2 #define UTIL_BOUNDARY_ENSEMBLE_H
3 
4 /*
5 * Util Package - C++ Utilities for Scientific Computation
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 <util/param/ParamComposite.h>
12 #include <util/archives/serialize.h>
13 #include <util/global.h>
14 
15 namespace Simp
16 {
17 
18  using namespace Util;
19 
29  {
30 
31  public:
32 
36  enum Type{UNKNOWN, RIGID, ISOBARIC};
37 
41  BoundaryEnsemble(Type type = UNKNOWN);
42 
47 
51  void setPressure(double pressure);
52 
59  virtual void readParameters(std::istream& in);
60 
66  virtual void loadParameters(Serializable::IArchive &ar);
67 
73  virtual void save(Serializable::OArchive &ar);
74 
76 
77 
81  bool isRigid() const;
82 
86  bool isIsobaric() const;
87 
91  double pressure() const;
92 
94 
95  #ifdef UTIL_MPI
96 
99  static void commitMpiType();
100  #endif
101 
102  private:
103 
107  double pressure_;
108 
112  Type type_;
113 
114  };
115 
123  std::istream& operator>>(std::istream& in, BoundaryEnsemble::Type &type);
124 
132  std::ostream& operator<<(std::ostream& out, const BoundaryEnsemble::Type &type);
133 
134  // Inline methods
135 
136  /*
137  * Get the target pressure.
138  */
139  inline double BoundaryEnsemble::pressure() const
140  { return pressure_; }
141 
142  /*
143  * Return true iff this is an rigid ensemble.
144  */
145  inline bool BoundaryEnsemble::isRigid() const
146  { return (type_ == RIGID); }
147 
148  /*
149  * Return true if this is an isobaric Ensemble.
150  */
151  inline bool BoundaryEnsemble::isIsobaric() const
152  { return (type_ == ISOBARIC); }
153 
161  template <class Archive>
162  inline void serialize(Archive& ar, BoundaryEnsemble::Type& data, const unsigned int version)
163  { serializeEnum(ar, data, version); }
164 
165 }
166 
167 #ifdef UTIL_MPI
168 #include <util/mpi/MpiTraits.h>
169 namespace Util
170 {
171 
175  template <>
177  {
178  public:
179  static MPI::Datatype type;
180  static bool hasType;
181  };
182 
186  template <>
188  {
189  public:
190  static MPI::Datatype type;
191  static bool hasType;
192  };
193 
194 }
195 #endif
196 
197 #endif
bool isIsobaric() const
Is this an Isobaric ensemble?
virtual void save(Serializable::OArchive &ar)
Save internal state to an archive.
double pressure() const
Get the target pressure.
Statistical ensemble for changes in the periodic unit cell size.
void serialize(Archive &ar, const unsigned int version)
Serialize this ParamComponent as a string.
virtual void loadParameters(Serializable::IArchive &ar)
Load internal state from an archive.
BoundaryEnsemble(Type type=UNKNOWN)
Constructor.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
std::istream & operator>>(std::istream &in, MonoclinicBoundary &boundary)
istream extractor for a MonoclinicBoundary.
Saving / output archive for binary ostream.
Type
Enumeration of the allowed types of BoundaryEnsemble.
static bool hasType
Is the MPI type initialized?
Utility classes for scientific computation.
Definition: accumulators.mod:1
Default MpiTraits class.
Definition: MpiTraits.h:39
std::ostream & operator<<(std::ostream &out, const MonoclinicBoundary &boundary)
ostream inserter for an MonoclinicBoundary.
void serializeEnum(Archive &ar, T &data, const unsigned int version=0)
Serialize an enumeration value.
Definition: serialize.h:42
virtual void readParameters(std::istream &in)
Read the type and (if necessary) pressure from file.
~BoundaryEnsemble()
Destructor.
Saving archive for binary istream.
static bool hasType
Is the MPI type initialized?
void setPressure(double pressure)
Set the pressure.
static MPI::Datatype type
MPI Datatype.
An object that can read multiple parameters from file.
bool isRigid() const
Is this an Rigid ensemble?
static MPI::Datatype type
MPI Datatype.
static void commitMpiType()
Commit associated MPI DataType.