faunus
chainmove.h
1 #pragma once
2 
3 #include "move.h"
4 #include "bonds.h"
5 
6 namespace Faunus {
7 namespace move {
12 {
13  protected:
14  using Move::spc;
15  std::string molname;
16  size_t molid;
17  double dprot;
18  double sqdispl;
20  bool permit_move = true;
21  bool allow_small_box = false;
23  private:
24  virtual size_t
25  select_segment() = 0;
26  virtual void rotate_segment(double angle) = 0;
27  virtual void store_change(Change& change) = 0;
28  void _move(Change& change) override;
29  void _accept(Change& change) override;
30  void _reject(Change& change) override;
31 
32  protected:
33  ChainRotationMoveBase(Space& spc, const std::string& name, const std::string& cite);
34  void _from_json(const json& j) override;
35  void _to_json(json& j) const override;
36 
37  public:
38  double bias(Change&, double uold, double unew) override;
39 };
40 
46 {
48 
49  protected:
50  using TBase::spc;
51  typename Space::GroupVector::iterator molecule_iter;
54  std::array<size_t, 2> axis_ndx;
56  std::vector<size_t> segment_ndx;
57 
58  ChainRotationMove(Space& spc, const std::string& name, const std::string& cite);
59 
60  void _from_json(const json& j) override;
61 
62  private:
67  void rotate_segment(double angle) override;
68 
73  void store_change(Change& change) override;
74 
79  bool box_big_enough();
80 };
81 
90 {
91  using TBase = ChainRotationMove;
92 
93  public:
94  explicit CrankshaftMove(Space& spc);
95 
96  protected:
97  CrankshaftMove(Space& spc, const std::string& name, const std::string& cite);
98  void _from_json(const json& j) override;
99 
100  private:
101  size_t joint_max;
102 
107  size_t select_segment() override;
108 };
109 
119 {
120  using TBase = ChainRotationMove;
121 
122  private:
124 
125  public:
126  explicit PivotMove(Space& spc);
127 
128  protected:
129  PivotMove(Space& spc, const std::string& name, const std::string& cite);
130 
131  void _from_json(const json& j) override;
132 
139  size_t select_segment() override;
140 };
141 
142 } // namespace move
143 } // namespace Faunus
Performs a crankshaft move of a random segment in a polymer chain.
Definition: chainmove.h:89
nlohmann::json json
JSON object.
Definition: json_support.h:10
double sqdispl
center-of-mass displacement squared
Definition: chainmove.h:18
double dprot
maximal angle of rotation, ±0.5*dprot
Definition: chainmove.h:17
const std::string name
Name of move.
Definition: move.h:56
Base class for all moves (MC, Langevin, ...)
Definition: move.h:38
An abstract base class for rotational movements of a polymer chain.
Definition: chainmove.h:11
std::array< size_t, 2 > axis_ndx
Indices of atoms in the spc.p vector that mark the origin and the direction of the axis of rotation...
Definition: chainmove.h:54
An abstract class that rotates a selected segment of a polymer chain in the given simulation box...
Definition: chainmove.h:45
int small_box_encountered
number of skipped moves due to too small container
Definition: chainmove.h:22
Cell list class templates.
Definition: actions.cpp:11
Space & spc
Space to operate on.
Definition: move.h:57
std::vector< size_t > segment_ndx
Indices of atoms in the spc.p vector that shall be rotated.
Definition: chainmove.h:56
Performs a pivot move of a random tail part of a polymer chain.
Definition: chainmove.h:118
void _to_json(json &j) const override
Extra info for report if needed.
Definition: chainmove.cpp:16
Specify changes made to a system.
Definition: space.h:29
Placeholder for atoms and molecules.
Definition: space.h:92
void _from_json(const json &j) override
Extra info for report if needed.
Definition: chainmove.cpp:8
Helper class for storing vectors of base pointers.
Definition: auxiliary.h:237
double bias(Change &, double uold, double unew) override
Extra energy not captured by the Hamiltonian.
Definition: chainmove.cpp:53
Average< double > msqdispl
center-of-mass mean squared displacement
Definition: chainmove.h:19