PSCF v1.4.0
FhInteraction.h
1#ifndef PSCF_FH_INTERACTION_H
2#define PSCF_FH_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/DMatrix.h> // member (template)
13#include <util/containers/Matrix.h> // argument (template)
14#include <util/containers/Array.h> // argument (template)
15#include <util/global.h>
16
17// Forward declaration
18namespace Pscf {
19 class Interaction;
20}
21
22namespace Pscf {
23
24 using namespace Util;
25
32 {
33
34 public:
35
40
44 FhInteraction(FhInteraction const & other);
45
49 FhInteraction(Interaction const & other);
50
54 virtual ~FhInteraction();
55
62
69
75 void setNMonomer(int nMonomer);
76
82 virtual void readParameters(std::istream& in);
83
95 void setChi(Matrix<double> const & chi);
96
104 void setChi(int i, int j, double chi);
105
111 virtual
112 double fHelmholtz(Array<double> const & c) const;
113
120 virtual
121 void computeW(Array<double> const & c, Array<double>& w)
122 const;
123
131 virtual
132 void computeC(Array<double> const & w, Array<double>& c, double& xi)
133 const;
134
141 virtual
142 void computeXi(Array<double> const & w, double& xi)
143 const;
144
157 virtual
158 void computeDwDc(Array<double> const & c, Matrix<double>& dWdC)
159 const;
160
164 Matrix<double> const & chi() const;
165
172 double chi(int i, int j) const;
173
180 double chiInverse(int i, int j) const;
181
185 int nMonomer() const;
186
187 private:
188
189 // Symmetric matrix of interaction parameters.
190 DMatrix<double> chi_;
191
192 // Inverse of matrix chi_.
193 DMatrix<double> chiInverse_;
194
196 int nMonomer_;
197
202 void updateMembers();
203
204 void setChiZero();
205
206 };
207
208 // Inline function
209
210 inline int FhInteraction::nMonomer() const
211 { return nMonomer_; }
212
213 inline Matrix<double> const & FhInteraction::chi() const
214 { return chi_; }
215
216 inline double FhInteraction::chi(int i, int j) const
217 { return chi_(i, j); }
218
219 inline double FhInteraction::chiInverse(int i, int j) const
220 { return chiInverse_(i, j); }
221
222} // namespace Pscf
223#endif
void setNMonomer(int nMonomer)
Set the number of monomer types.
virtual void computeC(Array< double > const &w, Array< double > &c, double &xi) const
Compute concentration from chemical potential fields.
virtual void computeW(Array< double > const &c, Array< double > &w) const
Compute chemical potential from concentration.
virtual void computeXi(Array< double > const &w, double &xi) const
Compute Langrange multiplier xi from chemical potential fields.
FhInteraction & operator=(FhInteraction const &other)
Assignment.
virtual void readParameters(std::istream &in)
Read chi parameters.
int nMonomer() const
Get number of monomer types.
FhInteraction()
Constructor.
Matrix< double > const & chi() const
Return the chi matrix by const reference.
virtual void computeDwDc(Array< double > const &c, Matrix< double > &dWdC) const
Compute second derivatives of free energy.
virtual double fHelmholtz(Array< double > const &c) const
Compute excess Helmholtz free energy per monomer.
virtual ~FhInteraction()
Destructor.
double chiInverse(int i, int j) const
Return one element of the inverse chi matrix.
void setChi(Matrix< double > const &chi)
Assign values for all elements of the chi matrix.
Interaction model for complex Langevin FTS.
Definition Interaction.h:24
Array container class template.
Definition Array.h:40
Dynamically allocated Matrix.
Definition DMatrix.h:25
Two-dimensional array container template (abstract).
Definition Matrix.h:32
ParamComposite()
Constructor.
File containing preprocessor macros for error handling.
PSCF package top-level namespace.