PSCF v1.3
rpc/scft/sweep/Sweep.h
1#ifndef RPC_SWEEP_H
2#define RPC_SWEEP_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 <pscf/sweep/SweepTmpl.h> // base class template
12#include <rpc/scft/sweep/BasisFieldState.h> // base class template parameter
13#include "SweepParameter.h" // parameter class
14#include <util/global.h>
15
16namespace Pscf {
17namespace Rpc {
18
19 using namespace Util;
20
26 template <int D>
27 class Sweep : public SweepTmpl< BasisFieldState<D> >
28 {
29
30 public:
31
35 Sweep();
36
43
47 ~Sweep();
48
57
63 virtual void readParameters(std::istream& in);
64
65 // Public members inherited from base class template SweepTmpl
74
75 protected:
76
77 // Protected member functions
78
85
89 virtual void setup();
90
96 virtual void setParameters(double sNew) = 0;
97
107 virtual void extrapolate(double sNew);
108
116 virtual int solve(bool isContinuation);
117
124 virtual void reset();
125
133 virtual void getSolution();
134
138 virtual void cleanup();
139
144 { return (bool)(systemPtr_); }
145
150 {
151 UTIL_CHECK(systemPtr_);
152 return *systemPtr_;
153 }
154
155 // Protected variables writeCGrid_, writeCBasis_ and writeWGrid_
156 // control which converged fields will be written to files after
157 // solution of each SCFT solution within a sweep.
158
163
168
173
174 // Protected member variables inherited from base classes
180
181 private:
182
184 BasisFieldState<D> trial_;
185
187 FSArray<double, 6> unitCellParameters_;
188
190 std::ofstream logFile_;
191
193 System<D>* systemPtr_;
194
196 void outputSolution();
197
199 void outputSummary(std::ostream&);
200
201 };
202
203} // namespace Rpc
204} // namespace Pscf
205#endif
FieldState for fields in symmetry-adapted basis format.
virtual int solve(bool isContinuation)
Call current iterator to solve SCFT problem.
virtual void extrapolate(double sNew)
Create a guess for adjustable variables by continuation.
void setSystem(System< D > &system)
Set association with parent System.
Sweep()
Default Constructor.
virtual void getSolution()
Update state(0) and output data after successful convergence.
virtual void checkAllocation(BasisFieldState< D > &state)
Check allocation of fields in one state, allocate if necessary.
System< D > & system()
Return the parent system by reference.
virtual void reset()
Reset system to previous solution after iterature failure.
bool writeCRGrid_
Should concentration fields be written to file in r-grid format?
virtual void cleanup()
Cleanup operation at the beginning of a sweep.
bool writeCBasis_
Should concentration fields be written to file in basis format?
virtual void readParameters(std::istream &in)
Read parameters from param file.
virtual void setParameters(double sNew)=0
Set system parameters to new values.
bool writeWRGrid_
Should converged w fields be written to file in r-grid format?
bool hasSystem()
Does an association with the parent System exist?
virtual void setup()
Setup operation at the beginning of a sweep.
Main class, representing one complete system.
void addParameterTypes(GArray< ParameterType > paramTypes)
BasisFieldState< D > & state(int i)
Definition SweepTmpl.h:127
void addParameterType(std::string name, int nId, ParameterModifier &modifier)
A fixed capacity (static) contiguous array with a variable logical size.
Definition FSArray.h:38
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Definition param_pc.dox:1