PSCF v1.4.0
FhMolecule.h
1#ifndef PSCF_FH_MOLECULE_H
2#define PSCF_FH_MOLECULE_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 <util/param/ParamComposite.h> // base class
12
13#include <pscf/floryHuggins/FhClump.h> // member
14#include <util/containers/Pair.h> // member
15#include <util/containers/DArray.h> // member
16
17namespace Pscf {
18
19 using namespace Util;
20
36 {
37
38 public:
39
43 FhMolecule();
44
49
57 virtual void readParameters(std::istream& in);
58
66 void setNClump(int nClump);
67
71 void computeSize();
72
74
75
81 FhClump& clump(int id);
82
88 FhClump const & clump(int id) const;
89
93 int nClump() const;
94
98 double size() const;
99
101
102 private:
103
105 DArray<FhClump> clumps_;
106
108 int nClump_;
109
111 double size_;
112
114 bool hasSize_;
115
116 };
117
118 /*
119 * Number of clumps.
120 */
121 inline
123 { return nClump_; }
124
125 /*
126 * Total size of all clumps = volume / reference volume
127 */
128 inline
129 double FhMolecule::size() const
130 {
131 UTIL_CHECK(hasSize_);
132 return size_;
133 }
134
135 /*
136 * Get a specified FhClump (non-constant reference)
137 */
138 inline
140 { return clumps_[id]; }
141
142 /*
143 * Get a specified FhClump (constant reference)
144 */
145 inline
146 const FhClump& FhMolecule::clump(int id) const
147 { return clumps_[id]; }
148
149}
150#endif
Sub-unit of a molecule in Flory-Huggins theory.
Definition FhClump.h:36
FhMolecule()
Constructor.
void setNClump(int nClump)
Set the number of clumps, and allocate memory.
double size() const
Total molecule size = volume / reference volume.
Definition FhMolecule.h:129
FhClump & clump(int id)
Get a specified FhClump.
Definition FhMolecule.h:139
void computeSize()
Compute total molecule size by adding clump sizes.
virtual void readParameters(std::istream &in)
Read and initialize.
int nClump() const
Number of monomer clumps (monomer types).
Definition FhMolecule.h:122
~FhMolecule()
Destructor.
Dynamically allocatable contiguous array template.
Definition DArray.h:32
An object that can read multiple parameters from file.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
PSCF package top-level namespace.