Simpatico  v1.10
CfbRebridgeBase.h
1 #ifndef MCMD_CFB_REBRIDGE_BASE_H
2 #define MCMD_CFB_REBRIDGE_BASE_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 "CfbEndBase.h" // base class
12 #include <util/space/Vector.h> // math utility class
13 
14 namespace McMd
15 {
16 
17  using namespace Util;
18 
19  class McSystem;
20  class Atom;
21 
31  class CfbRebridgeBase : public CfbEndBase
32  {
33 
34  public:
35 
39  CfbRebridgeBase(McSystem& system);
40 
44  virtual ~CfbRebridgeBase();
45 
50  virtual void readParameters(std::istream& in);
51 
57  virtual void loadParameters(Serializable::IArchive &ar);
58 
64  virtual void save(Serializable::OArchive &ar);
65 
70  virtual void setup();
71 
72  protected:
73 
75  double length21_;
76 
78  double length10_;
79 
81  double kappa10_;
82 
87  void deleteMiddleAtom(Atom* partPtr, Atom* prevPtr, Atom* nextPtr,
88  int prevBType, int nextBType, double &rosenbluth, double &energy);
89 
94  void addMiddleAtom(Atom* partPtr, Atom* prevPtr, Atom* nextPtr,
95  int prevBType, int nextBType, double &rosenbluth, double &energy);
96 
100  void deleteSequence(int nActive, int sign, Atom* endPtr, int *bonds,
101  double &rosenbluth, double &energy);
102 
106  void addSequence(int nActive, int sign, Atom* beginPtr, int *bonds,
107  double &rosenbluth, double &energy);
108 
109  private:
110 
117  static const int MaxBin_ = 102;
119 
121  double l20Table[MaxBin_];
122 
124  double angTable[MaxBin_];
125 
127  double kappaTable[MaxBin_];
128 
130  double normalTable[MaxBin_];
131 
136  inline void getAngKappaNorm(double l_20, double &preAng,
137  double &kappa, double &normConst);
138 
143  inline void orientationBias(Vector u_21, Vector u_20,
144  double prefAng, double kappaAng, double &bias);
145 
151  void orientationBiasTable
152  (double l_20, double &prefAng, double &kappaAng, double &normConst);
153 
158  void computeNormalization
159  (double prefAng, double kappaAng, double &normConst);
160 
161  };
162 
163  /*
164  * Inline method: get the preferential angle and effective spring constant for
165  * given l_20
166  */
167  void CfbRebridgeBase::getAngKappaNorm(double l_20, double &prefAng,
168  double &kappa, double &normConst)
169  {
170  if (l_20 <= l20Table[0]) {
171  prefAng = angTable[0];
172  kappa = kappaTable[0];
173  normConst = normalTable[0];
174  } else if (l_20 >= l20Table[MaxBin_-1]) {
175  prefAng = angTable[MaxBin_-1];
176  kappa = kappaTable[MaxBin_-1];
177  normConst = normalTable[MaxBin_-1];
178  } else {
179  int i;
180  i = int ( (l_20 - l20Table[0]) / (l20Table[2] - l20Table[1]) );
181  prefAng = angTable[i+1];
182  kappa = kappaTable[i+1];
183  normConst = normalTable[i+1];
184  }
185  }
186 
187  /*
188  * Inline method: compute the actual angle and the Boltzmann weight.
189  */
190  void CfbRebridgeBase::orientationBias(
191  Vector u_21, Vector u_20, double prefAng, double kappaAng, double &bias)
192  {
193  double actualAng;
194 
195  actualAng = acos(u_21.dot(u_20));
196  bias = boltzmann(0.5*kappaAng*(actualAng - prefAng)*(actualAng - prefAng));
197  }
198 
199 }
200 #endif
A System for use in a Markov chain Monte Carlo simulation.
Definition: McSystem.h:52
A Vector is a Cartesian vector.
Definition: Vector.h:75
double dot(const Vector &v) const
Return dot product of this vector and vector v.
Definition: Vector.h:632
Base class configuration bias moves internal segment regrowth moves.
double kappa10_
Spring constant (1-0 bond).
Saving / output archive for binary ostream.
A point particle within a Molecule.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
double length10_
Equilibrium bond lengths (1-0 bonds).
Base class for configuration bias (CFB) end regrowth moves.
Definition: CfbEndBase.h:31
double length21_
Equilibrium bond lengths (2-1 bond).