PSCF v1.5.0
ForceBiasMoveBase.h
1#ifndef RP_FORCE_BIAS_MOVE_BASE_H
2#define RP_FORCE_BIAS_MOVE_BASE_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <rp/fts/montecarlo/McMove.h> // base class
12#include <pscf/field/RField.h> // member
13#include <util/containers/DArray.h> // member
14
15#include <pscf/backend/TmplDeclare.h>
16#include <iostream>
17
18namespace Pscf {
19namespace Rp {
20
21 using namespace Util;
22
43 template <int D, class T>
44 class ForceBiasMoveBase : public McMove<D,T>
45 {
46
47 public:
48
55
59 ~ForceBiasMoveBase() = default;
60
66 void readParameters(std::istream &in) override;
67
71 void setup() override;
72
78 bool move() override;
79
83 void output() override;
84
88 bool needsDc() override;
89
90 protected:
91
94
95 // Protected inherited member functions (selected).
96 using McMove<D,T>::system;
97 using McMove<D,T>::simulator;
98
99 private:
100
102 using RFieldT = RField<D,T>;
103
106
109
111 DArray< RField<D,T> > dwc_;
112
114 RField<D,T> eta_;
115
117 RField<D,T> biasField_;
118
120 double mobility_;
121
125 virtual
126 void computeForceBias(RField<D,T>& result,
127 RField<D,T> const & di,
128 RField<D,T> const & df,
129 RField<D,T> const & dwc,
130 double mobility) = 0;
131
132 };
133
134 // Public inline method
135
136 /*
137 * Specify if dc fields need to be saved.
138 */
139 template <int D, class T> inline
141 { return true; }
142
143 // Explicit instantiation declarations
144 PSCF_TMPL_DECLARE(ForceBiasMoveBase)
145
146 // Primary template declaration for subclasses
147 template <int D, class T> class ForceBiasMove;
148
149}
150}
151#endif
ForceBiasMoveBase attempts a Brownian dynamics move.
void setup() override
Setup before the beginning of each simulation run.
ForceBiasMoveBase(McSimulator< D, T > &simulator)
Constructor.
bool needsDc() override
Specify if dc fields need to be saved (returns true).
~ForceBiasMoveBase()=default
Destructor.
void output() override
Output statistics for this move (at the end of simulation).
McMove< D, T > McMoveT
Alias for McMove base class.
bool move() override
Attempt and accept or reject a force bias Monte-Carlo move.
void readParameters(std::istream &in) override
Read body of parameter file block and allocate memory.
McSimulator< D, T > & simulator()
Get parent McSimulator object (non-const ref).
Definition McMove.h:342
System< D, T > & system()
Get parent System object (non-const ref).
Definition McMove.h:328
McMove(McSimulator< D, T > &simulator)
Constructor.
Definition McMove.tpp:32
Monte-Carlo simulation coordinator.
Definition McSimulator.h:55
Dynamically allocatable contiguous array template.
Definition DArray.h:32
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.