PSCF v1.3
rpc/solvers/Polymer.h
1#ifndef RPC_POLYMER_H
2#define RPC_POLYMER_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "Block.h" // base class template parameter
12#include <pscf/solvers/PolymerTmpl.h> // base class template
13#include <util/containers/FSArray.h> // member template
14
15// Forward declarations
16namespace Util {
17 template <typename T> class DArray;
18}
19namespace Pscf {
20 namespace Prdc {
21 namespace Cpu {
22 template <int D> class RField;
23 }
24 }
25}
26
27namespace Pscf {
28namespace Rpc {
29
30 using namespace Prdc;
31 using namespace Pscf::Prdc::Cpu;
32
53 template <int D>
54 class Polymer : public PolymerTmpl< Block<D> >
55 {
56
57 public:
58
59 // Public type name aliases
60
63
66
69
70 // Public member functions
71
75 Polymer();
76
80 ~Polymer();
81
87 void setNParams(int nParam);
88
96 void clearUnitCellData();
97
116 void compute(DArray< RField<D> > const & wFields,
117 double phiTot = 1.0);
118
128 void computeStress();
129
139 double stress(int n) const;
140
141 // Inherited public member functions
142
143 using Base::edge;
144 using Base::block;
145 using Base::propagator;
155 using Species::phi;
156 using Species::mu;
157 using Species::q;
158 using Species::ensemble;
159 using Species::setPhi;
160 using Species::setMu;
161
162 private:
163
165 FSArray<double, 6> stress_;
166
168 int nParam_;
169
170 // Restricting access to inherited functions
171 using Base::solve;
172 using Species::setQ;
173
174 };
175
177 template <int D>
178 inline double Polymer<D>::stress(int n) const
179 { return stress_[n]; }
180
181 #ifndef RPC_POLYMER_TPP
182 // Supress implicit instantiation
183 extern template class Polymer<1>;
184 extern template class Polymer<2>;
185 extern template class Polymer<3>;
186 #endif
187
188}
189}
190#endif
const Vertex & vertex(int id) const
Get a specified Vertex by const reference.
Pair< int > const & path(int is, int it) const
Get an id for a propagator from one vertex towards a target.
int nVertex() const
Number of vertices (junctions and chain ends).
int nPropagator() const
Number of propagators (2*nBlock).
int nBead() const
Total number of beads in the polymer (bead model).
int nBlock() const
Number of blocks.
double length() const
Sum of the lengths of all blocks in the polymer (thread model).
Pair< int > const & propagatorId(int id) const
Get a propagator identifier, indexed by order of computation.
PolymerType::Enum type() const
Get Polymer type (Branched or Linear)
PropagatorT & propagator(int blockId, int directionId)
virtual void solve(double phiTot=1.0)
Edge & edge(int id) final
Block< D > & block(int id)
Field of real double precision values on an FFT mesh.
Definition cpu/RField.h:29
Block within a linear or branched block polymer.
Propagator< D > PropagatorT
Propagator type.
Descriptor and solver for one polymer species.
double stress(int n) const
Get precomputed contribution to stress from this species.
PolymerTmpl< Block< D > > Base
Base class, partial template specialization.
void compute(DArray< RField< D > > const &wFields, double phiTot=1.0)
Compute solution to MDE and block concentrations.
Block< D > BlockT
Block type, for a block within a block polymer.
typename BlockT::PropagatorT PropagatorT
Propagator type, for one direction within a block.
void computeStress()
Compute SCFT stress contribution from this polymer species.
void clearUnitCellData()
Clear all data that depends on unit cell parameters.
void setNParams(int nParam)
Set the number of unit cell parameters.
double phi() const
Get the overall volume fraction for this species.
Definition Species.h:149
void setPhi(double phi)
Set value of phi (volume fraction), if ensemble is closed.
Definition Species.cpp:43
void setQ(double q)
Set q and compute phi or mu (depending on the ensemble).
Definition Species.cpp:63
double mu() const
Get the chemical potential for this species (units kT=1).
Definition Species.h:155
Ensemble ensemble() const
Get the statistical ensemble for this species (open or closed).
Definition Species.h:167
void setMu(double mu)
Set value of mu (chemical potential), if ensemble is closed.
Definition Species.cpp:54
double q() const
Get the molecular partition function for this species.
Definition Species.h:161
Dynamically allocatable contiguous array template.
Definition DArray.h:32
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
Fields and FFTs for periodic boundary conditions (CPU)
Definition CField.cpp:12
Periodic fields and crystallography.
Definition CField.cpp:11
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.