PSCF v1.3.3
rpg/solvers/Polymer.h
1#ifndef RPG_POLYMER_H
2#define RPG_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 Prdc {
20 namespace Cuda {
21 template <int D> class RField;
22 }
23 }
24 namespace Rpg {
25 template <int D> class Block;
26 template <int D> class Propagator;
27 }
28}
29
30// Explicit instantiation declarations for base classes
31namespace Pscf {
32 extern template class PolymerTmpl< Rpg::Block<1>, Rpg::Propagator<1> >;
33 extern template class PolymerTmpl< Rpg::Block<2>, Rpg::Propagator<2> >;
34 extern template class PolymerTmpl< Rpg::Block<3>, Rpg::Propagator<3> >;
35}
36
37namespace Pscf {
38namespace Rpg {
39
40 using namespace Util;
41 using namespace Pscf::Prdc;
42 using namespace Pscf::Prdc::Cuda;
43
63 template <int D>
64 class Polymer : public PolymerTmpl< Block<D>, Propagator<D> >
65 {
66
67 public:
68
69 // Public type name aliases
70
73
76
79
80 // Public member functions
81
85 Polymer();
86
90 ~Polymer();
91
97 void setNParams(int nParams);
98
106 void clearUnitCellData();
107
126 void compute(DArray< RField<D> > const & wFields,
127 double phiTot = 1.0);
128
138 void computeStress();
139
149 double stress(int n);
150
151 // Inherited public member functions
152
153 using Base::edge;
154 using Base::block;
155 using Base::propagator;
165 using Species::phi;
166 using Species::mu;
167 using Species::q;
168 using Species::ensemble;
169 using Species::setPhi;
170 using Species::setMu;
171
172 private:
173
175 FSArray<double, 6> stress_;
176
178 int nParam_;
179
180 // Restrict access to inherited functions
181 using Base::solve;
182 using Species::setQ;
183
184 };
185
186 // Get stress component n.
187 template <int D> inline
188 double Polymer<D>::stress(int n)
189 { return stress_[n]; }
190
191 // Explicit instantiation declarations
192 extern template class Polymer<1>;
193 extern template class Polymer<2>;
194 extern template class Polymer<3>;
195
196}
197}
198#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 branched polymer.
Descriptor and solver for one polymer species.
void computeStress()
Compute SCFT stress contribution from this polymer species.
void compute(DArray< RField< D > > const &wFields, double phiTot=1.0)
Compute MDE solutions and block concentrations.
void clearUnitCellData()
Clear all data that depends on unit cell parameters.
Propagator< D > PropagatorT
Propagator type, for one direction within a block.
void setNParams(int nParams)
Set the number of unit cell parameters.
Block< D > BlockT
Block type, for a block within a block polymer.
double stress(int n)
Get derivative of free energy w/ respect to a unit cell parameter.
PolymerTmpl< Block< D >, Propagator< D > > Base
Base class, partial template specialization.
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, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition CField.cu:12
Periodic fields and crystallography.
Definition CField.cpp:11
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
Utility classes for scientific computation.