PSCF v1.3.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 <pscf/sweep/SweepTmpl.h> // base class template
12#include <rpg/scft/sweep/BasisFieldState.h> // template argument
13
14namespace Pscf {
15namespace Rpg {
16
17 template <int D> class System;
18
19 using namespace Util;
20 using namespace Pscf::Prdc;
21 using namespace Pscf::Prdc::Cuda;
22
26 template <int D>
27 class Sweep : public SweepTmpl< BasisFieldState<D> >
28 {
29
30 public:
31
35 Sweep();
36
41
45 ~Sweep();
46
51
57 virtual void readParameters(std::istream& in);
58
59 // Public members inherited from base class template SweepTmpl
68
69 protected:
70
77
81 virtual void setup();
82
88 virtual void setParameters(double sNew) = 0;
89
95 virtual void extrapolate(double sNew);
96
103 virtual int solve(bool isContinuation);
104
112 virtual void reset();
113
121 virtual void getSolution();
122
126 virtual void cleanup();
127
132 { return (systemPtr_ != 0); }
133
138 { return *systemPtr_; }
139
142
145
148
149 // Protected members inherited from base classes
155
156 private:
157
159 BasisFieldState<D> trial_;
160
162 FSArray<double, 6> unitCellParameters_;
163
165 std::ofstream logFile_;
166
168 System<D>* systemPtr_;
169
171 void outputSolution();
172
174 void outputSummary(std::ostream&);
175
176 };
177
178} // namespace Rpg
179} // namespace Pscf
180#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 a complete physical 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.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition CField.cu:12
Periodic fields and crystallography.
Definition CField.cpp:11
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.