PSCF v1.2
rpc/fts/montecarlo/ForceBiasMove.h
1#ifndef RPC_FORCE_BIAS_MOVE_H
2#define RPC_FORCE_BIAS_MOVE_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "McMove.h" // base class
12#include <prdc/cpu/RField.h> // member
13#include <util/containers/DArray.h> // member
14
15namespace Pscf {
16namespace Rpc {
17
18 using namespace Util;
19 using namespace Pscf::Prdc::Cpu;
20
37 template <int D>
38 class ForceBiasMove : public McMove<D>
39 {
40
41 public:
42
49
56
62 void readParameters(std::istream &in);
63
67 void output();
68
72 void setup();
73
79 bool move();
80
84 void outputTimers(std::ostream& out);
85
89 bool needsDc();
90
91 // Inherited public member function
92 using McMove<D>::move;
94 using McMove<D>::clearTimers;
97
98 protected:
99
100 using McMove<D>::system;
101 using McMove<D>::simulator;
102 using McMove<D>::random;
105 using McMove<D>::incrementNFail;
106
108 using McMove<D>::compressorTimer_;
109 using McMove<D>::componentTimer_;
110 using McMove<D>::hamiltonianTimer_;
111 using McMove<D>::decisionTimer_;
112 using McMove<D>::totalTimer_;
113
114 private:
115
118
120 DArray< RField<D> > dc_;
121
123 DArray<RField<D> > dwc_;
124
126 double mobility_;
127
128 };
129
130 // Public inline methods
131
132 /*
133 * Return whether dc fields need to be saved for ForceBiasMove.
134 */
135 template <int D>
137 { return true; }
138
139 #ifndef RPC_FORCE_BIAS_MOVE_TPP
140 // Suppress implicit instantiation
141 extern template class ForceBiasMove<1>;
142 extern template class ForceBiasMove<2>;
143 extern template class ForceBiasMove<3>;
144 #endif
145
146}
147}
148#endif
ForceBiasMove attempts a Brownian dynamics move.
ForceBiasMove(McSimulator< D > &simulator)
Constructor.
void readParameters(std::istream &in)
Read required parameters from file.
bool move()
Attempt and accept or reject force bias Monte-Carlo move.
bool needsDc()
Decide whether dc fields need to be saved for move.
void outputTimers(std::ostream &out)
Return real move times contributions.
void setup()
Setup before the beginning of each simulation run.
void output()
Output statistics for this move (at the end of simulation)
McMove is an abstract base class for Monte Carlo moves.
void incrementNAccept()
Increment the number of accepted moves.
virtual void clearTimers()
Clear timers.
Timer attemptMoveTimer_
Timers for McMove.
Random & random()
Get Random number generator of parent System.
System< D > & system()
Get parent System object.
McSimulator< D > & simulator()
Get parent McSimulator object.
void incrementNAttempt()
Increment the number of attempted moves.
void readProbability(std::istream &in)
Read the probability from file.
void incrementNFail()
Increment the number of failed moves.
Monte-Carlo simulation coordinator.
Dynamically allocatable contiguous array template.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
Fields and FFTs for periodic boundary conditions (CPU)
Definition CField.cpp:12
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.