PSCF v1.1
pspc/sweep/Sweep.h
1#ifndef PSPC_SWEEP_H
2#define PSPC_SWEEP_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/sweep/SweepTmpl.h> // base class template
12#include <pspc/sweep/BasisFieldState.h> // base class template parameter
13#include "SweepParameter.h" // parameter class
14#include <util/global.h>
15
16namespace Pscf {
17namespace Pspc {
18
19 using namespace Util;
20
24 template <int D>
25 class Sweep : public SweepTmpl< BasisFieldState<D> >
26 {
27
28 public:
29
33 Sweep();
34
39
43 ~Sweep();
44
49
55 virtual void readParameters(std::istream& in);
56
57 // Public members inherited from base class template SweepTmpl
64
65 protected:
66
73
77 virtual void setup();
78
84 virtual void setParameters(double sNew) = 0;
85
91 virtual void extrapolate(double sNew);
92
98 virtual int solve(bool isContinuation);
99
106 virtual void reset();
107
115 virtual void getSolution();
116
120 virtual void cleanup();
121
126 { return (systemPtr_ != 0); }
127
132 { return *systemPtr_; }
133
136
139
142
143 // Protected members inherited from base classes
149
150 private:
151
153 BasisFieldState<D> trial_;
154
156 FSArray<double, 6> unitCellParameters_;
157
159 std::ofstream logFile_;
160
162 System<D>* systemPtr_;
163
165 void outputSolution();
166
168 void outputSummary(std::ostream&);
169
170 };
171
172} // namespace Pspc
173} // namespace Pscf
174#endif
FieldState for fields in symmetry-adapted basis format.
Solve a sequence of problems along a line in parameter space.
bool writeWRGrid_
Whether to write real space potential field files.
virtual void setup()
Setup operation at the beginning of a sweep.
bool writeCRGrid_
Whether to write real space concentration field files.
virtual int solve(bool isContinuation)
Call current iterator to solve SCFT problem.
bool writeCBasis_
Whether to write concentration field files in basis format.
void setSystem(System< D > &system)
Set association with parent System.
bool hasSystem()
Has an association with the parent System been set?
virtual void setParameters(double sNew)=0
Set non-adjustable system parameters to new values.
virtual void extrapolate(double sNew)
Create a guess for adjustable variables by continuation.
Sweep()
Default Constructor.
virtual void cleanup()
Cleanup operation at the beginning of a sweep.
virtual void reset()
Reset system to previous solution after iterature failure.
virtual void checkAllocation(BasisFieldState< D > &state)
Check allocation state of fields in one state, allocate if necessary.
virtual void getSolution()
Update state(0) and output data after successful convergence.
virtual void readParameters(std::istream &in)
Read parameters from param file.
System< D > & system()
Return the parent system by reference.
Main class for SCFT simulation of one system.
Definition: pspc/System.h:76
Solve a sequence of problems along a path through parameter space.
Definition: SweepTmpl.h:24
int historySize() const
Get the current number of stored previous states.
Definition: SweepTmpl.h:125
BasisFieldState< D > & state(int i)
Get reference to a stored state, with i=0 being most recent.
Definition: SweepTmpl.h:75
std::string baseFileName_
Base name for output files.
Definition: SweepTmpl.h:53
double c(int i) const
Get a coefficient of a previous state in a continuation.
Definition: SweepTmpl.h:115
void initialize()
Initialize variables that track history of solutions.
Definition: SweepTmpl.tpp:153
int nAccept() const
Get the number of converged solutions accepted thus far.
Definition: SweepTmpl.h:146
void setCoefficients(double sNew)
Compute coefficients of previous states for continuation.
Definition: SweepTmpl.tpp:206
double s(int i) const
Get the value of s for a stored solution, with i = 0 most recent.
Definition: SweepTmpl.h:90
int historyCapacity() const
Get the maximum number of stored previous states.
Definition: SweepTmpl.h:136
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.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1