1#ifndef RPC_PROPAGATOR_TPP
2#define RPC_PROPAGATOR_TPP
11#include "Propagator.h"
14#include <pscf/mesh/Mesh.h>
49 qFields_.allocate(
ns);
50 for (
int i = 0; i <
ns; ++i) {
68 qFields_.deallocate();
79 qFields_.allocate(
ns);
80 for (
int i = 0; i <
ns; ++i) {
81 qFields_[i].allocate(meshPtr_->dimensions());
91 void Propagator<D>::computeHead()
94 int nx = meshPtr_->size();
97 FieldT& qh = qFields_[0];
100 for (
int ix = 0; ix < nx; ++ix) {
106 for (
int is = 0; is < nSource(); ++is) {
107 if (!source(is).isSolved()) {
108 UTIL_THROW(
"Source not solved in computeHead");
110 FieldT
const& qt = source(is).tail();
111 for (
int ix = 0; ix < nx; ++ix) {
123 void Propagator<D>::assign(FieldT& lhs, FieldT
const & rhs)
125 int nx = lhs.capacity();
127 for (
int ix = 0; ix < nx; ++ix) {
147 for (
int iStep = 0; iStep < ns_ - 1; ++iStep) {
148 block().stepThread(qFields_[iStep], qFields_[iStep + 1]);
156 assign(qFields_[1], qFields_[0]);
158 block().stepHalfBondBead(qFields_[0], qFields_[1]);
160 block().stepFieldBead(qFields_[1]);
164 for (iStep = 1; iStep < ns_ - 2; ++iStep) {
165 block().stepBead(qFields_[iStep], qFields_[iStep + 1]);
170 assign(qFields_[ns_-1], qFields_[ns_-2]);
172 block().stepHalfBondBead(qFields_[ns_-2], qFields_[ns_-1]);
191 int nx = meshPtr_->size();
196 for (
int i = 0; i < nx; ++i) {
203 for (
int iStep = 0; iStep < ns_ - 1; ++iStep) {
204 block().stepThread(qFields_[iStep], qFields_[iStep + 1]);
212 assign(qFields_[1], qFields_[0]);
214 block().stepHalfBondBead(qFields_[0], qFields_[1]);
216 block().stepFieldBead(qFields_[1]);
220 for (iStep = 1; iStep < ns_ - 2; ++iStep) {
221 block().stepBead(qFields_[iStep], qFields_[iStep + 1]);
226 assign(qFields_[ns_-1], qFields_[ns_-2]);
228 block().stepHalfBondBead(qFields_[ns_-2], qFields_[ns_-1]);
253 UTIL_THROW(
"Partner propagator is not solved");
257 int nx = meshPtr_->size();
263 for (
int ix = 0; ix < nx; ++ix) {
270 for (
int ix = 0; ix < nx; ++ix) {
Description of a regular grid of points in a periodic domain.
IntVec< D > dimensions() const
Get an IntVec<D> of the grid dimensions.
void solve()
Solve the modified diffusion equation (MDE) for this block.
double computeQ() const
Compute and return partition function for the polymer.
const Propagator< D > & partner() const
Get partner propagator.
bool isHeadEnd() const
Is the head vertex a chain end?
int ns() const
Get the number of values of s (or slices), including head and tail.
void allocate(int ns, const Mesh< D > &mesh)
Allocate memory used by this propagator.
void setIsSolved(bool isSolved)
Set the isSolved flag to true or false.
bool isSolved() const
Has the modified diffusion equation been solved?
bool isTailEnd() const
Is the tail vertex a chain end?
bool isAllocated() const
Has memory been allocated for this propagator?
const FieldT & head() const
Return q-field at beginning of the block (initial condition).
void reallocate(int ns)
Reallocate memory used by this propagator.
bool hasPartner() const
Does this have a partner propagator?
Block< D > const & block() const
Get the associated Block object by const reference.
RField< D > FieldT
Field type (function of position, defined on a r-space grid).
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void assign(CT &z, RT const &a, RT const &b)
Create a complex number from real and imaginary parts, z = a + ib.
bool isThread()
Is the thread model in use ?
bool isBead()
Is the bead model in use ?
Real periodic fields, SCFT and PS-FTS (CPU).
PSCF package top-level namespace.