PSCF v1.1
AmbdInteraction.h
1#ifndef PSCF_AMBD_INTERACTION_H
2#define PSCF_AMBD_INTERACTION_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 <pscf/inter/Interaction.h> // base class
12#include <util/containers/Array.h> // argument (template)
13#include <util/containers/Matrix.h> // argument (template)
14#include <util/global.h>
15
16namespace Pscf {
17
18 using namespace Util;
19
40 {
41
42 public:
43
48
52 virtual ~AmbdInteraction();
53
59 void setNMonomer(int nMonomer);
60
66 void update(Interaction const & interaction);
67
74 double chi(int i, int j) const;
75
82 double chiInverse(int i, int j) const;
83
99 double p(int i, int j) const;
100
104 double sumChiInverse() const;
105
109 int nMonomer() const;
110
111 private:
112
113 // Symmetric matrix of interaction parameters (local copy).
114 DMatrix<double> chi_;
115
116 // Inverse of matrix chi_.
117 DMatrix<double> chiInverse_;
118
119 // Idempotent matrix P used in residual definition.
121
122 // Sum of elements of matrix chiInverse_
123 double sumChiInverse_;
124
126 int nMonomer_;
127
129 bool isAllocated_;
130
131 };
132
133 // Inline function
134
135 inline int AmbdInteraction::nMonomer() const
136 { return nMonomer_; }
137
138 inline double AmbdInteraction::chi(int i, int j) const
139 { return chi_(i, j); }
140
141 inline double AmbdInteraction::chiInverse(int i, int j) const
142 { return chiInverse_(i, j); }
143
144 inline double AmbdInteraction::p(int i, int j) const
145 { return p_(i, j); }
146
147 inline double AmbdInteraction::sumChiInverse() const
148 { return sumChiInverse_; }
149
150} // namespace Pscf
151#endif
Modified interaction to compute residual defn.
double chiInverse(int i, int j) const
Return one element of the inverse chi matrix.
double chi(int i, int j) const
Return one element of the chi matrix.
int nMonomer() const
Get number of monomer types.
double sumChiInverse() const
Return sum of elements of the inverse chi matrix.
AmbdInteraction()
Constructor.
void setNMonomer(int nMonomer)
Set number of monomers and allocate required memory.
void update(Interaction const &interaction)
Update all computed quantities.
virtual ~AmbdInteraction()
Destructor.
double p(int i, int j) const
Return one element of the potent matrix P.
Flory-Huggins excess free energy model.
Definition: Interaction.h:26
Dynamically allocated Matrix.
Definition: DMatrix.h:25
File containing preprocessor macros for error handling.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1