PSCF v1.3
Pscf::Rpc::Propagator< D > Class Template Reference

MDE solver for one direction of one block. More...

#include <Propagator.h>

Inheritance diagram for Pscf::Rpc::Propagator< D >:
Pscf::PropagatorTmpl< Propagator< D > >

Public Types

using Base = PropagatorTmpl< Propagator<D> >
 Base class (partial template specialization).
using FieldT = RField<D>
 Field type (function of position, defined on a r-space grid).

Public Member Functions

 Propagator ()
 Constructor.
 ~Propagator ()
 Destructor.
void setBlock (Block< D > &block)
 Associate this propagator with a block.
void allocate (int ns, const Mesh< D > &mesh)
 Allocate memory used by this propagator.
void reallocate (int ns)
 Reallocate memory used by this propagator.
void solve ()
 Solve the modified diffusion equation (MDE) for this block.
void solve (FieldT const &head)
 Solve the MDE for a specified initial condition.
double computeQ () const
 Compute and return partition function for the polymer.
const FieldTq (int i) const
 Return q-field at specified step.
const FieldThead () const
 Return q-field at beginning of the block (initial condition).
const FieldTtail () const
 Return q-field at the end of the block.
Block< D > const & block () const
 Get the associated Block object by const reference.
int ns () const
 Get the number of values of s (or slices), including head and tail.
bool isAllocated () const
 Has memory been allocated for this propagator?
int nSource () const
 Number of source / prerequisite propagators.
const Propagator< D > & source (int id) const
 Get a source propagator.
const Propagator< D > & partner () const
 Get partner propagator.
void setIsSolved (bool isSolved)
 Set the isSolved flag to true or false.
bool isSolved () const
 Has the modified diffusion equation been solved?
bool hasPartner () const
 Does this have a partner propagator?
bool isHeadEnd () const
 Is the head vertex a chain end?
bool isTailEnd () const
 Is the tail vertex a chain end?
Public Member Functions inherited from Pscf::PropagatorTmpl< Propagator< D > >
 PropagatorTmpl ()
 Constructor.
void setDirectionId (int directionId)
 Associate this propagator with a direction index.
void setPartner (const Propagator< D > &partner)
 Set the partner of this propagator.
void addSource (const Propagator< D > &source)
 Add a propagator to the list of sources for this one.
void setIsSolved (bool isSolved)
 Set the isSolved flag to true or false.
void setEndFlags (bool isHeadEnd, bool isTailEnd)
 Set flags indicating whether vertices are chain ends.
const Propagator< D > & source (int id) const
 Get a source propagator.
const Propagator< D > & partner () const
 Get partner propagator.
int directionId () const
 Get direction index for this propagator.
int nSource () const
 Number of source / prerequisite propagators.
bool hasPartner () const
 Does this have a partner propagator?
bool isHeadEnd () const
 Is the head vertex a chain end?
bool isTailEnd () const
 Is the tail vertex a chain end?
bool isSolved () const
 Has the modified diffusion equation been solved?
bool isReady () const
 Are all source propagators solved?

Detailed Description

template<int D>
class Pscf::Rpc::Propagator< D >

MDE solver for one direction of one block.

A fully initialized Propagator<D> has an associations with a Block<D> object that owns this propagator and its partner, and with a partner Propagator<D> that solves the MDE within the same block in the opposite direction. It also has an association with a Mesh<D> that describes a spatial grid, and associations with zero or more source Propagator<D> objects that are used to compute an initial condition for this propagator at the head vertex.

The associated Block<D> stores information required to numerically solve the modified diffusion equation (MDE), including quantities that depend upon the w-field associated with this block, the unit cell parameters and (in the thread model) the contour step size. These quantities are set and stored by the block because their values are the same for the two propagators owned by each block, but may be different for different blocks. The algorithm used by a Propagator to solve the MDE repeatedly calls step functions provided by the parent Block.

Definition at line 51 of file rpc/solvers/Propagator.h.

Member Typedef Documentation

◆ Base

template<int D>
using Pscf::Rpc::Propagator< D >::Base = PropagatorTmpl< Propagator<D> >

Base class (partial template specialization).

Definition at line 61 of file rpc/solvers/Propagator.h.

◆ FieldT

template<int D>
using Pscf::Rpc::Propagator< D >::FieldT = RField<D>

Field type (function of position, defined on a r-space grid).

Definition at line 66 of file rpc/solvers/Propagator.h.

Constructor & Destructor Documentation

◆ Propagator()

template<int D>
Pscf::Rpc::Propagator< D >::Propagator ( )

Constructor.

Definition at line 25 of file rpc/solvers/Propagator.tpp.

◆ ~Propagator()

template<int D>
Pscf::Rpc::Propagator< D >::~Propagator ( )

Destructor.

Definition at line 36 of file rpc/solvers/Propagator.tpp.

Member Function Documentation

◆ setBlock()

template<int D>
void Pscf::Rpc::Propagator< D >::setBlock ( Block< D > & block)
inline

Associate this propagator with a block.

Parameters
blockassociated Block object.

Definition at line 300 of file rpc/solvers/Propagator.h.

References block(), and UTIL_ASSERT.

◆ allocate()

template<int D>
void Pscf::Rpc::Propagator< D >::allocate ( int ns,
const Mesh< D > & mesh )

Allocate memory used by this propagator.

The parameter ns is the number of values of s at which q(r,s) is calculated, including the end values at the terminating vertices. See docs for the function ns(), which returns this value.

The address of the associated Mesh<D> object is retained.

An Exception is thrown if the propagator is already allocated.

Parameters
nsnumber of slices (including end points at vertices)
meshspatial discretization mesh

Definition at line 43 of file rpc/solvers/Propagator.tpp.

References Pscf::Mesh< D >::dimensions(), ns(), and UTIL_CHECK.

◆ reallocate()

template<int D>
void Pscf::Rpc::Propagator< D >::reallocate ( int ns)

Reallocate memory used by this propagator.

This function is used when the value of ns is changed, which can occur during some parameter sweeps. See docs for allocate and ns.

An Exception is thrown if the propagator has not been previously allocated, or if the parameter ns is equal to the current value.

Parameters
nsnumber of slices (including end points)

Definition at line 60 of file rpc/solvers/Propagator.tpp.

References ns(), setIsSolved(), and UTIL_CHECK.

◆ solve() [1/2]

template<int D>
void Pscf::Rpc::Propagator< D >::solve ( )

Solve the modified diffusion equation (MDE) for this block.

This function computes an initial q-field at the head of this block, and then solves the modified diffusion equation (MDE) to propagate the solution from the head to the tail. Algorithms for the thread or bead model may be used, depending on the value of PolymerModel::model().

Definition at line 136 of file rpc/solvers/Propagator.tpp.

References Pscf::assign(), block(), isAllocated(), Pscf::PolymerModel::isBead(), isHeadEnd(), isTailEnd(), Pscf::PolymerModel::isThread(), setIsSolved(), UTIL_CHECK, and UTIL_THROW.

◆ solve() [2/2]

template<int D>
void Pscf::Rpc::Propagator< D >::solve ( FieldT const & head)

Solve the MDE for a specified initial condition.

This function solves the modified diffusion equation (MDE) for this block with a specified initial condition, which is given by the function parameter "head".

Parameters
headinitial condition of q-field at head of block

Definition at line 187 of file rpc/solvers/Propagator.tpp.

References Pscf::assign(), block(), head(), Pscf::PolymerModel::isBead(), isHeadEnd(), isTailEnd(), Pscf::PolymerModel::isThread(), setIsSolved(), UTIL_CHECK, and UTIL_THROW.

◆ computeQ()

template<int D>
double Pscf::Rpc::Propagator< D >::computeQ ( ) const

Compute and return partition function for the polymer.

This function computes the partition function Q for the molecule as a spatial average of the pointwise product of the initial/head slice for this propagator and the final/tail slice of its partner.

Returns
value of Q (spatial average of q*q^{+} at head)

Definition at line 243 of file rpc/solvers/Propagator.tpp.

References hasPartner(), head(), Pscf::PolymerModel::isBead(), isHeadEnd(), isSolved(), isTailEnd(), partner(), UTIL_CHECK, and UTIL_THROW.

◆ q()

template<int D>
Propagator< D >::FieldT const & Pscf::Rpc::Propagator< D >::q ( int i) const
inline

◆ head()

template<int D>
Propagator< D >::FieldT const & Pscf::Rpc::Propagator< D >::head ( ) const
inline

Return q-field at beginning of the block (initial condition).

Definition at line 246 of file rpc/solvers/Propagator.h.

References isSolved(), and UTIL_CHECK.

Referenced by computeQ(), and solve().

◆ tail()

template<int D>
Propagator< D >::FieldT const & Pscf::Rpc::Propagator< D >::tail ( ) const
inline

Return q-field at the end of the block.

This function throws an Exception if invoked while the bead model is in use (i.e., if PolymerModel::isThread() == false) and the tail for this propagator is a chain end (i.e., if isTailEnd() == true). In this case, the tail slice is not needed, and so is not computed.

Definition at line 256 of file rpc/solvers/Propagator.h.

References isSolved(), isTailEnd(), Pscf::PolymerModel::isThread(), and UTIL_CHECK.

◆ block()

template<int D>
Block< D > const & Pscf::Rpc::Propagator< D >::block ( ) const
inline

Get the associated Block object by const reference.

Definition at line 279 of file rpc/solvers/Propagator.h.

References UTIL_ASSERT.

Referenced by setBlock(), solve(), and solve().

◆ ns()

template<int D>
int Pscf::Rpc::Propagator< D >::ns ( ) const
inline

Get the number of values of s (or slices), including head and tail.

The value of ns is the number of values of s at which q(r,s) is calculated, including the end values at the terminating vertices (the head and tail). In the bead model, this is two more than the number of beads in the block. In the thread model, this is one more than the number length/ds of contour length steps.

Definition at line 289 of file rpc/solvers/Propagator.h.

Referenced by allocate(), and reallocate().

◆ isAllocated()

template<int D>
bool Pscf::Rpc::Propagator< D >::isAllocated ( ) const
inline

Has memory been allocated for this propagator?

Definition at line 293 of file rpc/solvers/Propagator.h.

Referenced by Pscf::Rpc::Block< D >::computeStressThread(), and solve().

◆ nSource()

template<int D>
int Pscf::PropagatorTmpl< Propagator< D > >::nSource ( ) const

Number of source / prerequisite propagators.

◆ source()

template<int D>
const Propagator< D > & Pscf::PropagatorTmpl< Propagator< D > >::source ( int id) const

Get a source propagator.

Parameters
idindex of source propagator, < nSource

◆ partner()

template<int D>
const Propagator< D > & Pscf::PropagatorTmpl< Propagator< D > >::partner ( ) const

Get partner propagator.

Referenced by computeQ().

◆ setIsSolved()

template<int D>
void Pscf::PropagatorTmpl< Propagator< D > >::setIsSolved ( bool isSolved)

Set the isSolved flag to true or false.

Referenced by reallocate(), solve(), and solve().

◆ isSolved()

template<int D>
bool Pscf::PropagatorTmpl< Propagator< D > >::isSolved ( ) const

Has the modified diffusion equation been solved?

Referenced by computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), head(), q(), and tail().

◆ hasPartner()

template<int D>
bool Pscf::PropagatorTmpl< Propagator< D > >::hasPartner ( ) const

Does this have a partner propagator?

Referenced by computeQ().

◆ isHeadEnd()

template<int D>
bool Pscf::PropagatorTmpl< Propagator< D > >::isHeadEnd ( ) const

Is the head vertex a chain end?

Precondition: PolymerModel::isBead()

Referenced by computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), solve(), and solve().

◆ isTailEnd()

template<int D>
bool Pscf::PropagatorTmpl< Propagator< D > >::isTailEnd ( ) const

Is the tail vertex a chain end?

Precondition: PolymerModel::isBead()

Referenced by computeQ(), Pscf::Rpc::Block< D >::computeStressBead(), solve(), solve(), and tail().


The documentation for this class was generated from the following files: