|
PSCF v1.5.0
|
Block within a branched polymer, for Cpp backend. More...
#include <Block_u.h>
Public Types | |
| using | BlockTmplT = BlockTmpl< Rp::Propagator<D,CUT>, RField<D,CUT> > |
| Direct (parent) base class. | |
| using | FFTT = FFT<D,CUT> |
| Fast Fourier Transform (FFT) type. | |
| using | WaveListT = WaveList<D,CUT> |
| Wavelist type. | |
| Public Types inherited from Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > > | |
| using | PropagatorT |
| Modified diffusion equation solver (propagator) type. | |
| using | FieldT |
| Field type. | |
Public Member Functions | |
| Block () | |
| Constructor. | |
| ~Block () | |
| Destructor. | |
| Rp::Propagator< D, CUT > & | propagator (int directionId) |
| Get a Propagator for a specified direction (non-const reference). | |
| Rp::Propagator< D, CUT > const & | propagator (int directionId) const |
| Get a Propagator for a specified direction (const reference). | |
| RField< D, CUT > const & | cField () const |
| Get the associated monomer concentration field (const reference). | |
| RField< D, CUT > & | cField () |
| Get associated monomer concentration field (non-const reference). | |
Setup (mutators) | |
| void | associate (Mesh< D > const &mesh, FFT< D, CUT > const &fft, UnitCell< D > const &cell, WaveList< D, CUT > &waveList) |
| Create permanent associations with related objects. | |
| void | allocate (double ds, bool useBatchedFFT=true) |
| Allocate memory and set contour step size for thread model. | |
| void | clearUnitCellData () |
| Clear all internal data that depends on lattice parameters. | |
| void | setLength (double newLength) |
| Set or reset block length (only used in thread model). | |
| void | setNBead (int nBead) |
| Set or reset the number of beads (only used in bead model). | |
| void | setKuhn (double kuhn) |
| Set or reset monomer statistical segment length. | |
| void | setupSolver (RField< D, CUT > const &w) |
| Set solver for this block. | |
MDE Step Functions | |
| void | stepThread (RField< D, CUT > const &qin, RField< D, CUT > &qout) const |
| Compute step of integration loop, from i to i+1. | |
| void | stepBead (RField< D, CUT > const &qin, RField< D, CUT > &qout) const |
| Compute one step of solution of MDE for the bead model. | |
| void | stepFieldBead (RField< D, CUT > &q) const |
| Apply the exponential field operator for the bead model. | |
| void | stepBondBead (RField< D, CUT > const &qin, RField< D, CUT > &qout) const |
| Compute a bond operator for the bead model. | |
| void | stepHalfBondBead (RField< D, CUT > const &qin, RField< D, CUT > &qout) const |
| Compute a half-bond operator for the bead model. | |
Monomer Concentration Computation | |
| void | computeConcentrationThread (double prefactor) |
| Compute unnormalized concentration for block by integration. | |
| void | computeConcentrationBead (double prefactor) |
| Compute the concentration for this block, using the bead model. | |
Stress Computation | |
| void | computeStressThread (double prefactor) |
| Compute stress contribution for this block, using thread model. | |
| void | computeStressBead (double prefactor) |
| Compute stress contribution for this block, using bead model. | |
| double | stress (int n) const |
| Get derivative of free energy w/ respect to a unit cell parameter. | |
Accessors | |
| double | ds () const |
| Contour length step size. | |
| int | ns () const |
| Number of contour length steps. | |
| Public Member Functions inherited from Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > > | |
| Rp::Propagator< D, CUT > & | propagator (int directionId) |
| Get a Propagator for a specified direction (non-const reference). | |
| Rp::Propagator< D, CUT > const & | propagator (int directionId) const |
| Get a Propagator for a specified direction (const reference). | |
| RField< D, CUT > const & | cField () const |
| Get the associated monomer concentration field (const reference). | |
| double | kuhn () const |
| Get monomer statistical segment length. | |
| Public Member Functions inherited from Pscf::Edge | |
| Edge () | |
| Constructor. | |
| virtual | ~Edge ()=default |
| Destructor. | |
| template<class Archive> | |
| void | serialize (Archive &ar, unsigned int versionId) |
| Serialize to/from archive. | |
| void | setId (int id) |
| Set the id for this block. | |
| void | setMonomerId (int monomerId) |
| Set the monomer type id. | |
| void | setVertexIds (int vertexId0, int vertexId1) |
| Set indices of associated vertices. | |
| void | setPolymerType (PolymerType::Enum type) |
| Set the type of the parent polymer (branched or linear). | |
| int | id () const |
| Get the id of this block (unique within the polymer). | |
| int | monomerId () const |
| Get the monomer type id for this block. | |
| const Pair< int > & | vertexIds () const |
| Get the pair of associated vertex ids. | |
| int | vertexId (int i) const |
| Get the id of one associated vertex. | |
| double | length () const |
| Get the length of this block, in the thread model. | |
| int | nBead () const |
| Get the number of beads in this block, in the bead model. | |
| PolymerType::Enum | polymerType () const |
| Get the type of the parent polymer (branched or linear). | |
Additional Inherited Members | |
| Protected Member Functions inherited from Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > > | |
| BlockTmpl () | |
| Constructor. | |
| ~BlockTmpl ()=default | |
| Destructor. | |
| RField< D, CUT > & | cField () |
| Get associated monomer concentration field (non-const reference). | |
Block within a branched polymer, for Cpp backend.
A Block has two Propagator<D,CUT> members and an RField<D,CUT> monomer concentration field.
| using Pscf::Rp::Block< D, CUT >::BlockTmplT = BlockTmpl< Rp::Propagator<D,CUT>, RField<D,CUT> > |
| using Pscf::Rp::Block< D, CUT >::FFTT = FFT<D,CUT> |
| using Pscf::Rp::Block< D, CUT >::WaveListT = WaveList<D,CUT> |
| Pscf::Rp::Block< D, CUT >::Block | ( | ) |
Constructor.
Definition at line 218 of file Block.cu.
References Block(), and propagator().
Referenced by allocate(), associate(), Block(), clearUnitCellData(), computeConcentrationBead(), computeConcentrationThread(), computeStressBead(), computeStressThread(), ds(), ns(), setKuhn(), setLength(), setNBead(), setupSolver(), stepBead(), stepBondBead(), stepFieldBead(), stepHalfBondBead(), stepThread(), stress(), and ~Block().
| Pscf::Rp::Block< D, CUT >::~Block | ( | ) |
| void Pscf::Rp::Block< D, CUT >::associate | ( | Mesh< D > const & | mesh, |
| FFT< D, CUT > const & | fft, | ||
| UnitCell< D > const & | cell, | ||
| WaveList< D, CUT > & | waveList ) |
Create permanent associations with related objects.
This function creates associations of this block with the Mesh, FFT, UnitCell, and WaveList objects by storing their addresses. It must be called before allocate().
| mesh | Mesh<D> object - spatial discretization mesh |
| fft | FFT<D,CUT> object - Fourier transforms |
| cell | UnitCell<D> object - crystallographic unit cell |
| waveList | WaveList<D,CUT> object - properties of wavevectors |
Definition at line 245 of file Block.cu.
References Block(), Pscf::UnitCellBase< D >::nParameter(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::allocate | ( | double | ds, |
| bool | useBatchedFFT = true ) |
Allocate memory and set contour step size for thread model.
This function choses a value for the number ns of contour variable grid points for this block, sets the step size, and allocates memory for several private arrays. Spatial grid dimensions are obtained from a pointers to the associated mesh.
For the thread model, if PolymerModel::isThread() is true, the value for the number ns of contour variable grid points for this block is chosen to yield a value for the the actual step size length/(ns-1) as close as possible to the input parameter ds (the target step size), consistent with the requirements that ns be an odd integer and ns > 1. These requirements allow use of Simpson's rule for integration with respect to the contour variable s to compute monomer concentration fields and stress contributions.
For the bead model, if PolymerModel::isThread() is true, the value of ns is given by nBead + 2.
Precondition: associate() must be called before this function
| ds | target (optimal) value for contour length step size |
| useBatchedFFT | Flag indicating whether to use batched FFTs |
Definition at line 268 of file Block.cu.
References Block(), cField(), ds(), Pscf::PolymerModel::isBead(), Pscf::PolymerModel::isThread(), Pscf::Edge::length(), Pscf::Edge::nBead(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::clearUnitCellData | ( | ) |
Clear all internal data that depends on lattice parameters.
This method changes the internal hasExpKsq_ flag to false, so that the expKsq arrays will need to be recalculated before a step function can be called.
Definition at line 426 of file Block.cu.
References Block(), and UTIL_CHECK.
|
virtual |
Set or reset block length (only used in thread model).
Precondition: PolymerModel::isThread()
| newLength | new block length |
Reimplemented from Pscf::Edge.
Definition at line 345 of file Block.cu.
References Block(), Pscf::PolymerModel::isThread(), Pscf::Edge::length(), propagator(), Pscf::Edge::setLength(), and UTIL_CHECK.
|
virtual |
Set or reset the number of beads (only used in bead model).
Precondition: PolymerModel::isBead(). If memory is allocated, the propagators are reallocated for the new number of beads.
| nBead | new number of beads in this block |
Reimplemented from Pscf::Edge.
Definition at line 390 of file Block.cu.
References Block(), Pscf::Edge::nBead(), propagator(), Pscf::Edge::setNBead(), and UTIL_CHECK.
|
virtual |
Set or reset monomer statistical segment length.
| kuhn | new monomer statistical segment length. |
Reimplemented from Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >.
Definition at line 416 of file Block.cu.
References Block(), Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::kuhn(), and Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::setKuhn().
| void Pscf::Rp::Block< D, CUT >::setupSolver | ( | RField< D, CUT > const & | w | ) |
Set solver for this block.
This should be called once after every change in w fields, the unit cell parameters, the block length or kuhn length, before entering the loop used to solve the MDE for either propagator. This function is called by Polymer<D>::compute.
| w | chemical potential field for this monomer type |
Definition at line 467 of file Block.cu.
References Block(), Pscf::VecOp::divSV(), Pscf::VecOp::expVc(), Pscf::PolymerModel::isThread(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::stepThread | ( | RField< D, CUT > const & | qin, |
| RField< D, CUT > & | qout ) const |
Compute step of integration loop, from i to i+1.
This function is called internally by the Propagator::solve function within a loop over steps. It is implemented in the Block class because the same private data structures are needed for the two propagators associated with a Block.
| qin | slice i of propagator q (input) |
| qout | slice i+1 of propagator q (output) |
Definition at line 494 of file Block.cu.
References Block(), Pscf::VecOp::mulEqV(), Pscf::VecOp::mulEqVPair(), Pscf::VecOp::mulVVPair(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::stepBead | ( | RField< D, CUT > const & | qin, |
| RField< D, CUT > & | qout ) const |
Compute one step of solution of MDE for the bead model.
This function is called internally by the Propagator::solve function within a loop over steps. It is implemented in the Block class because the same private data structures are needed for the two propagators associated with a Block.
| qin | slice i of propagator q (input) |
| qout | slice i+1 of propagator q (output) |
Definition at line 542 of file Block.cu.
References Block(), stepBondBead(), and stepFieldBead().
| void Pscf::Rp::Block< D, CUT >::stepFieldBead | ( | RField< D, CUT > & | q | ) | const |
Apply the exponential field operator for the bead model.
This function applies exp( -w(r)) in-place, where w(r) is the w-field for the monomer type of this block.
| q | slice of propagator q, modified in placde |
Definition at line 552 of file Block.cu.
References Block(), Pscf::VecOp::mulEqV(), and UTIL_CHECK.
Referenced by stepBead().
| void Pscf::Rp::Block< D, CUT >::stepBondBead | ( | RField< D, CUT > const & | qin, |
| RField< D, CUT > & | qout ) const |
Compute a bond operator for the bead model.
This function applies exp( -|G|^2 b^2 / 6) in Fourier space. To do so, it peforms a forward FFT, multplication in k-space, and an inverse FFT.
| qin | slice i of propagator q (input) |
| qout | slice i+1 of propagator q (output) |
Definition at line 566 of file Block.cu.
References Block(), Pscf::VecOp::mulEqV(), and UTIL_CHECK.
Referenced by stepBead().
| void Pscf::Rp::Block< D, CUT >::stepHalfBondBead | ( | RField< D, CUT > const & | qin, |
| RField< D, CUT > & | qout ) const |
Compute a half-bond operator for the bead model.
This function applies exp( -|G|^2 b^2 / 12) in Fourier space. To do so, it peforms a forward FFT, multplication in k-space, and an inverse FFT.
| qin | slice i of propagator q (input) |
| qout | slice i+1 of propagator q (output) |
Definition at line 592 of file Block.cu.
References Block(), Pscf::VecOp::mulEqV(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::computeConcentrationThread | ( | double | prefactor | ) |
Compute unnormalized concentration for block by integration.
The "prefactor" parameter must equal phi/(L q), where L is the total length of all blocks in the polymer species and q is the species partition function.
Upon return, grid point r of array cField() contains the integral int ds q(r,s)q^{*}(r,L-s) times the prefactor, where q(r,s) is the solution obtained from propagator(0), and q^{*} is the solution of propagator(1), and s is a contour variable that is integrated over the domain 0 < s < length(), where length() is the block length.
| prefactor | constant multiplying integral over s |
Definition at line 615 of file Block.cu.
References Block(), cField(), Pscf::VecOp::eqS(), Pscf::VecOp::mulEqS(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::computeConcentrationBead | ( | double | prefactor | ) |
Compute the concentration for this block, using the bead model.
This function is called by Polymer::compute if a bead model is is used.
The "prefactor" parameter must equal phi/(N q), where N is the total number of beads owned by all blocks of the polymer, and q is the species partition function.
Upon return, grid point r of array cField() contains the sum sum_s ds q(r,s) q^{*}(r,N-s) exp(W(r)*ds) over beads owned by this block times the "prefactor" parameter, where q(r,s) and q^{*}(r,s) are propagators associated with different directions.
| prefactor | constant multiplying sum over beads |
Definition at line 651 of file Block.cu.
References Block(), cField(), Pscf::VecOp::eqS(), Pscf::VecOp::mulEqS(), propagator(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::computeStressThread | ( | double | prefactor | ) |
Compute stress contribution for this block, using thread model.
This function is called by Polymer<D>::computeStress. The prefactor is equal to that used in computeConcentrationThread.
| prefactor | constant multiplying integral over s |
Definition at line 681 of file Block.cu.
References Util::FSArray< Data, Capacity >::append(), Block(), Pscf::PolymerModel::isThread(), Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::kuhn(), propagator(), Pscf::Reduce::sum(), and UTIL_CHECK.
| void Pscf::Rp::Block< D, CUT >::computeStressBead | ( | double | prefactor | ) |
Compute stress contribution for this block, using bead model.
This function is called by Polymer<D>::computeStress. The prefactor is equal to that used in computeConcentrationBead.
| prefactor | constant multiplying sum over beads |
Definition at line 800 of file Block.cu.
References Util::FSArray< Data, Capacity >::append(), Block(), Util::FSArray< Data, Capacity >::clear(), Pscf::PolymerModel::isBead(), Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::kuhn(), Pscf::VecOp::mulEqV(), propagator(), Pscf::Reduce::sum(), and UTIL_CHECK.
|
inline |
|
inline |
Contour length step size.
Definition at line 458 of file Block_u.h.
References Block().
Referenced by allocate().
|
inline |
| Rp::Propagator< D, CUT > & Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::propagator | ( | int | directionId | ) |
Get a Propagator for a specified direction (non-const reference).
For a block with v0 = vertexId(0) and v1 = vertexId(1), propagator(0) propagates from vertex v0 to v1, while propagator(1) propagates from vertex v1 to v0.
| directionId | integer index for direction (0 or 1) |
Referenced by allocate(), Block(), computeConcentrationBead(), computeConcentrationThread(), computeStressBead(), computeStressThread(), setLength(), and setNBead().
| Rp::Propagator< D, CUT > const & Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::propagator | ( | int | directionId | ) | const |
Get a Propagator for a specified direction (const reference).
For a block with v0 = vertexId(0) and v1 = vertexId(1), propagator(0) propagates from vertex v0 to v1, while propagator(1) propagates from vertex v1 to v0.
| directionId | integer index for direction (0 or 1) |
| RField< D, CUT > const & Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::cField | ( | ) | const |
Get the associated monomer concentration field (const reference).
Referenced by allocate(), computeConcentrationBead(), and computeConcentrationThread().
| RField< D, CUT > & Pscf::BlockTmpl< Rp::Propagator< D, CUT >, RField< D, CUT > >::cField | ( | ) |
Get associated monomer concentration field (non-const reference).