PSCF v1.3.2
rpg/scft/iterator/AmIteratorBasis.h
1#ifndef RPG_AM_ITERATOR_BASIS_H
2#define RPG_AM_ITERATOR_BASIS_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 "Iterator.h" // base class argument
12#include <pscf/iterator/AmIteratorDArray.h> // base class template
13#include <pscf/iterator/AmbdInteraction.h> // member variable
14#include <util/containers/DArray.h> // function argument
15#include <util/containers/RingBuffer.h> // function argument
16
17namespace Pscf {
18namespace Rpg {
19
20 // Forward declaration
21 template <int D> class System;
22
23 using namespace Util;
24
32 template <int D>
33 class AmIteratorBasis : public AmIteratorDArray< Iterator<D> >
34 {
35
36 public:
37
44
49
55 void readParameters(std::istream& in);
56
62 void outputTimers(std::ostream& out) const;
63
66
67 // Inherited public member functions
68 using AmTmpl::solve;
70 using Iterator<D>::isFlexible;
71 using Iterator<D>::flexibleParams;
72 using Iterator<D>::setFlexibleParams;
73 using Iterator<D>::nFlexibleParams;
74 using Iterator<D>::stress;
75
76 protected:
77
78 // Inherited protected members
79 using AmTmpl::verbose;
80 using AmTmpl::residual;
81 using Iterator<D>::system;
82 using Iterator<D>::isSymmetric_;
83 using Iterator<D>::isFlexible_;
84 using Iterator<D>::flexibleParams_;
88
94 void setup(bool isContinuation);
95
96 private:
97
99 AmbdInteraction interaction_;
100
102 double scaleStress_;
103
104 // Private virtual functions that interact with parent System.
105
109 int nElements() override;
110
114 bool hasInitialGuess() override;
115
121 void getCurrent(DArray<double>& curr) override;
122
126 void evaluate() override;
127
133 void getResidual(DArray<double>& resid) override;
134
140 void update(DArray<double>& newGuess) override;
141
145 void outputToLog() override;
146
147 #if 0
148 // Private virtual functions for vector math
149
156 void setEqual(DArray<double>& a,
157 DArray<double> const & b) override;
158
162 double dotProduct(DArray<double> const & a,
163 DArray<double> const & b) override;
164
168 double maxAbs(DArray<double> const & hist) override;
169
177 void subVV(DArray<double>& a,
178 DArray<double> const & b,
179 DArray<double> const & c) override;
180
188 void addEqVc(DArray<double>& a,
189 DArray<double> const & b, double c) override;
190 #endif
191
192
193 };
194
195 // Explicit instantiation declarations
196 extern template class AmIteratorBasis<1>;
197 extern template class AmIteratorBasis<2>;
198 extern template class AmIteratorBasis<3>;
199
200} // namespace Rpg
201} // namespace Pscf
202#endif
Template for Anderson mixing iterator algorithm.
Modified interaction to compute residual defn.
Anderson Mixing iterator with imposed space-group symmetry.
AmIteratorBasis(System< D > &system)
Constructor.
void readParameters(std::istream &in)
Read all parameters and initialize.
void outputTimers(std::ostream &out) const
Output timing results to log file.
void setup(bool isContinuation)
Setup iterator just before entering iteration loop.
AmIteratorTmpl< Iterator< D >, DArray< double > > AmTmpl
Alias for indirect base (grandparent) class.
Base class for iterative solvers for SCF equations.
Main class, representing a complete physical system.
Dynamically allocatable contiguous array template.
Definition DArray.h:32
FSArrayParam< Type, N > & readOptionalFSArray(std::istream &in, const char *label, FSArray< Type, N > &array, int size)
Add and read an optional FSArray < Type, N > array parameter.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
void readParamCompositeOptional(std::istream &in, ParamComposite &child, bool next=true)
Add and attempt to read an optional child ParamComposite.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.