1#ifndef RPC_EXPLICIT_BD_STEP_TPP
2#define RPC_EXPLICIT_BD_STEP_TPP
11#include "ExplicitBdStep.h"
13#include <rpc/fts/brownian/BdSimulator.h>
14#include <rpc/fts/compressor/Compressor.h>
15#include <rpc/system/System.h>
16#include <pscf/math/IntVec.h>
17#include <util/random/Random.h>
23 using namespace Prdc::Cpu;
49 read(in,
"mobility", mobility_);
52 int nMonomer =
system().mixture().nMonomer();
54 w_.allocate(nMonomer);
55 for (
int i=0; i < nMonomer; ++i) {
56 w_[i].allocate(meshDimensions);
58 dwc_.allocate(meshDimensions);
66 int meshSize =
system().domain().mesh().size();
67 int nMonomer =
system().mixture().nMonomer();
69 for (
int i=0; i < nMonomer; ++i) {
79 const int nMonomer =
system().mixture().nMonomer();
80 const int meshSize =
system().domain().mesh().size();
87 for (i = 0; i < nMonomer; ++i) {
88 w_[i] =
system().w().rgrid(i);
92 const double vSystem =
system().domain().unitCell().volume();
93 const double a = -1.0*mobility_;
94 const double b = sqrt(2.0*mobility_*
double(meshSize)/vSystem);
98 double dwd, dwr, evec;
99 for (j = 0; j < nMonomer - 1; ++j) {
101 for (k = 0; k < meshSize; ++k) {
103 dwr = b*
random().gaussian();
107 for (i = 0; i < nMonomer; ++i) {
110 for (k = 0; k < meshSize; ++k) {
111 w[k] += evec*dwc_[k];
117 system().w().setRGrid(w_);
121 bool isConverged =
false;
122 int compress =
simulator().compressor().compress();
An IntVec<D, T> is a D-component vector of elements of integer type T.
Field of real double precision values on an FFT mesh.
Brownian dynamics simulator for PS-FTS.
BdSimulator< D > & simulator()
Get parent BdSimulator object.
System< D > & system()
Get parent System object.
BdStep(BdSimulator< D > &simulator)
Constructor.
Random & random()
Get Random number generator of parent System.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
ExplicitBdStep(BdSimulator< D > &simulator)
Constructor.
virtual void setup()
Setup before simulation.
virtual void readParameters(std::istream &in)
Read required parameters from file.
virtual bool step()
Take a single Brownian dynamics step.
virtual ~ExplicitBdStep()
Destructor.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Real periodic fields, SCFT and PS-FTS (CPU).
PSCF package top-level namespace.