1#ifndef RPC_EXPLICIT_BD_STEP_TPP
2#define RPC_EXPLICIT_BD_STEP_TPP
11#include "ExplicitBdStep.h"
12#include <rpc/system/System.h>
13#include <rpc/solvers/Mixture.h>
14#include <rpc/field/Domain.h>
15#include <rpc/fts/brownian/BdSimulator.h>
16#include <rpc/fts/compressor/Compressor.h>
17#include <pscf/math/IntVec.h>
18#include <util/random/Random.h>
24 using namespace Prdc::Cpu;
50 read(in,
"mobility", mobility_);
53 int nMonomer =
system().mixture().nMonomer();
55 w_.allocate(nMonomer);
56 for (
int i=0; i < nMonomer; ++i) {
57 w_[i].allocate(meshDimensions);
59 dwc_.allocate(meshDimensions);
67 int meshSize =
system().domain().mesh().size();
68 int nMonomer =
system().mixture().nMonomer();
70 for (
int i=0; i < nMonomer; ++i) {
80 const int nMonomer =
system().mixture().nMonomer();
81 const int meshSize =
system().domain().mesh().size();
88 for (i = 0; i < nMonomer; ++i) {
89 w_[i] =
system().w().rgrid(i);
93 const double vSystem =
system().domain().unitCell().volume();
94 const double a = -1.0*mobility_;
95 const double b = sqrt(2.0*mobility_*
double(meshSize)/vSystem);
99 double dwd, dwr, evec;
100 for (j = 0; j < nMonomer - 1; ++j) {
102 for (k = 0; k < meshSize; ++k) {
104 dwr = b*
random().gaussian();
108 for (i = 0; i < nMonomer; ++i) {
111 for (k = 0; k < meshSize; ++k) {
112 w[k] += evec*dwc_[k];
118 system().w().setRGrid(w_);
122 bool isConverged =
false;
123 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.