|
PSCF v1.4.0
|
Block within a linear or branched block polymer. More...
#include <Block.h>
Public Types | |
| using | Base = BlockTmpl< Propagator<D>, CField<D> > |
| Base class. | |
| Public Types inherited from Pscf::BlockTmpl< Propagator< D >, CField< D > > | |
| using | PropagatorT |
| Modified diffusion equation solver (propagator) type. | |
| using | FieldT |
| Field type. | |
Public Member Functions | |
| Block () | |
| Constructor. | |
| ~Block () | |
| Destructor. | |
| void | associate (Mesh< D > const &mesh, FFT< D > const &fft, UnitCell< D > const &cell, WaveList< D > &wavelist) |
| Create permanent associations with related objects. | |
| void | allocate (double ds) |
| Allocate memory and set number of counter steps. | |
| void | clearUnitCellData () |
| Clear all internal data that depends on the unit cell parameters. | |
| void | setLength (double newLength) |
| Set or reset block length (only used in thread model). | |
| void | setKuhn (double kuhn) |
| Set or reset monomer statistical segment length. | |
| void | setupSolver (CField< D > const &w) |
| Set up the MDE solver for this block. | |
| void | stepThread (CField< D > const &qin, CField< D > &qout) const |
| Compute one step of solution of MDE for the thread model. | |
| void | stepBead (CField< D > const &qin, CField< D > &qout) const |
| Compute one step of solution of MDE for the bead model. | |
| void | stepFieldBead (CField< D > &q) const |
| Apply the exponential field operator for the bead model. | |
| void | stepBondBead (CField< D > const &qin, CField< D > &qout) const |
| Apply a bond operator for the bead model. | |
| void | stepHalfBondBead (CField< D > const &qin, CField< D > &qout) const |
| Apply a half-bond operator for the bead model. | |
| void | computeConcentrationThread (fftw_complex const &prefactor) |
| Compute the concentration for this block, for the thread model. | |
| void | computeConcentrationBead (fftw_complex const &prefactor) |
| Compute the concentration for this block, using the bead model. | |
| double | ds () const |
| Get contour length step size. | |
| int | ns () const |
| Get the number of contour grid points, including end points. | |
| Propagator< D > & | propagator (int directionId) |
| Get a Propagator for a specified direction. | |
| Propagator< D > const & | propagator (int directionId) const |
| Get a const Propagator for a specified direction. | |
| CField< D > & | cField () |
| Get the associated monomer concentration field. | |
| CField< D > const & | cField () const |
| Get the associated const monomer concentration field. | |
| double | kuhn () const |
| Get monomer statistical segment length. | |
| void | setId (int id) |
| Set the id for this block. | |
| void | setVertexIds (int vertexId0, int vertexId1) |
| Set indices of associated vertices. | |
| void | setMonomerId (int monomerId) |
| Set the monomer type id. | |
| 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. | |
| Public Member Functions inherited from Pscf::BlockTmpl< Propagator< D >, CField< D > > | |
| Propagator< D > & | propagator (int directionId) |
| Get a Propagator for a specified direction. | |
| Propagator< D > const & | propagator (int directionId) const |
| Get a const Propagator for a specified direction. | |
| CField< D > & | cField () |
| Get the associated monomer concentration field. | |
| CField< D > const & | cField () const |
| Get the associated const monomer concentration field. | |
| 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. | |
| virtual void | setNBead (int nBead) |
| Set the number of beads in this block (only valid for bead model). | |
| 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< Propagator< D >, CField< D > > | |
| BlockTmpl () | |
| Constructor. | |
| ~BlockTmpl ()=default | |
| Destructor. | |
Block within a linear or branched block polymer.
A Block has two Propagator<D> members, and a CField<D> concentration field.
Definition at line 58 of file cpc/solvers/Block.h.
| using Pscf::Cpc::Block< D >::Base = BlockTmpl< Propagator<D>, CField<D> > |
Base class.
Definition at line 66 of file cpc/solvers/Block.h.
| Pscf::Cpc::Block< D >::Block | ( | ) |
| Pscf::Cpc::Block< D >::~Block | ( | ) |
Destructor.
Definition at line 63 of file cpc/solvers/Block.tpp.
| void Pscf::Cpc::Block< D >::associate | ( | Mesh< D > const & | mesh, |
| FFT< D > const & | fft, | ||
| UnitCell< D > const & | cell, | ||
| WaveList< D > & | 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 meth |
| fft | FFT<D> object, Fast Fourier Transform |
| cell | UnitCell<D> object, crystallographic unit cell |
| wavelist | WaveList<D>, container for wavevector properties |
Definition at line 70 of file cpc/solvers/Block.tpp.
References UTIL_CHECK.
| void Pscf::Cpc::Block< D >::allocate | ( | double | ds | ) |
Allocate memory and set number of counter steps.
This function choses a value for the number ns of contour variable grid points for this block, and allocates memory for the associated propagators and several private arrays variables. Spatial grid dimensions are obtained from a pointers to the associated Mesh<D> object. The associate member function must be called before this function.
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.
For the bead model, if PolymerModel::isThread() is true, the value of ns is given by nBead + 2. The value of the input parameter ds is ignored for the bead model.
| ds | desired (optimal) value for contour length step |
Definition at line 91 of file cpc/solvers/Block.tpp.
References cField(), ds(), Pscf::PolymerModel::isBead(), Pscf::PolymerModel::isThread(), length(), nBead(), propagator(), and UTIL_CHECK.
| void Pscf::Cpc::Block< D >::clearUnitCellData | ( | ) |
Clear all internal data that depends on the unit cell parameters.
This function must be called once after every time the unit cell parameters change. The function marks all class member variables that depend on the unit cell parameters as being outdated. All such variables are then recomputed just before they are needed.
Definition at line 193 of file cpc/solvers/Block.tpp.
|
virtual |
Set or reset block length (only used in thread model).
Precondition: PolymerModel::isThread(). An Exception is thrown if this function is called when PolymerModel::isThread() is false.
| newLength | new block length |
Reimplemented from Pscf::Edge.
Definition at line 150 of file cpc/solvers/Block.tpp.
References Pscf::PolymerModel::isThread(), length(), propagator(), Pscf::Edge::setLength(), and UTIL_CHECK.
|
virtual |
Set or reset monomer statistical segment length.
| kuhn | new monomer statistical segment length. |
Reimplemented from Pscf::BlockTmpl< Propagator< D >, CField< D > >.
Definition at line 183 of file cpc/solvers/Block.tpp.
References kuhn(), and Pscf::BlockTmpl< Propagator< D >, CField< D > >::setKuhn().
| void Pscf::Cpc::Block< D >::setupSolver | ( | CField< D > const & | w | ) |
Set up the MDE solver for this block.
This should be called once after every change in w fields, 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 242 of file cpc/solvers/Block.tpp.
References Pscf::assignExp(), Pscf::inverse(), Pscf::PolymerModel::isBead(), Pscf::PolymerModel::isThread(), Pscf::mul(), and UTIL_CHECK.
| void Pscf::Cpc::Block< D >::stepThread | ( | CField< D > const & | qin, |
| CField< D > & | qout ) const |
Compute one step of solution of MDE for the thread 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 | input slice of q, from step i |
| qout | output slice of q, from step i+1 |
Definition at line 292 of file cpc/solvers/Block.tpp.
References Util::Array< Data >::capacity(), Pscf::Prdc::Cpu::FftwDArray< Data >::isAllocated(), Pscf::PolymerModel::isThread(), Pscf::mul(), Pscf::mulEq(), and UTIL_CHECK.
| void Pscf::Cpc::Block< D >::stepBead | ( | CField< D > const & | qin, |
| CField< D > & | 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 when the bead model is in use.
| qin | input slice of q, from step i |
| qout | output slice of q, for step i+1 |
Definition at line 376 of file cpc/solvers/Block.tpp.
References Pscf::PolymerModel::isBead(), stepBondBead(), stepFieldBead(), and UTIL_CHECK.
| void Pscf::Cpc::Block< D >::stepFieldBead | ( | CField< D > & | q | ) | const |
Apply the exponential field operator for the bead model.
This function applies exp( -w(r) ), where w(r) is the w-field for the monomer type of this block.
| q | slice of propagator q, modified in place |
Definition at line 438 of file cpc/solvers/Block.tpp.
References Util::Array< Data >::capacity(), Pscf::mulEq(), and UTIL_CHECK.
Referenced by stepBead().
| void Pscf::Cpc::Block< D >::stepBondBead | ( | CField< D > const & | qin, |
| CField< D > & | qout ) const |
Apply a bond operator for the bead model.
This function applies exp( nabla^2 b^2 / 6 ), where nabla^2 denotes a Laplacian operator with eigenvalues given by -G^2 for reciprocal lattice vectors.
| qin | input slice of q, from step i |
| qout | ouptut slice of q, for step i+1 |
Definition at line 387 of file cpc/solvers/Block.tpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
Referenced by stepBead().
| void Pscf::Cpc::Block< D >::stepHalfBondBead | ( | CField< D > const & | qin, |
| CField< D > & | qout ) const |
Apply a half-bond operator for the bead model.
This function applies exp( nabla^2 b^2 / 12 ), where nabla^2 denotes a Laplacian operator with eigenvalues given by -G^2 for reciprocal lattice vectors. It is used in the Propagator::solve function to deal with half-bonds at block ends.
| qin | input slice of q, from step i |
| qout | ouptut slice of q, for step i+1 |
Definition at line 412 of file cpc/solvers/Block.tpp.
References Util::Array< Data >::capacity(), and UTIL_CHECK.
| void Pscf::Cpc::Block< D >::computeConcentrationThread | ( | fftw_complex const & | prefactor | ) |
Compute the concentration for this block, for the thread model.
This function is called by Polymer::compute if a thread model is is used.
The "prefactor" parameter must equal \( \phi / (L_{tot} Q) \), where \( \phi \) is the species volume fraction, \( L_{tot} \) is the total length of all blocks in this polymer species and Q is the species partition function.
Upon return, grid point r of the array returned by the member function cField() contains the integal
\[ p \int_{0}^{l} ds q_{0}(r,s) q_{1}(r, L - s) \]
where \( q_{0}(r,s) \) and \( q_{1}(r,s) \) are propagators associated with different directions, \( p \) is the prefactor parameter, and the integral is taken over the length \( L \) of this block. Simpson's rule is used for the integral with respect to s.
| prefactor | constant multiplying integral over s |
Definition at line 458 of file cpc/solvers/Block.tpp.
References Pscf::addEq(), Pscf::assign(), cField(), Pscf::mul(), Pscf::mulEq(), propagator(), Pscf::Cpc::Propagator< D >::q(), and UTIL_CHECK.
| void Pscf::Cpc::Block< D >::computeConcentrationBead | ( | fftw_complex const & | 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_{tot} Q) \), where \( \phi \) is the species volume fraction, \( N_{tot} \) is the total number of beads in all blocks of the polymer, and \( Q \) is the species partition function.
Upon return, grid point r of the array returned by member function cField() contains the sum
\[ p \sum_{s} q_{0}(r,s) q_{1}(r, N-s) \exp(W(r)*ds) \]
where \( q_{0}(r,s) \) and \( q_{1}(r, N-s) \) denote complementary propagator slices associated with different directions but the same bead, and \( p \) is the prefactor parameter. The sum is taken over all beads in this block.
| prefactor | constant multiplying sum over beads |
Definition at line 547 of file cpc/solvers/Block.tpp.
References Pscf::addEq(), Pscf::assign(), cField(), Pscf::mul(), Pscf::mulEq(), propagator(), Pscf::Cpc::Propagator< D >::q(), and UTIL_CHECK.
|
inline |
Get contour length step size.
Definition at line 417 of file cpc/solvers/Block.h.
Referenced by allocate().
|
inline |
Get the number of contour grid points, including end points.
Thread mdoel: For the thread model, ns is always an odd number ns >= 3 chosen to give an even number ns - 1 of steps of with a step length ds = length/(ns - 1) as close as possible to the target value of ds passed to the allocate function.
Bead model: For the bead model, ns is equal to nBead + 2, so as to include slices for all beads and two attached phantom vertices. Beads are indexed 1, ..., ns - 2, vertices have indices 0 and ns - 1.
Definition at line 412 of file cpc/solvers/Block.h.
| Propagator< D > & Pscf::BlockTmpl< Propagator< D >, CField< D > >::propagator | ( | int | directionId | ) |
Get a Propagator for a specified direction.
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(), and setLength().
| Propagator< D > const & Pscf::BlockTmpl< Propagator< D >, CField< D > >::propagator | ( | int | directionId | ) | const |
Get a const Propagator for a specified direction.
See above for number conventions.
| directionId | integer index for direction (0 or 1) |
| CField< D > & Pscf::BlockTmpl< Propagator< D >, CField< D > >::cField | ( | ) |
Get the associated monomer concentration field.
Referenced by allocate(), computeConcentrationBead(), and computeConcentrationThread().
| CField< D > const & Pscf::BlockTmpl< Propagator< D >, CField< D > >::cField | ( | ) | const |
Get the associated const monomer concentration field.
| double Pscf::BlockTmpl< Propagator< D >, CField< D > >::kuhn | ( | ) | const |
Get monomer statistical segment length.
Referenced by setKuhn().
| void Pscf::Edge::setId | ( | int | id | ) |
| void Pscf::Edge::setVertexIds | ( | int | vertexId0, |
| int | vertexId1 ) |
Set indices of associated vertices.
| vertexId0 | integer id of vertex 0 |
| vertexId1 | integer id of vertex 1 |
Definition at line 104 of file Edge.cpp.
References Pscf::PolymerModel::isBead(), and Pscf::PolymerModel::isThread().
| void Pscf::Edge::setMonomerId | ( | int | monomerId | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the length of this block, in the thread model.
Precondition: PolymerModel::isThread()
Definition at line 171 of file Edge.h.
Referenced by allocate(), and setLength().
|
inline |
Get the number of beads in this block, in the bead model.
Precondition: PolymerModel::isBead()
Definition at line 178 of file Edge.h.
Referenced by allocate().