PSCF v1.1
pspg/sweep/Sweep.h
1#ifndef PSPG_SWEEP_H
2#define PSPG_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 <pspg/sweep/BasisFieldState.h> // base class template parameter
12#include <pscf/sweep/SweepTmpl.h> // base class template
13#include <util/global.h>
14
15namespace Pscf {
16namespace Pspg {
17
18 using namespace Util;
19
20 template <int D> class System;
21
25 template <int D>
26 class Sweep : public SweepTmpl< BasisFieldState<D> >
27 {
28
29 public:
30
34 Sweep();
35
40
44 ~Sweep();
45
50
56 virtual void readParameters(std::istream& in);
57
58 // Public members inherited from base class template SweepTmpl
65
66 protected:
67
74
78 virtual void setup();
79
85 virtual void setParameters(double sNew) = 0;
86
92 virtual void extrapolate(double sNew);
93
100 virtual int solve(bool isContinuation);
101
109 virtual void reset();
110
118 virtual void getSolution();
119
123 virtual void cleanup();
124
129 { return (systemPtr_ != 0); }
130
135 { return *systemPtr_; }
136
139
142
145
146 // Protected members inherited from base classes
152
153 private:
154
156 BasisFieldState<D> trial_;
157
159 FSArray<double, 6> unitCellParameters_;
160
162 std::ofstream logFile_;
163
165 System<D>* systemPtr_;
166
168 void outputSolution();
169
171 void outputSummary(std::ostream&);
172
173 };
174
175} // namespace Pspg
176} // namespace Pscf
177#endif
FieldState for fields in symmetry-adapted basis format.
Solve a sequence of problems along a line in parameter space.
bool hasSystem()
Has an association with the parent System been set?
virtual void getSolution()
Update state(0) and output data after successful convergence.
bool writeCBasis_
Whether to write concentration field files in basis format.
System< D > & system()
Return the parent system by reference.
virtual void setParameters(double sNew)=0
Set non-adjustable system parameters to new values.
virtual int solve(bool isContinuation)
Call current iterator to solve SCFT problem.
virtual void readParameters(std::istream &in)
Read parameters from param file.
virtual void setup()
Setup operation at the beginning of a sweep.
bool writeCRGrid_
Whether to write real space concentration field files.
virtual void checkAllocation(BasisFieldState< D > &state)
Check allocation state of fields in one state, allocate if necessary.
virtual void reset()
Reset system to previous solution after iterature failure.
virtual void cleanup()
Cleanup operation at the beginning of a sweep.
void setSystem(System< D > &system)
Set association with parent System.
Sweep()
Default Constructor.
virtual void extrapolate(double sNew)
Create a guess for adjustable variables by continuation.
bool writeWRGrid_
Whether to write real space potential field files.
Main class in SCFT simulation of one system.
Definition: pspg/System.h:71
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