PSCF v1.4.0
fts/montecarlo/ForceBiasMove.h
1#ifndef RP_FORCE_BIAS_MOVE_H
2#define RP_FORCE_BIAS_MOVE_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <util/containers/DArray.h> // member
12#include <iostream>
13
14namespace Pscf {
15namespace Rp {
16
17 using namespace Util;
18
44 template <int D, class T>
45 class ForceBiasMove : public T::McMove
46 {
47
48 public:
49
50 // Protected constructor and destructor (see below).
51
57 void readParameters(std::istream &in) override;
58
62 void setup() override;
63
69 bool move() override;
70
74 void output() override;
75
79 bool needsDc() override;
80
81 protected:
82
88 ForceBiasMove(typename T::McSimulator& simulator);
89
93 ~ForceBiasMove() = default;
94
96 using McMoveT = typename T::McMove;
97
98 // Protected inherited member functions (selected).
99 using McMoveT::system;
100 using McMoveT::simulator;
101
102 private:
103
105 using RFieldT = typename T::RField;
106
109
112
114 DArray<RFieldT > dwc_;
115
117 RFieldT eta_;
118
120 RFieldT biasField_;
121
123 double mobility_;
124
128 virtual
129 void computeForceBias(RFieldT& result,
130 RFieldT const & di,
131 RFieldT const & df,
132 RFieldT const & dwc,
133 double mobility) = 0;
134
135 };
136
137 // Public inline methods
138
139 /*
140 * Specify if dc fields need to be saved.
141 */
142 template <int D, class T>
144 { return true; }
145
146}
147}
148#endif
bool needsDc() override
Specify if dc fields need to be saved (returns true).
bool move() override
Attempt and accept or reject a force bias Monte-Carlo move.
void setup() override
Setup before the beginning of each simulation run.
~ForceBiasMove()=default
Destructor.
ForceBiasMove(typename T::McSimulator &simulator)
Constructor.
void output() override
Output statistics for this move (at the end of simulation)
typename T::McMove McMoveT
Alias for McMove base class.
void readParameters(std::istream &in) override
Read body of parameter file block and allocate memory.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.