PSCF v1.3
rpg/scft/sweep/Sweep.h
1#ifndef RPG_SWEEP_H
2#define RPG_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 <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
42
46 ~Sweep();
47
52
58 virtual void readParameters(std::istream& in);
59
60 // Public members inherited from base class template SweepTmpl
69
70 protected:
71
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, 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.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition Reduce.cpp:14
Periodic fields and crystallography.
Definition CField.cpp:11
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
Definition param_pc.dox:1