PSCF v1.5.0
rp/solvers/Block.cpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "Block_c.h"
9#include "Propagator_c.h"
10
11#include <pscf/field/cpp/WaveList.h>
12#include <pscf/field/cpp/FFT.h>
13#include <pscf/crystal/UnitCell.h>
14#include <pscf/crystal/shiftToMinimum.h>
15
16#include <pscf/chem/Edge.h>
17#include <pscf/mesh/Mesh.h>
18#include <pscf/mesh/MeshIterator.h>
19
20#include <util/containers/DMatrix.h>
21#include <util/containers/DArray.h>
22
23#include <pscf/solvers/BlockTmpl.tpp>
24
25namespace Pscf {
26namespace Rp {
27
28 // Namespaces from which names may be used without qualification
29 using namespace Util;
30
31 /*
32 * Constructor.
33 */
34 template <int D>
36 : meshPtr_(nullptr),
37 fftPtr_(nullptr),
38 unitCellPtr_(nullptr),
39 waveListPtr_(nullptr),
40 kMeshDimensions_(-1),
41 kSize_(-1),
42 ds_(-1.0),
43 dsTarget_(-1.0),
44 ns_(-1),
45 nParams_(0),
46 isAllocated_(false),
47 hasExpKsq_(false)
48 {
49 propagator(0).setBlock(*this);
50 propagator(1).setBlock(*this);
51 }
52
53 /*
54 * Destructor.
55 */
56 template <int D>
59
60 /*
61 * Store addresses of mesh, FFT and unit cell.
62 */
63 template <int D>
65 FFT<D,CPT> const& fft,
66 UnitCell<D> const& cell,
67 WaveList<D,CPT>& waveList)
68 {
69 // Preconditions
70 UTIL_CHECK(!isAllocated_);
71
72 // Set pointers to mesh and fft
73 meshPtr_ = &mesh;
74 fftPtr_ = &fft;
75 unitCellPtr_ = &cell;
76 waveListPtr_ = &waveList;
77
78 hasExpKsq_ = false;
79 }
80
81 /*
82 * Compute number of contour steps and allocate all memory.
83 *
84 * The useBatchedFFT parameter is unused.
85 */
86 template <int D>
87 void Block<D,CPT>::allocate(double ds, bool useBatchedFFT)
88 {
89 UTIL_CHECK(ds > 0.0);
90 UTIL_CHECK(meshPtr_);
91 UTIL_CHECK(fftPtr_);
92 UTIL_CHECK(unitCellPtr_);
93 UTIL_CHECK(waveListPtr_);
94 UTIL_CHECK(mesh().size() > 1);
95 UTIL_CHECK(mesh().dimensions() == fft().meshDimensions());
96 UTIL_CHECK(!isAllocated_);
97
98 // Compute DFT grid dimensions kMeshDimensions_ and size kSize_
99 FFT<D,CPT>::computeKMesh(mesh().dimensions(), kMeshDimensions_, kSize_);
100
101 // Allocate work arrays for MDE solution
102 expKsq_.allocate(kMeshDimensions_);
103 expKsq2_.allocate(kMeshDimensions_);
104 expW_.allocate(mesh().dimensions());
105 qr_.allocate(mesh().dimensions());
106 qk_.allocate(mesh().dimensions());
107 qr2_.allocate(mesh().dimensions());
108 qk2_.allocate(mesh().dimensions());
110 expW2_.allocate(mesh().dimensions());
111 } else {
112 expWInv_.allocate(mesh().dimensions());
113 }
114
115 // Allocate block concentration field
116 cField().allocate(mesh().dimensions());
117
118 dsTarget_ = ds;
119
120 // Compute ns_
122 // Set contour length discretization for this block
123 const double length = Edge::length();
124 UTIL_CHECK(length > 0.0);
125 int tempNs;
126 tempNs = floor(length / (2.0 *ds) + 0.5);
127 if (tempNs == 0) {
128 tempNs = 1; // ensure ns_ >= 3
129 }
130 ns_ = 2*tempNs + 1;
131 ds_ = length/double(ns_-1);
132 } else
133 if (PolymerModel::isBead()) {
134 ds_ = 1.0;
135 ns_ = Edge::nBead() + 2;
136 }
137
138 // Allocate memory for solutions to MDE (requires ns_)
139 propagator(0).allocate(ns_, mesh());
140 propagator(1).allocate(ns_, mesh());
141
142 isAllocated_ = true;
143 hasExpKsq_ = false;
144 }
145
146 /*
147 * Set or reset the the block length.
148 */
149 template <int D>
150 void Block<D,CPT>::setLength(double newLength)
151 {
153 Edge::setLength(newLength);
154
155 if (isAllocated_) {
156
157 int oldNs = ns_;
158
159 // Reset contour length discretization
160 UTIL_CHECK(dsTarget_ > 0);
161 const double length = Edge::length();
162 int tempNs = floor( length / (2.0 *dsTarget_) + 0.5 );
163 if (tempNs == 0) {
164 tempNs = 1;
165 }
166 ns_ = 2*tempNs + 1;
167 ds_ = length / double(ns_-1);
168
169 // Reallocate propagators if ns_ has changed
170 if (oldNs != ns_) {
171 propagator(0).reallocate(ns_);
172 propagator(1).reallocate(ns_);
173 }
174
175 }
176 hasExpKsq_ = false;
177 }
178
179 /*
180 * Set or reset the number of beads in this block.
181 */
182 template <int D>
184 {
186
187 // Reallocate propagators if ns_ has changed
188 if (isAllocated_ && ns_ != nBead + 2) {
189 ns_ = nBead + 2;
190 propagator(0).reallocate(ns_);
191 propagator(1).reallocate(ns_);
192 }
193 }
194
195 /*
196 * Set or reset the the block length.
197 */
198 template <int D>
200 {
202 hasExpKsq_ = false;
203 }
204
205 /*
206 * Clear all internal data that depends on the unit cell parameters.
207 */
208 template <int D>
210 {
211 hasExpKsq_ = false;
212 stress_.clear();
213 }
214
215 /*
216 * Compute all elements of expKsq_ and expKsq2_ arrays
217 */
218 template <int D>
220 {
221 UTIL_CHECK(isAllocated_);
222 UTIL_CHECK(waveListPtr_);
223
224 bool isThread = PolymerModel::isThread();
225 const double b = BlockTmplT::kuhn();
226 double bSqFactor = -1.0 * b * b / 6.0;
227 if (isThread) {
228 bSqFactor *= ds_;
229 }
230
231 // Calculate KSq if necessary
232 if (!waveList().hasKSq()) {
233 waveList().computeKSq();
234 }
235 RField<D,CPT> const & kSq = waveList().kSq();
236
237 MeshIterator<D> iter;
238 iter.setDimensions(kMeshDimensions_);
239 double arg;
240 int i;
241 for (iter.begin(); !iter.atEnd(); ++iter) {
242 i = iter.rank();
243 arg = kSq[i]*bSqFactor;
244 expKsq_[i] = exp(arg);
245 expKsq2_[i] = exp(0.5*arg);
246 }
247
248 hasExpKsq_ = true;
249 }
250
251 /*
252 * Setup the the step algorithm for a specific field configuration.
253 */
254 template <int D>
255 void
257 {
258 // Preconditions
259 int nx = mesh().size();
260 UTIL_CHECK(nx > 0);
261 UTIL_CHECK(isAllocated_);
262
263 // Compute expW arrays
264 double arg;
266 double c = -0.5*ds_;
267 for (int i = 0; i < nx; ++i) {
268 arg = c*w[i];
269 expW_[i] = exp(arg);
270 expW2_[i] = exp(0.5*arg);
271 }
272 } else
273 if (PolymerModel::isBead()) {
274 for (int i = 0; i < nx; ++i) {
275 arg = -w[i];
276 expW_[i] = exp(arg);
277 expWInv_[i] = 1.0/expW_[i];
278 }
279 }
280
281 // Compute expKsq arrays if necessary
282 if (!hasExpKsq_) {
283 computeExpKsq();
284 }
285
286 }
287
288 /*
289 * Propagate solution by one step for the thread model.
290 */
291 template <int D>
293 {
295
296 // Preconditions on mesh and fft
297 int nx = mesh().size();
298 UTIL_CHECK(nx > 0);
299 UTIL_CHECK(fft().isSetup());
300 UTIL_CHECK(mesh().dimensions() == fft().meshDimensions());
301
302 // Internal preconditions
303 UTIL_CHECK(isAllocated_);
304 int nk = qk_.capacity();
305 UTIL_CHECK(nk > 0);
306 UTIL_CHECK(qr_.capacity() == nx);
307 UTIL_CHECK(expW_.capacity() == nx);
308 UTIL_CHECK(expW2_.capacity() == nx);
309 UTIL_CHECK(expKsq_.capacity() == nk);
310 UTIL_CHECK(expKsq2_.capacity() == nk);
311 UTIL_CHECK(hasExpKsq_);
312
313 // Preconditions on parameters
314 UTIL_CHECK(q.isAllocated());
315 UTIL_CHECK(q.capacity() == nx);
316 UTIL_CHECK(qout.isAllocated());
317 UTIL_CHECK(qout.capacity() == nx);
318
319 // Apply pseudo-spectral algorithm
320
321 // Step by ds/2 for qr_, step by ds/4 for qr2_
322 int i;
323 for (i = 0; i < nx; ++i) {
324 qr_[i] = q[i]*expW_[i];
325 qr2_[i] = q[i]*expW2_[i];
326 }
327 fft().forwardTransform(qr_, qk_);
328 fft().forwardTransform(qr2_, qk2_);
329 for (i = 0; i < nk; ++i) {
330 qk_[i][0] *= expKsq_[i];
331 qk_[i][1] *= expKsq_[i];
332 qk2_[i][0] *= expKsq2_[i];
333 qk2_[i][1] *= expKsq2_[i];
334 }
335 fft().inverseTransformUnsafe(qk_, qr_); // overwrites qk_
336 fft().inverseTransformUnsafe(qk2_, qr2_); // overwrites qk2_
337 for (i = 0; i < nx; ++i) {
338 qr_[i] = qr_[i]*expW_[i];
339 qr2_[i] = qr2_[i]*expW_[i];
340 }
341
342 // Above, multiplying qr2_ by expW_, rather than by expW2_, combines
343 // required multiplications by expW2_ at the end of first half-step
344 // and at the beginning of the second.
345
346 // Finish second half-step of ds/2 for qr2_
347 fft().forwardTransform(qr2_, qk2_);
348 for (i = 0; i < nk; ++i) {
349 qk2_[i][0] *= expKsq2_[i];
350 qk2_[i][1] *= expKsq2_[i];
351 }
352 fft().inverseTransformUnsafe(qk2_, qr2_); // overwrites qk2_
353 for (i = 0; i < nx; ++i) {
354 qr2_[i] = qr2_[i]*expW2_[i];
355 }
356
357 // Richardson extrapolation
358 for (i = 0; i < nx; ++i) {
359 qout[i] = (4.0*qr2_[i] - qr_[i])/3.0;
360 }
361
362 }
363
364 /*
365 * Apply one step of MDE solution for the bead model.
366 */
367 template <int D>
369 {
371 stepBondBead(q, qout);
372 stepFieldBead(qout);
373 }
374
375 /*
376 * Apply the bond operator for the bead model.
377 */
378 template <int D>
380 {
381 // Prereconditions
382 UTIL_CHECK(isAllocated_);
383 UTIL_CHECK(hasExpKsq_);
384 int nx = mesh().size();
385 UTIL_CHECK(nx > 0);
386 UTIL_CHECK(q.capacity() == nx);
387 UTIL_CHECK(qout.capacity() == nx);
388 int nk = qk_.capacity();
389 UTIL_CHECK(nk > 0);
390 UTIL_CHECK(expKsq_.capacity() == nk);
391
392 // Apply bond operator
393 fft().forwardTransform(q, qk_);
394 for (int i = 0; i < nk; ++i) {
395 qk_[i][0] *= expKsq_[i];
396 qk_[i][1] *= expKsq_[i];
397 }
398 fft().inverseTransformUnsafe(qk_, qout); // destroys qk_
399 }
400
401 /*
402 * Apply the half-bond operator for the bead model.
403 */
404 template <int D>
406 {
407 // Preconditions
408 UTIL_CHECK(isAllocated_);
409 UTIL_CHECK(hasExpKsq_);
410 int nx = mesh().size();
411 UTIL_CHECK(nx > 0);
412 UTIL_CHECK(q.capacity() == nx);
413 UTIL_CHECK(qout.capacity() == nx);
414 int nk = qk_.capacity();
415 UTIL_CHECK(nk > 0);
416 UTIL_CHECK(expKsq_.capacity() == nk);
417
418 // Apply bond operator
419 fft().forwardTransform(q, qk_);
420 for (int i = 0; i < nk; ++i) {
421 qk_[i][0] *= expKsq2_[i];
422 qk_[i][1] *= expKsq2_[i];
423 }
424 fft().inverseTransformUnsafe(qk_, qout); // destroys qk_
425 }
426
427 /*
428 * Apply the local field operator for the bead model.
429 */
430 template <int D>
432 {
433 // Preconditions
434 int nx = mesh().size();
435 UTIL_CHECK(nx > 0);
436 UTIL_CHECK(expW_.capacity() == nx);
437 UTIL_CHECK(q.capacity() == nx);
438
439 // Apply field operator
440 for (int i = 0; i < nx; ++i) {
441 q[i] *= expW_[i];
442 }
443 }
444
445 /*
446 * Integrate to calculate monomer concentration for this block
447 */
448 template <int D>
450 {
451 // Preconditions
452 UTIL_CHECK(isAllocated_);
453 int nx = mesh().size();
454 UTIL_CHECK(nx > 0);
455 UTIL_CHECK(ns_ > 0);
456 UTIL_CHECK(propagator(0).isSolved());
457 UTIL_CHECK(propagator(1).isSolved());
458 UTIL_CHECK(cField().capacity() == nx);
459
460 // Initialize cField to zero at all points
461 int i;
462 for (i = 0; i < nx; ++i) {
463 cField()[i] = 0.0;
464 }
465
466 // References to forward and reverse propagators
467 Propagator<D,CPT> const & p0 = propagator(0);
468 Propagator<D,CPT> const & p1 = propagator(1);
469
470 // Evaluate unnormalized integral
471
472 // Endpoint contributions
473 for (i = 0; i < nx; ++i) {
474 cField()[i] += p0.q(0)[i]*p1.q(ns_ - 1)[i];
475 cField()[i] += p0.q(ns_ -1)[i]*p1.q(0)[i];
476 }
477
478 // Odd indices
479 int j;
480 for (j = 1; j < (ns_ -1); j += 2) {
481 RField<D,CPT> const & qf = p0.q(j);
482 RField<D,CPT> const & qr = p1.q(ns_ - 1 - j);
483 for (i = 0; i < nx; ++i) {
484 //cField()[i] += p0.q(j)[i] * p1.q(ns_ - 1 - j)[i] * 4.0;
485 cField()[i] += qf[i] * qr[i] * 4.0;
486 }
487 }
488
489 // Even indices
490 for (j = 2; j < (ns_ -2); j += 2) {
491 RField<D,CPT> const & qf = p0.q(j);
492 RField<D,CPT> const & qr = p1.q(ns_ - 1 - j);
493 for (i = 0; i < nx; ++i) {
494 // cField()[i] += p0.q(j)[i] * p1.q(ns_ - 1 - j)[i] * 2.0;
495 cField()[i] += qf[i] * qr[i] * 2.0;
496 }
497 }
498
499 // Normalize the integral
500 prefactor *= ds_ / 3.0;
501 for (i = 0; i < nx; ++i) {
502 cField()[i] *= prefactor;
503 }
504
505 }
506
507 /*
508 * Calculate monomer concentration for this block, bead model.
509 */
510 template <int D>
512 {
513 // Preconditions
514 UTIL_CHECK(isAllocated_);
515 int nx = mesh().size();
516 UTIL_CHECK(nx > 0);
517 UTIL_CHECK(ns_ > 0);
518 UTIL_CHECK(propagator(0).isSolved());
519 UTIL_CHECK(propagator(1).isSolved());
520 UTIL_CHECK(cField().capacity() == nx);
521
522 // Initialize cField to zero at all points
523 int i;
524 for (i = 0; i < nx; ++i) {
525 cField()[i] = 0.0;
526 }
527
528 // References to forward and reverse propagators
529 Propagator<D,CPT> const & p0 = propagator(0);
530 Propagator<D,CPT> const & p1 = propagator(1);
531
532 // Sum over beads (j = 1, ... , ns_ -2)
533 int j;
534 for (j = 1; j < (ns_ -1); ++j) {
535 RField<D,CPT> const & qf = p0.q(j);
536 RField<D,CPT> const & qr = p1.q(ns_ - 1 - j);
537 for (i = 0; i < nx; ++i) {
538 cField()[i] += qf[i] * qr[i] * expWInv_[i];
539 }
540 }
541
542 // Normalize the integral
543 for (i = 0; i < nx; ++i) {
544 cField()[i] *= prefactor;
545 }
546 }
547
548 /*
549 * Integrate to compute stress exerted by this block (thread).
550 */
551 template <int D>
553 {
554 // Preconditions
556 int nx = mesh().size();
557 UTIL_CHECK(nx > 0);
558 UTIL_CHECK(fft().isSetup());
559 UTIL_CHECK(mesh().dimensions() == fft().meshDimensions());
560 UTIL_CHECK(ns_ > 0);
561 UTIL_CHECK(ds_ > 0);
562
563 // References to forward and reverse propagators
564 Propagator<D,CPT> const & p0 = propagator(0);
565 Propagator<D,CPT> const & p1 = propagator(1);
566 UTIL_CHECK(p0.isAllocated());
567 UTIL_CHECK(p1.isAllocated());
568
569 // If necessary, update derivatives of |k|^2 in WaveList
570 UTIL_CHECK(waveListPtr_);
571 if (!waveList().hasdKSq()) {
572 waveList().computedKSq();
573 }
574
575 // Initialize dQ work array to zero
577 const int nParam = unitCell().nParameter();
578 for (int i = 0; i < nParam; ++i) {
579 dQ.append(0.0);
580 }
581
582 // Work variables
583 const double b = BlockTmplT::kuhn();
584 const double bSq = b * b / 6.0;
585 double dels, prod, increment;
586 int m, n;
587
588 // Evaluate unnormalized integral over contour
589 for (int j = 0; j < ns_ ; ++j) {
590
591 qr_ = p0.q(j);
592 fft().forwardTransform(qr_, qk_);
593
594 qr2_ = p1.q(ns_ - 1 - j);
595 fft().forwardTransform(qr2_, qk2_);
596
597 // Compute prefactor dels for Simpson's rule
598 dels = ds_ / 3.0;
599 if (j != 0 && j != ns_ - 1) {
600 if (j % 2 == 0) {
601 dels *= 2.0;
602 } else {
603 dels *= 4.0;
604 }
605 }
606
607 // Loop over unit cell parameters
608 for (n = 0; n < nParam ; ++n) {
609 RField<D,CPT> dKSq = waveList().dKSq(n);
610 increment = 0.0;
611 // Loop over wavevectors
612 for (m = 0; m < kSize_ ; ++m) {
613 prod = (qk2_[m][0] * qk_[m][0]) + (qk2_[m][1] * qk_[m][1]);
614 prod *= dKSq[m];
615 increment += prod;
616 }
617 increment *= bSq * dels;
618 dQ[n] = dQ[n] - increment;
619 }
620
621 }
622
623 // Compute stress_ from dQ
624 stress_.clear();
625 for (int n = 0; n < nParam; ++n) {
626 stress_.append(-1.0*prefactor*dQ[n]);
627 }
628
629 }
630
631 /*
632 * Compute contribution of this block to stress for bead model.
633 */
634 template <int D>
635 void Block<D,CPT>::computeStressBead(double prefactor)
636 {
637 // Preconditions
639 int nx = mesh().size();
640 UTIL_CHECK(nx > 0);
641 UTIL_CHECK(fft().isSetup());
642 UTIL_CHECK(mesh().dimensions() == fft().meshDimensions());
643 UTIL_CHECK(ns_ > 0);
644
645 // References to forward to reverse propagators
646 Propagator<D,CPT> const & p0 = propagator(0);
647 Propagator<D,CPT> const & p1 = propagator(1);
648 UTIL_CHECK(p0.isSolved());
649 UTIL_CHECK(p1.isSolved());
650
651
652 // If necessary, update derivatives of |k|^2 in WaveList
653 UTIL_CHECK(waveListPtr_);
654 if (!waveList().hasdKSq()) {
655 waveList().computedKSq();
656 }
657
658 // Initialize dQ work array to zero
660 int nParam = unitCell().nParameter();
661 for (int i = 0; i < nParam; ++i) {
662 dQ.append(0.0);
663 }
664
665 const double b = BlockTmplT::kuhn();
666 const double bSq = b * b / 6.0;
667 double increment, prod;
668
669 // Half-bond from head junction to first bead, if not a chain end
670 if (!p0.isHeadEnd()) {
671
672 // Bead j = 0, forward propagator
673 qr_ = p0.q(0);
674 fft().forwardTransform(qr_, qk_);
675
676 // Next bead (ns_ - 2), reverse propagator
677 qr2_ = p1.q(ns_ - 2);
678 fft().forwardTransform(qr2_, qk2_);
679
680 // Loop over unit cell parameters
681 for (int n = 0; n < nParam ; ++n) {
682 RField<D,CPT> dKSq = waveList().dKSq(n);
683 increment = 0.0;
684 // Loop over wavevectors
685 for (int m = 0; m < kSize_ ; ++m) {
686 prod = (qk2_[m][0] * qk_[m][0]) + (qk2_[m][1] * qk_[m][1]);
687 prod *= dKSq[m]*expKsq2_[m];
688 increment += prod;
689 }
690 increment *= 0.5*bSq;
691 dQ[n] = dQ[n] - increment;
692 }
693 }
694
695 // Loop over nBead - 1 full bonds within this block
696 for (int j = 1; j < ns_ - 2 ; ++j) {
697
698 // Bead j, forward propagator
699 qr_ = p0.q(j);
700 fft().forwardTransform(qr_, qk_);
701
702 // Next bead (ns_- 2 - j), reverse propagator
703 qr2_ = p1.q(ns_ - 2 - j);
704 fft().forwardTransform(qr2_, qk2_);
705
706 // Loop over unit cell parameters
707 for (int n = 0; n < nParam ; ++n) {
708 RField<D,CPT> dKSq = waveList().dKSq(n);
709 increment = 0.0;
710 // Loop over wavevectors
711 for (int m = 0; m < kSize_ ; ++m) {
712 prod = (qk2_[m][0] * qk_[m][0]) + (qk2_[m][1] * qk_[m][1]);
713 prod *= dKSq[m]*expKsq_[m];
714 increment += prod;
715 }
716 increment *= bSq;
717 dQ[n] = dQ[n] - increment;
718 }
719
720 }
721
722 // Half-bond from last bead to tail junction, if not a chain end
723 if (!p0.isTailEnd()) {
724
725 // Second-to-last bead, j = ns_ - 2, forward propagator
726 qr_ = p0.q(ns_-2);
727 fft().forwardTransform(qr_, qk_);
728
729 // Last bead, j=0, reverse propagator
730 qr2_ = p1.q(0);
731 fft().forwardTransform(qr2_, qk2_);
732
733 // Loop over unit cell parameters
734 for (int n = 0; n < nParam ; ++n) {
735 RField<D,CPT> dKSq = waveList().dKSq(n);
736 increment = 0.0;
737 // Loop over wavevectors
738 for (int m = 0; m < kSize_ ; ++m) {
739 prod = (qk2_[m][0] * qk_[m][0]) + (qk2_[m][1] * qk_[m][1]);
740 prod *= dKSq[m]*expKsq2_[m];
741 increment += prod;
742 }
743 increment *= 0.5*bSq;
744 dQ[n] = dQ[n] - increment;
745 }
746
747 }
748
749 // Compute stress_ from dQ
750 stress_.clear();
751 for (int i = 0; i < nParam; ++i) {
752 stress_.append(-1.0*prefactor*dQ[i]);
753 }
754
755 }
756
757}
758}
759
760// Explicit instantiation definitions
761namespace Pscf {
762
763 template class BlockTmpl< Rp::Propagator<1,CPT>, RField<1,CPT> >;
764 template class BlockTmpl< Rp::Propagator<2,CPT>, RField<2,CPT> >;
765 template class BlockTmpl< Rp::Propagator<3,CPT>, RField<3,CPT> >;
766
767 namespace Rp {
768 template class Block<1,CPT>;
769 template class Block<2,CPT>;
770 template class Block<3,CPT>;
771 }
772
773}
virtual void setNBead(int nBead)
Set the number of beads in this block (only valid for bead model).
Definition Edge.cpp:55
int nBead() const
Get the number of beads in this block, in the bead model.
Definition Edge.h:305
virtual void setLength(double length)
Set the length of this block (only valid for thread model).
Definition Edge.cpp:65
double length() const
Get the length of this block, in the thread model.
Definition Edge.h:314
Description of a regular grid of points in a periodic domain.
Definition Mesh.h:61
double ds() const
Get contour length step size.
Definition Block_c.h:459
void stepBondBead(RField< D, CPT > const &qin, RField< D, CPT > &qout) const
Apply a bond operator for the bead model.
Rp::Propagator< D, CPT > & propagator(int directionId)
Get a Propagator for a specified direction (non-const reference).
RField< D, CPT > const & cField() const
Get the associated monomer concentration field (const reference).
void stepFieldBead(RField< D, CPT > &q) const
Apply the exponential field operator for the bead model.
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition UnitCell.h:55
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
void append(Data const &data)
Append data to the end of the array.
Definition FSArray.h:261
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
bool isThread()
Is the thread model in use ?
bool isBead()
Is the bead model in use ?
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.