Loading [MathJax]/extensions/TeX/AMSsymbols.js
PSCF v1.2
rpg/fts/montecarlo/ForceBiasMove.h
1#ifndef RPG_FORCE_BIAS_MOVE_H
2#define RPG_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/cuda/RField.h>
13#include <util/containers/DArray.h>
14
15namespace Pscf {
16namespace Rpg {
17
18 using namespace Util;
19 using namespace Pscf::Prdc;
20 using namespace Pscf::Prdc::Cuda;
21
27 template <int D>
28 class ForceBiasMove : public McMove<D>
29 {
30
31 public:
32
39
46
52 void readParameters(std::istream &in);
53
57 void output();
58
62 void setup();
63
69 bool move();
70
74 void outputTimers(std::ostream& out);
75
79 bool needsDc();
80
81 // Inherited public member function
82 using McMove<D>::move;
84 using McMove<D>::clearTimers;
87
88 protected:
89
90 using McMove<D>::system;
91 using McMove<D>::simulator;
92 using McMove<D>::random;
93 using McMove<D>::cudaRandom;
97
99 using McMove<D>::compressorTimer_;
100 using McMove<D>::componentTimer_;
101 using McMove<D>::hamiltonianTimer_;
102 using McMove<D>::decisionTimer_;
103 using McMove<D>::totalTimer_;
104
105 private:
106
109
111 DArray< RField<D> > dc_;
112
114 DArray<RField<D> > dwc_;
115
117 RField<D> gaussianField_;
118
119 RField<D> biasField_;
120
122 double mobility_;
123
124 };
125
126 // Public inline methods
127
128 /*
129 * Return whether dc fields need to be saved for ForceBiasMove.
130 */
131 template <int D>
133 { return true; }
134
135 #ifndef RPG_FORCE_BIAS_MOVE_TPP
136 // Suppress implicit instantiation
137 extern template class ForceBiasMove<1>;
138 extern template class ForceBiasMove<2>;
139 extern template class ForceBiasMove<3>;
140 #endif
141
142}
143}
144#endif
Field of real double precision values on an FFT mesh.
ForceBiasMove attempts a Brownian dynamics move.
void setup()
Setup before the beginning of each simulation run.
void output()
Output statistics for this move (at the end of simulation)
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.
void outputTimers(std::ostream &out)
Return real move times contributions.
bool needsDc()
Decide whether dc fields need to be saved for move.
McMove is an abstract base class for Monte Carlo moves.
CudaRandom & cudaRandom()
Get cuda random number generator by reference.
void incrementNAttempt()
Increment the number of attempted moves.
Random & random()
Get Random number generator of parent System.
void readProbability(std::istream &in)
Read the probability from file.
McSimulator< D > & simulator()
Get parent McSimulator object.
System< D > & system()
Get parent System object.
void incrementNAccept()
Increment the number of accepted moves.
void incrementNFail()
Increment the number of failed moves.
Timer attemptMoveTimer_
Timers for McMove.
virtual void clearTimers()
Clear timers.
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, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition CField.cu:12
Periodic fields and crystallography.
Definition CField.cpp:11
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.