PSCF v1.5.0
LMBdStep.h
1#ifndef RP_LM_BD_STEP_H
2#define RP_LM_BD_STEP_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <rp/fts/brownian/BdStep.h> // base class
12#include <pscf/field/RField.h> // member
13#include <util/containers/DArray.h> // member
14
15#include <pscf/backend/TmplDeclare.h>
16
17namespace Pscf {
18namespace Rp {
19
20 using namespace Util;
21
49 template <int D, class T>
50 class LMBdStep : public BdStep<D,T>
51 {
52 public:
53
60
61 ~LMBdStep() = default;
62
68 void readParameters(std::istream &in) override;
69
73 void setup() override;
74
80 bool step() override;
81
82 protected:
83
84 // Alias for base class.
85 using BdStepT = BdStep<D,T>;
86
87 // Inherited functions (selected)
88 using BdStepT::system;
91
92 private:
93
94 using RFieldT = RField<D,T>;
95
96 // Private data members
97
98 // New field values
100
101 // Random displacements (A)
102 DArray< RFieldT > etaA_;
103
104 // Random displacements (B)
105 DArray< RFieldT > etaB_;
106
107 // Change in one field component
108 RFieldT dwc_;
109
110 // Pointer to new random displacements
111 DArray< RFieldT >* etaNewPtr_;
112
113 // Pointer to old random displacements
114 DArray< RFieldT >* etaOldPtr_;
115
116 // Prefactor of -dc_ in deterministic drift term
117 double mobility_;
118
119 // Private member functions
120
121 RFieldT& etaNew(int i)
122 { return (*etaNewPtr_)[i]; }
123
124 RFieldT& etaOld(int i)
125 { return (*etaOldPtr_)[i]; }
126
128 void generateEtaNew();
129
131 void exchangeOldNew();
132
133 };
134
135 // Explicit instantiation declarations
136 PSCF_TMPL_DECLARE(LMBdStep)
137
138}
139}
140#endif
Brownian dynamics simulator for PS-FTS.
Definition BdSimulator.h:52
BdStep(BdSimulator< D, T > &simulator)
Constructor.
Definition BdStep.tpp:32
BdSimulator< D, T > & simulator()
Get parent BdSimulator object.
Definition BdStep.h:183
System< D, T > & system()
Get parent System object.
Definition BdStep.h:176
VecRandom< T > & vecRandom()
Get vector random number generator of parent simulator.
Definition BdStep.h:197
Leimkuhler-Matthews Brownian dynamics stepper.
Definition LMBdStep.h:51
void readParameters(std::istream &in) override
Read body of parameter file block.
Definition LMBdStep.tpp:49
LMBdStep(BdSimulator< D, T > &simulator)
Constructor.
Definition LMBdStep.tpp:34
bool step() override
Take a single Brownian dynamics step.
Definition LMBdStep.tpp:129
BdSimulator< D, T > & simulator()
Get parent BdSimulator object.
Definition BdStep.h:183
void setup() override
Setup before simulation loop.
Definition LMBdStep.tpp:103
Dynamically allocatable contiguous array template.
Definition DArray.h:32
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.