1#ifndef RPG_LM_BD_STEP_TPP
2#define RPG_LM_BD_STEP_TPP
13#include <rpg/fts/brownian/BdSimulator.h>
14#include <rpg/fts/compressor/Compressor.h>
15#include <rpg/system/System.h>
16#include <prdc/cuda/VecOp.h>
17#include <pscf/math/IntVec.h>
18#include <pscf/cuda/CudaRandom.h>
55 read(in,
"mobility", mobility_);
57 int nMonomer =
system().mixture().nMonomer();
58 int meshSize =
system().domain().mesh().size();
62 w_.allocate(nMonomer);
63 for (
int i=0; i < nMonomer; ++i) {
64 w_[i].allocate(meshDimensions);
66 etaA_.allocate(nMonomer-1);
67 etaB_.allocate(nMonomer-1);
68 for (
int i=0; i < nMonomer - 1; ++i) {
69 etaA_[i].allocate(meshDimensions);
70 etaB_[i].allocate(meshDimensions);
72 dwc_.allocate(meshDimensions);
73 gaussianField_.allocate(meshDimensions);
80 void LMBdStep<D>::generateEtaNew()
82 const int nMonomer = system().mixture().nMonomer();
83 const int meshSize = system().domain().mesh().size();
86 const double vSystem = system().domain().unitCell().volume();
87 double b = sqrt(0.5*mobility_*
double(meshSize)/vSystem);
94 for (j = 0; j < nMonomer - 1; ++j) {
98 cudaRandom().normal(gaussianField_, stddev, mean);
105 void LMBdStep<D>::exchangeOldNew()
109 etaOldPtr_ = etaNewPtr_;
119 int nMonomer =
system().mixture().nMonomer();
120 int meshSize =
system().domain().mesh().size();
125 for (
int i=0; i < nMonomer - 1; ++i) {
146 const int nMonomer =
system().mixture().nMonomer();
147 const int meshSize =
system().domain().mesh().size();
154 for (i = 0; i < nMonomer; ++i) {
162 double a = -1.0*mobility_;
166 for (j = 0; j < nMonomer - 1; ++j) {
172 for (i = 0; i < nMonomer; ++i) {
180 system().w().setRGrid(w_);
183 bool isConverged =
false;
184 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.
BdStep(BdSimulator< D > &simulator)
Constructor.
System< D > & system()
Get parent System object.
BdSimulator< D > & simulator()
Get parent BdSimulator object.
virtual bool step()
Take a single Brownian dynamics step.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
virtual void setup()
Setup before simulation.
virtual void readParameters(std::istream &in)
Read required parameters from file.
LMBdStep(BdSimulator< D > &simulator)
Constructor.
virtual ~LMBdStep()
Destructor.
Dynamically allocatable contiguous array template.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void eqV(DeviceArray< cudaReal > &a, DeviceArray< cudaReal > const &b, const int beginIdA, const int beginIdB, const int n)
Vector assignment, a[i] = b[i], kernel wrapper (cudaReal).
void addVcVcVc(DeviceArray< cudaReal > &a, DeviceArray< cudaReal > const &b, cudaReal const c, DeviceArray< cudaReal > const &d, cudaReal const e, DeviceArray< cudaReal > const &f, cudaReal const g)
3-vec addition w coeff, a[i] = (b[i]*c) + (d[i]*e) + (f[i]*g), kernel wrapper.
void mulVS(DeviceArray< cudaReal > &a, DeviceArray< cudaReal > const &b, const cudaReal c, const int beginIdA, const int beginIdB, const int n)
Vector multiplication, a[i] = b[i] * c, kernel wrapper (cudaReal).
void addEqVc(DeviceArray< cudaReal > &a, DeviceArray< cudaReal > const &b, cudaReal const c)
Vector addition in-place w/ coefficient, a[i] += b[i] * c, kernel wrapper.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Periodic fields and crystallography.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.