PSCF v1.1
Molecule.h
1#ifndef PSCF_HOMOGENEOUS_MOLECULE_H
2#define PSCF_HOMOGENEOUS_MOLECULE_H
3
4/*
5* PSCF - Polymer Self-Consistent Field Theory
6*
7* Copyright 2016 - 2022, 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/homogeneous/Clump.h> // member template argument
14#include <util/containers/Pair.h> // member template
15#include <util/containers/DArray.h> // member template
16
17#include <cmath>
18
19namespace Pscf {
20 namespace Homogeneous {
21
22 using namespace Util;
23
39 {
40
41 public:
42
46 Molecule();
47
51 ~Molecule();
52
60 virtual void readParameters(std::istream& in);
61
69 void setNClump(int nClump);
70
74 void computeSize();
75
77
78
84 Clump& clump(int id);
85
91 Clump const & clump(int id) const;
92
96 int nClump() const;
97
101 double size() const;
102
104
105 private:
106
108 DArray<Clump> clumps_;
109
111 int nClump_;
112
114 double size_;
115
117 bool hasSize_;
118
119 };
120
121 }
122
123 /*
124 * Number of clumps.
125 */
127 { return nClump_; }
128
129 /*
130 * Total size of all clumps = volume / reference volume
131 */
132 inline double Homogeneous::Molecule::size() const
133 {
134 UTIL_CHECK(hasSize_);
135 return size_;
136 }
137
138 /*
139 * Get a specified Clump (non-constant reference)
140 */
142 { return clumps_[id]; }
143
144 /*
145 * Get a specified Clump (constant reference)
146 */
148 { return clumps_[id]; }
149
150}
151#endif
Collection of all monomers of a single type in a molecule.
Definition: Clump.h:36
Descriptor of a molecular species in a homogeneous mixture.
Definition: Molecule.h:39
int nClump() const
Number of monomer clumps (monomer types).
Definition: Molecule.h:126
Clump & clump(int id)
Get a specified Clump.
Definition: Molecule.h:141
void setNClump(int nClump)
Set the number of clumps, and allocate memory.
Definition: Molecule.cpp:47
void computeSize()
Compute total molecule size by adding clump sizes.
Definition: Molecule.cpp:58
virtual void readParameters(std::istream &in)
Read and initialize.
Definition: Molecule.cpp:31
double size() const
Total molecule size = volume / reference volume.
Definition: Molecule.h:132
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
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1