PSCF v1.4.0
Interaction.h
1#ifndef CPC_INTERACTION_H
2#define CPC_INTERACTION_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#include <util/containers/Matrix.h> // argument (template)
13
14namespace Pscf {
15
16 using namespace Util;
17
24 {
25
26 public:
27
41 Interaction(bool isCompressible = false);
42
46 virtual ~Interaction();
47
48 // Modifiers
49
55 void setNMonomer(int nMonomer);
56
64 virtual void readParameters(std::istream& in);
65
76 void setChi(int i, int j, double chi);
77
78 // Accessors
79
83 int nMonomer() const;
84
88 DMatrix<double> const & chi() const;
89
96 double chi(int i, int j) const;
97
101 double zeta() const;
102
113 bool isCompressible() const;
114
115 private:
116
117 // Symmetric matrix of interaction parameters.
118 DMatrix<double> chi_;
119
120 // Dimensionless compression modulus (a la Helfand)
121 double zeta_;
122
123 // Number of monomers.
124 int nMonomer_;
125
126 // Is the model compressible (does it allow a finite zeta value)?
127 bool isCompressible_;
128
129 // Has the object been initialized via readParameters?
130 bool isInitialized_;
131
133 void setChiZero();
134
135 };
136
137 // Inline functions
138
139 /*
140 * Return the number of monomer types.
141 */
142 inline int Interaction::nMonomer() const
143 { return nMonomer_; }
144
145 /*
146 * Return the entire chi matrix by const reference.
147 */
148 inline DMatrix<double> const & Interaction::chi() const
149 { return chi_; }
150
151 /*
152 * Return one element of the chi matrix.
153 */
154 inline double Interaction::chi(int i, int j) const
155 { return chi_(i, j); }
156
157 /*
158 * Return the dimensionless compression modulus, zeta.
159 */
160 inline double Interaction::zeta() const
161 { return zeta_; }
162
163 /*
164 * Is this model compressible?
165 */
166 inline bool Interaction::isCompressible() const
167 { return isCompressible_; }
168
169} // namespace Pscf
170#endif
Interaction(bool isCompressible=false)
Constructor.
virtual void readParameters(std::istream &in)
Read model parameters.
DMatrix< double > const & chi() const
Return the chi matrix by const reference.
void setChi(int i, int j, double chi)
Change one element of the chi matrix.
void setNMonomer(int nMonomer)
Set the number of monomer types.
double zeta() const
Return the dimensionless compression modulus.
virtual ~Interaction()
Destructor.
int nMonomer() const
Get number of monomer types.
bool isCompressible() const
Is the system compressible?
Dynamically allocated Matrix.
Definition DMatrix.h:25
ParamComposite()
Constructor.
PSCF package top-level namespace.