PSCF v1.3.2
rpc/scft/iterator/AmIteratorBasis.h
1#ifndef RPC_AM_ITERATOR_BASIS_H
2#define RPC_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
14
15// Forward declarations
16namespace Util {
17 template <typename T> class DArray;
18}
19namespace Pscf {
20 namespace Rpc {
21 template <int D> class System;
22 }
23}
24
25namespace Pscf {
26namespace Rpc {
27
28 using namespace Util;
29
38 template <int D>
39 class AmIteratorBasis : public AmIteratorDArray< Iterator<D> >
40 {
41
42 public:
43
50
55
61 void readParameters(std::istream& in) override;
62
68 void outputTimers(std::ostream& out) const override;
69
72
73 // Inherited public member functions
74 using Iterator<D>::isFlexible;
75 using Iterator<D>::flexibleParams;
76 using Iterator<D>::setFlexibleParams;
77 using Iterator<D>::nFlexibleParams;
78 using Iterator<D>::stress;
79
80 protected:
81
82 // Inherited protected members
83 using AmTmpl::verbose;
84 using AmTmpl::residual;
85 using Iterator<D>::system;
86 using Iterator<D>::isSymmetric_;
87 using Iterator<D>::isFlexible_;
88 using Iterator<D>::flexibleParams_;
92
98 void setup(bool isContinuation) override;
99
100 private:
101
103 AmbdInteraction interaction_;
104
106 double scaleStress_;
107
108 // Private virtual functions that interact with parent system
109
113 bool hasInitialGuess() override;
114
120 int nElements() override;
121
127 void getCurrent(DArray<double>& curr) override;
128
135 void evaluate() override;
136
142 void getResidual(DArray<double>& resid) override;
143
149 void update(DArray<double>& newGuess) override;
150
154 void outputToLog() override;
155
156 };
157
158 // Explicit instantiation declarations
159 extern template class AmIteratorBasis<1>;
160 extern template class AmIteratorBasis<2>;
161 extern template class AmIteratorBasis<3>;
162
163} // namespace Rpc
164} // namespace Pscf
165#endif
Template for Anderson mixing iterator algorithm.
Modified interaction to compute residual defn.
Anderson Mixing iterator with imposed space-group symmetry.
void readParameters(std::istream &in) override
Read all parameters and initialize.
AmIteratorTmpl< Iterator< D >, DArray< double > > AmTmpl
Alias for indirect base (grandparent) class.
void outputTimers(std::ostream &out) const override
Output timing results to log file.
AmIteratorBasis(System< D > &system)
Constructor.
void setup(bool isContinuation) override
Setup iterator just before entering iteration loop.
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.
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Utility classes for scientific computation.