PSCF v1.5.0
AmIteratorGrid.h
1#ifndef RP_AM_ITERATOR_GRID_H
2#define RP_AM_ITERATOR_GRID_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/iterator/AmIteratorTmpl.h> // base class template
12#include <rp/scft/iterator/Iterator.h> // base class argument
13#include <pscf/iterator/AmbdInteraction.h> // member
14#include <pscf/backend/BackendArray.h> // member
15#include <pscf/backend/TmplDeclare.h> // declaration macros
16
17#include <iostream>
18
19// Forward declaration
20namespace Pscf {
21 template <int D, class T> class RField;
22}
23
24namespace Pscf {
25namespace Rp {
26
27 using namespace Util;
28
44 template <int D, class T>
46 : public AmIteratorTmpl< Iterator<D,T>, BackendArray<typename T::Real, T> >
47 {
48
49 public:
50
57
61 virtual ~AmIteratorGrid();
62
68 void readParameters(std::istream& in) override;
69
75 void outputTimers(std::ostream& out) const override;
76
77 protected:
78
84 void setup(bool isContinuation) override;
85
88
91
92 // Inherited protected members
93 using Iterator<D,T>::system;
94 using Iterator<D,T>::flexibleParams_;
95
96 private:
97
99 AmbdInteraction interaction_;
100
102 double scaleStress_;
103
104 // Private overridden virtual functions
105
111 int nElements() override;
112
116 bool hasInitialGuess() override;
117
123 void getCurrent(VectorT& curr) override;
124
131 void evaluate() override;
132
138 void getResidual(VectorT& resid) override;
139
145 void update(VectorT& newGuess) override;
146
150 void outputToLog() override;
151
152 // Private type aliases
153 using RealT = double;
154 using RFieldT = RField<D,T>;
155
156 };
157
158 // Explicit instantiation declarations
159 PSCF_TMPL_DECLARE(AmIteratorGrid)
160
161} // namespace Rp
162} // namespace Pscf
163#endif
Modified interaction to compute residual defn.
Anderson mixing iterator on grid (no space-group symmetry).
void readParameters(std::istream &in) override
Read all parameters and initialize.
BackendArray< typename T::Real, T > VectorT
Alias for type of state and residual vectors.
void outputTimers(std::ostream &out) const override
Output timing results to log file.
AmIteratorTmpl< Iterator< D, T >, VectorT > AmIterTmplT
Alias for base class.
AmIteratorGrid(System< D, T > &system)
Constructor.
void setup(bool isContinuation) override
Setup iterator just before entering iteration loop.
Base class template for iterative solvers for SCF equations.
Base class template for classes that represent a complete system.
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.