11#include <pscf/chem/MixtureBase.h>
12#include <pscf/chem/SolventSpecies.h>
26 template <
typename WT>
28 : mixturePtr_(nullptr)
34 template <
typename WT>
42 template <
typename WT>
49 template <
typename WT>
59 template <
typename WT>
64 const int nMonomer =
mixture().nMonomer();
65 const int nPolymer =
mixture().nPolymer();
71 polymers_.allocate(nPolymer);
72 for (
int i = 0; i < nPolymer; ++i) {
73 polymers_[i].associate(
mixture().polymerSpecies(i));
74 polymers_[i].allocate(nMonomer);
81 template <
typename WT>
86 const int nMonomer =
mixture().nMonomer();
87 const int nPolymer =
mixture().nPolymer();
95 for (
int i = 0; i < nMonomer; ++i) {
96 kuhn[i] =
mixture().monomer(i).kuhn();
100 for (
int i = 0; i < nPolymer; ++i) {
101 polymers_[i].setup(kuhn);
109 template <
typename WT>
115 const double vMonomer =
mixture().vMonomer();
116 const int nPolymer =
mixture().nPolymer();
117 const int nSolvent =
mixture().nSolvent();
128 for (
int j = 0; j < nk; ++j){
129 correlations[j] = 0.0;
133 double phi, length, c;
138 for (ip = 0; ip < nPolymer; ip++){
143 length =
polymer.totalLength();
144 c = phi/(length*vMonomer);
149 nA =
polymer.blockIds(ma).size();
152 for (ia = 0; ia < nA; ++ia) {
154 polymer.computeOmega(ja, ja, c, kSq, correlations);
159 for (ia = 0; ia < nA; ++ia) {
161 for (ib = 0; ib < ia; ++ib) {
164 polymer.computeOmega(ja, jb, 2.0*c, kSq,
174 nA =
polymer.blockIds(ma).size();
175 nB =
polymer.blockIds(mb).size();
176 if (nA > 0 && nB > 0) {
177 for (ia = 0; ia < nA; ++ia) {
179 for (ib = 0; ib < nB; ++ib) {
182 polymer.computeOmega(ja, jb, c, kSq, correlations);
192 if (nSolvent > 0 and ma == mb) {
194 for (
int i = 0; i < nSolvent; i++) {
199 size = solvent.
size();
200 c = phi*size/vMonomer;
201 for (
int i = 0; i < nk; ++i) {
202 correlations[i] += c;
213 template <
typename WT>
218 const double vMonomer =
mixture().vMonomer();
219 const int nPolymer =
mixture().nPolymer();
220 const int nSolvent =
mixture().nSolvent();
230 for (
int j = 0; j < nk; ++j){
231 correlations[j] = 0.0;
235 double phi, totalLength, c;
236 for (
int ip = 0; ip < nPolymer; ip++){
239 totalLength =
polymer.totalLength();
240 c = phi/(totalLength*vMonomer);
241 polymer.computeOmegaTotal(c, kSq, correlations);
247 for (
int i = 0; i < nSolvent; i++){
251 size = solvent.
size();
252 c = phi*size/vMonomer;
253 for (
int j = 0; j < nk; ++j) {
254 correlations[j] += c;
void allocate()
Allocate private data structures, set immutable private data.
void setup()
Set mutable private data.
Mixture()
Default constructor.
void associate(MixtureBase< WT > const &mixture)
Create an association with a Mixture.
void computeOmegaTotal(Array< double > const &kSq, Array< double > &correlations) const
Compute total ideal gas density correlation functions.
MixtureBase< WT > const & mixture() const
Return reference to a descriptor for the associated mixture.
void computeOmega(int ma, int mb, Array< double > const &kSq, Array< double > &correlations) const
Compute ideal gas correlation functions for a monomer type pair.
Correlation::Polymer< RealT > const & polymer(int i) const
Intramolecular correlation analysis for one polymer Species.
Abstract descriptor for a mixture of polymer and solvent species.
Descriptor for a solvent species.
double size() const
Get the size (number of monomers) in this solvent.
int monomerId() const
Get the monomer type id.
WT phi() const
Get the overall volume fraction for this species.
Array container class template.
int capacity() const
Return allocated size.
Dynamically allocatable contiguous array template.
void allocate(int capacity)
Allocate the underlying C array.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Intramolecular correlations in homogeneous systems.
PSCF package top-level namespace.