1#ifndef PSCF_MIXTURE_TMPL_H
2#define PSCF_MIXTURE_TMPL_H
11#include <pscf/chem/Monomer.h>
12#include <util/param/ParamComposite.h>
13#include <util/containers/DArray.h>
25 template <
class TP,
class TS>
200 template <
class TP,
class TS>
202 {
return nMonomer_; }
204 template <
class TP,
class TS>
206 {
return nPolymer_; }
208 template <
class TP,
class TS>
210 {
return nSolvent_; }
212 template <
class TP,
class TS>
216 template <
class TP,
class TS>
220 return monomers_[id];
223 template <
class TP,
class TS>
227 return monomers_[id];
230 template <
class TP,
class TS>
234 return polymers_[id];
237 template <
class TP,
class TS>
241 return polymers_[id];
244 template <
class TP,
class TS>
248 return solvents_[id];
251 template <
class TP,
class TS>
255 return solvents_[id];
258 template <
class TP,
class TS>
260 {
return vMonomer_; }
262 template <
class TP,
class TS>
264 { vMonomer_ = vMonomer; }
271 template <
class TP,
class TS>
287 template <
class TP,
class TS>
294 template <
class TP,
class TS>
298 read<int>(in,
"nMonomer", nMonomer_);
299 monomers_.allocate(nMonomer_);
300 for (
int i = 0; i < nMonomer_; ++i) {
301 monomers_[i].setId(i);
303 readDArray< Monomer >(in,
"monomers", monomers_, nMonomer_);
313 read<int>(in,
"nPolymer", nPolymer_);
318 readOptional<int>(in,
"nSolvent", nSolvent_);
324 polymers_.allocate(nPolymer_);
325 for (
int i = 0; i < nPolymer_; ++i) {
326 readParamComposite(in, polymer(i));
327 nBlock_ = nBlock_ + polymer(i).nBlock();
333 for (
int i = 0; i < nPolymer_; ++i) {
334 for (
int j = 0; j < polymer(i).nBlock(); ++j) {
335 monomerId = polymer(i).block(j).monomerId();
336 kuhn = monomer(monomerId).kuhn();
337 polymer(i).block(j).setKuhn(kuhn);
346 solvents_.allocate(nSolvent_);
347 for (
int i = 0; i < nSolvent_; ++i) {
348 readParamComposite(in, solvent(i));
355 readOptional(in,
"vMonomer", vMonomer_);
A mixture of polymer and solvent species.
MixtureTmpl()
Constructor.
Polymer & polymer(int id)
Get a polymer object.
TS Solvent
Solvent species solver typename.
int nBlock() const
Get number of total blocks in the mixture across all polymers.
int nSolvent() const
Get number of solvent (point particle) species.
Solvent const & solvent(int id) const
Set a solvent solver object.
double vMonomer() const
Get monomer reference volume (set to 1.0 by default).
Polymer const & polymer(int id) const
Get a polymer object by const reference.
Monomer & monomer(int id)
Get a Monomer type descriptor (non-const reference).
void setVmonomer(double vMonomer)
Set value of monomer reference volume.
int nMonomer() const
Get number of monomer types.
~MixtureTmpl()
Destructor.
Monomer const & monomer(int id) const
Get a Monomer type descriptor (const reference).
Solvent & solvent(int id)
Set a solvent solver object.
TP Polymer
Polymer species solver typename.
virtual void readParameters(std::istream &in)
Read parameters from file and initialize.
int nPolymer() const
Get number of polymer species.
Descriptor for a monomer type.
Dynamically allocatable contiguous array template.
An object that can read multiple parameters from file.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
PSCF package top-level namespace.
Utility classes for scientific computation.