PSCF v1.5.0
MixtureModifier.tpp
1#ifndef RP_MIXTURE_MODIFIER_TPP
2#define RP_MIXTURE_MODIFIER_TPP
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "MixtureModifier.h"
12#include <rp/solvers/Mixture.h>
13#include <rp/solvers/Polymer.h>
14#include <rp/solvers/Solvent.h>
15#include <rp/solvers/Block.h>
16#include <pscf/chem/Monomer.h>
17
18namespace Pscf {
19namespace Rp {
20
21 // Construction, destruction and initialization
22
23 /*
24 * Constructor
25 */
26 template <int D, class T>
28 : mixturePtr_(nullptr)
29 {}
30
31 /*
32 * Destructor
33 */
34 template <int D, class T>
37
38 /*
39 * Create an association with a mixture.
40 */
41 template <int D, class T>
43 {
44 UTIL_CHECK(!mixturePtr_);
45 mixturePtr_ = &mixture;
46 }
47
48 // Parameter Modifiers
49
50 /*
51 * Set statistical segment length for one monomer type.
52 */
53 template <int D, class T>
54 void MixtureModifier<D,T>::setKuhn(int monomerId, double kuhn)
55 { mixture().setKuhn(monomerId, kuhn); }
56
57 /*
58 * Set volume fraction for a polymer.
59 */
60 template <int D, class T>
62 double phi)
63 { mixture().polymer(polymerId).setPhi(phi); }
64
65 /*
66 * Set chemical potential for a polymer.
67 */
68 template <int D, class T>
70 double mu)
71 { mixture().polymer(polymerId).setMu(mu); }
72
73 /*
74 * Set the length of a polymer block.
75 */
76 template <int D, class T>
78 int blockId,
79 double length)
80 { mixture().polymer(polymerId).block(blockId).setLength(length); }
81
82 /*
83 * Set the volume fraction for a solvent.
84 */
85 template <int D, class T>
87 double phi)
88 { mixture().solvent(solventId).setPhi(phi); }
89
90 /*
91 * Set the chemical potential for a solvent species.
92 */
93 template <int D, class T>
95 double mu)
96 { mixture().solvent(solventId).setMu(mu); }
97
98 /*
99 * Set the size of solvent species.
100 */
101 template <int D, class T>
103 double size)
104 { mixture().solvent(solventId).setSize(size); }
105
106 /*
107 * Set the monomer reference volume for the mixture.
108 */
109 template <int D, class T>
111 { mixture().setVmonomer(vMonomer); }
112
113 // Other public non-const functions
114
115 /*
116 * Clear all data that depends on the unit cell parameters.
117 */
118 template <int D, class T>
120 { mixture().clearUnitCellData(); }
121
122 // Private member function
124 /*
125 * Get the associated mixture by reference
126 */
127 template <int D, class T>
128 Mixture<D,T>& MixtureModifier<D,T>::mixture()
129 {
130 UTIL_CHECK(mixturePtr_);
131 return *mixturePtr_;
132 }
133
134} // namespace Rp
135} // namespace Pscf
136#endif
void setMuPolymer(int polymerId, double mu)
Set the chemical for a polymer species.
void setPhiPolymer(int polymerId, double phi)
Set the volume fraction for a polymer species.
void associate(Mixture< D, T > &mixture)
Create associations with a Mixture.
void setKuhn(int monomerId, double kuhn)
Set the statistical segment length for one monomer type.
void setSolventSize(int solventId, double size)
Set the size (steric volume) for a solvent species.
void setBlockLength(int polymerId, int blockId, double length)
Set the length for a block of a block polymer.
void setPhiSolvent(int solventId, double phi)
Set the volume fraction for a solvent species.
void clearUnitCellData()
Clear all data that depends on the unit cell parameters.
void setMuSolvent(int solventId, double mu)
Set the chemical for a solvent species.
void setVMonomer(double vMonomer)
Set the monomer reference volume for the mixture.
Solver and descriptor for a mixture of polymers and solvents.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.