PSCF v1.3.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 <pscf/solvers/PolymerTmpl.h> // base class template
12#include <util/containers/FSArray.h> // member template
13
14// Forward declarations
15namespace Util {
16 template <typename T> class DArray;
17}
18namespace Pscf {
19 namespace Rpc {
20 template <int D> class Block;
21 template <int D> class Propagator;
22 }
23 namespace Prdc {
24 namespace Cpu {
25 template <int D> class RField;
26 }
27 }
28 extern template class PolymerTmpl< Rpc::Block<1>, Rpc::Propagator<1> >;
29 extern template class PolymerTmpl< Rpc::Block<2>, Rpc::Propagator<2> >;
30 extern template class PolymerTmpl< Rpc::Block<3>, Rpc::Propagator<3> >;
31}
32
33namespace Pscf {
34namespace Rpc {
35
36 using namespace Prdc;
37 using namespace Pscf::Prdc::Cpu;
38
59 template <int D>
60 class Polymer : public PolymerTmpl< Block<D>, Propagator<D> >
61 {
62
63 public:
64
65 // Public type name aliases
66
69
72
75
76 // Public member functions
77
81 Polymer();
82
86 ~Polymer();
87
93 void setNParams(int nParam);
94
102 void clearUnitCellData();
103
122 void compute(DArray< RField<D> > const & wFields,
123 double phiTot = 1.0);
124
134 void computeStress();
135
145 double stress(int n) const;
146
147 // Inherited public member functions
148
149 using Base::edge;
150 using Base::block;
151 using Base::propagator;
161 using Species::phi;
162 using Species::mu;
163 using Species::q;
164 using Species::ensemble;
165 using Species::setPhi;
166 using Species::setMu;
167
168 private:
169
171 FSArray<double, 6> stress_;
172
174 int nParam_;
175
176 // Restricting access to inherited functions
177 using Base::solve;
178 using Species::setQ;
179
180 };
181
183 template <int D>
184 inline double Polymer<D>::stress(int n) const
185 { return stress_[n]; }
186
187 // Explicit instantiation declarations
188 extern template class Polymer<1>;
189 extern template class Polymer<2>;
190 extern template class Polymer<3>;
191
192}
193}
194#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)
Template for an MDE solver and descriptor for a block polymer.
Definition PolymerTmpl.h:45
virtual void solve(double phiTot=1.0)
Propagator< D > & propagator(int blockId, int directionId)
Field of real double precision values on an FFT mesh.
Definition cpu/RField.h:29
Block within a linear or branched block polymer.
Descriptor and solver for one polymer species.
Propagator< D > PropagatorT
Propagator type, for one direction within a block.
double stress(int n) const
Get precomputed contribution to stress from this species.
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.
PolymerTmpl< Block< D >, Propagator< D > > Base
Base class, partial template specialization.
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.
MDE solver for one direction of one block.
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.
Utility classes for scientific computation.