PSCF v1.2
rpg/scft/sweep/Sweep.h
1#ifndef RPG_SWEEP_H
2#define RPG_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 <rpg/scft/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 Rpg {
17
18 template <int D> class System;
19
20 using namespace Util;
21 using namespace Pscf::Prdc;
22 using namespace Pscf::Prdc::Cuda;
23
27 template <int D>
28 class Sweep : public SweepTmpl< BasisFieldState<D> >
29 {
30
31 public:
32
36 Sweep();
37
41 Sweep(System<D>& system);
42
46 ~Sweep();
47
51 void setSystem(System<D>& system);
52
58 virtual void readParameters(std::istream& in);
59
60 // Public members inherited from base class template SweepTmpl
61 using SweepTmpl< BasisFieldState<D> >::addParameterTypes;
62 using SweepTmpl< BasisFieldState<D> >::addParameterType;
63 using SweepTmpl< BasisFieldState<D> >::historyCapacity;
64 using SweepTmpl< BasisFieldState<D> >::historySize;
65 using SweepTmpl< BasisFieldState<D> >::nAccept;
66 using SweepTmpl< BasisFieldState<D> >::state;
67 using SweepTmpl< BasisFieldState<D> >::s;
68 using SweepTmpl< BasisFieldState<D> >::c;
69
70 protected:
71
77 virtual void checkAllocation(BasisFieldState<D>& state);
78
82 virtual void setup();
83
89 virtual void setParameters(double sNew) = 0;
90
96 virtual void extrapolate(double sNew);
97
104 virtual int solve(bool isContinuation);
105
113 virtual void reset();
114
122 virtual void getSolution();
123
127 virtual void cleanup();
128
133 { return (systemPtr_ != 0); }
134
139 { return *systemPtr_; }
140
143
146
149
150 // Protected members inherited from base classes
156
157 private:
158
160 BasisFieldState<D> trial_;
161
163 FSArray<double, 6> unitCellParameters_;
164
166 std::ofstream logFile_;
167
169 System<D>* systemPtr_;
170
172 void outputSolution();
173
175 void outputSummary(std::ostream&);
176
177 };
178
179} // namespace Rpg
180} // namespace Pscf
181#endif
FieldState for fields in symmetry-adapted basis format.
virtual void getSolution()
Update state(0) and output data after successful convergence.
bool writeCBasis_
Whether to write concentration field files in basis format.
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 checkAllocation(BasisFieldState< D > &state)
Check allocation state of fields in one state, allocate if necessary.
virtual void extrapolate(double sNew)
Create a guess for adjustable variables by continuation.
virtual void setup()
Setup operation at the beginning of a sweep.
bool writeWRGrid_
Whether to write real space potential field files.
bool writeCRGrid_
Whether to write real space concentration field files.
bool hasSystem()
Has an association with the parent System been set?
virtual void reset()
Reset system to previous solution after iterature failure.
virtual void setParameters(double sNew)=0
Set non-adjustable system parameters to new values.
Sweep()
Default Constructor.
System< D > & system()
Return the parent system by reference.
void setSystem(System< D > &system)
Set association with parent System.
virtual void cleanup()
Cleanup operation at the beginning of a sweep.
Main class for calculations that represent one system.
Definition rpg/System.h:107
Solve a sequence of problems along a path through parameter space.
Definition SweepTmpl.h:28
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 rpg/System.h:28
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.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition CField.cu:12
Periodic fields and crystallography.
Definition CField.cpp:11
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.