11#include <pscf/chem/Composition.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>
65 const int nMonomer =
mixture().nMonomer();
66 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++){
144 c = phi/(length*vMonomer);
152 for (ia = 0; ia < nA; ++ia) {
159 for (ia = 0; ia < nA; ++ia) {
161 for (ib = 0; ib < ia; ++ib) {
176 if (nA > 0 && nB > 0) {
177 for (ia = 0; ia < nA; ++ia) {
179 for (ib = 0; ib < nB; ++ib) {
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++){
240 c = phi/(totalLength*vMonomer);
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;
Descriptor for a mixture of polymer and solvent species.
void allocate()
Allocate private data structures, set immutable private data.
void setup()
Set mutable private data.
void associate(Composition< WT > const &mixture)
Create an association with a Mixture.
Mixture()
Default constructor.
void computeOmegaTotal(Array< double > const &kSq, Array< double > &correlations) const
Compute total ideal gas density correlation functions.
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
Composition< WT > const & mixture() const
Return reference to a descriptor for the associated mixture.
Intramolecular correlation analysis for one polymer Species.
double computeOmega(int ia, int ib, double prefactor, double kSq) const
Compute intramolecular correlation function for a pair of blocks.
double phi() const
Return the volume fraction of this polymer species.
double totalLength() const
Return the sum of lengths of all blocks in this polymer species.
void computeOmegaTotal(double prefactor, Array< double > const &kSq, Array< double > &correlations) const
Compute total intramolecular correlation function.
GArray< int > const & blockIds(int i) const
Get a GArray of block ids for all blocks of one monomer type.
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.
int size() const
Return the logical size of this array (number of elements).
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.