PSCF v1.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 <rpg/solvers/Block.h> // base class argument
13
14//#include <prdc/cuda/RField.h>
15#include <util/containers/FSArray.h>
16
17// Forward declarations
18namespace Util {
19 template <typename T> class DArray;
20}
21namespace Pscf {
22 namespace Prdc {
23 template <int D> class UnitCell;
24 namespace Cuda {
25 template <int D> class WaveList;
26 template <int D> class RField;
27 }
28 }
29}
30
31namespace Pscf {
32namespace Rpg {
33
34 using namespace Util;
35 using namespace Pscf::Prdc;
36 using namespace Pscf::Prdc::Cuda;
37
56 template <int D>
57 class Polymer : public PolymerTmpl< Block<D> >
58 {
59
60 public:
61
62 // Public type name aliases
63
66
69
72
73 // Public member functions
74
78 Polymer();
79
83 ~Polymer();
84
90 void setNParams(int nParams);
91
99 void clearUnitCellData();
100
119 void compute(DArray< RField<D> > const & wFields,
120 double phiTot = 1.0);
121
131 void computeStress();
132
142 double stress(int n);
143
144 // Inherited public member functions
145
146 using Base::edge;
147 using Base::block;
148 using Base::propagator;
158 using Species::phi;
159 using Species::mu;
160 using Species::q;
161 using Species::ensemble;
162 using Species::setPhi;
163 using Species::setMu;
164
165 private:
166
168 FSArray<double, 6> stress_;
169
171 int nParams_;
172
173 // Restrict access to inherited functions
174 using Base::solve;
175 using Species::setQ;
176
177 };
178
179 // Get stress component n.
180 template <int D>
181 double Polymer<D>::stress(int n)
182 { return stress_[n]; }
183
184 #ifndef RPG_POLYMER_TPP
185 // Suppress implicit instantiation
186 extern template class Polymer<1>;
187 extern template class Polymer<2>;
188 extern template class Polymer<3>;
189 #endif
190
191}
192}
193#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
Class to calculate and store properties of wavevectors.
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition UnitCell.h:56
Block within a branched polymer.
Propagator< D > PropagatorT
Propagator type.
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.
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.
typename BlockT::PropagatorT PropagatorT
Propagator type, for one direction within a block.
PolymerTmpl< Block< D > > Base
Base class, partial template specialization.
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 Reduce.cpp:14
Periodic fields and crystallography.
Definition CField.cpp:11
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.