53 read(in,
"mobility", mobility_);
56 int nMonomer = system().mixture().nMonomer();
57 IntVec<D> meshDimensions = system().domain().mesh().dimensions();
58 w_.allocate(nMonomer);
59 for (
int i=0; i < nMonomer; ++i) {
60 w_[i].allocate(meshDimensions);
62 dc_.allocate(nMonomer-1);
63 dwc_.allocate(nMonomer-1);
64 for (
int i=0; i < nMonomer - 1; ++i) {
65 dc_[i].allocate(meshDimensions);
66 dwc_[i].allocate(meshDimensions);
75 int meshSize = system().domain().mesh().size();
76 int nMonomer = system().mixture().nMonomer();
78 for (
int i=0; i < nMonomer; ++i) {
83 for (
int i=0; i < nMonomer - 1; ++i) {
106 const int nMonomer = system().mixture().nMonomer();
107 const int meshSize = system().domain().mesh().size();
111 double oldHamiltonian = simulator().hamiltonian();
114 simulator().saveState();
117 simulator().clearData();
119 attemptMoveTimer_.start();
122 for (i = 0; i < nMonomer; ++i) {
123 w_[i] = system().w().rgrid(i);
127 for (i = 0; i < nMonomer - 1; ++i) {
128 dc_[i] = simulator().dc(i);
132 const double vSystem = system().domain().unitCell().volume();
133 const double vNode = vSystem/double(meshSize);
134 const double a = -1.0*mobility_;
135 const double b = sqrt(2.0*mobility_/vNode);
139 double dwd, dwr, evec;
140 for (j = 0; j < nMonomer - 1; ++j) {
143 for (k = 0; k < meshSize; ++k) {
145 dwr = b*random().gaussian();
150 for (i = 0; i < nMonomer; ++i) {
153 evec = simulator().chiEvecs(j,i);
154 for (k = 0; k < meshSize; ++k) {
155 wn[k] += evec*dwc[k];
162 system().setWRGrid(w_);
163 simulator().clearData();
165 attemptMoveTimer_.stop();
168 compressorTimer_.start();
169 int compress = simulator().compressor().compress();
170 compressorTimer_.stop();
172 bool isConverged =
false;
175 simulator().restoreState();
180 componentTimer_.start();
181 simulator().computeWc();
182 simulator().computeCc();
183 simulator().computeDc();
184 componentTimer_.stop();
187 hamiltonianTimer_.start();
188 simulator().computeHamiltonian();
189 double newHamiltonian = simulator().hamiltonian();
190 double dH = newHamiltonian - oldHamiltonian;
195 for (j = 0; j < nMonomer - 1; ++j) {
197 RField<D> const & df = simulator().dc(j);
199 for (k=0; k < meshSize; ++k) {
200 dp = 0.5*(di[k] + df[k]);
201 dm = 0.5*(di[k] - df[k]);
202 bias += dp*( dwc[k] + mobility_*dm );
206 hamiltonianTimer_.stop();
210 decisionTimer_.start();
211 double weight = exp(bias - dH);
212 accept = random().metropolis(weight);
215 simulator().clearState();
217 simulator().restoreState();
219 decisionTimer_.stop();