PSCF v1.4.0
fts/analyzer/BinaryStructureFactor.h
1#ifndef RP_BINARY_STRUCTURE_FACTOR_H
2#define RP_BINARY_STRUCTURE_FACTOR_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/math/IntVec.h> // member
12#include <util/accumulators/Average.h> // member
13#include <util/containers/DArray.h> // member
14
15#include <iostream>
16
17// Forward declaration
18namespace Util {
19 template <typename T> class Array;
20}
21
22namespace Pscf {
23namespace Rp {
24
25 using namespace Util;
26
49 template <int D, class T>
50 class BinaryStructureFactor : public T::Analyzer
51 {
52
53 public:
54
61 BinaryStructureFactor(typename T::Simulator& simulator,
62 typename T::System& system);
63
72 void readParameters(std::istream& in) override;
73
74 // Virual setup and sample functions are implemented by subclasses
75
83 void output() override;
84
85 protected:
86
90 void allocate();
91
98 void findWaveBunches(
99 Array<double> const & kSq,
100 Array<bool> const & implicit);
101
105 void computeW();
106
110 void computeS(Array<typename T::Complex> const & wk);
111
113 typename T::RFieldDft wk_;
114
115 // Alias for base class
116 using AnalyzerT = typename T::Analyzer;
117
118 // Inherited protected member functions (selected)
119 using AnalyzerT::system;
120 using AnalyzerT::simulator;
121
122 private:
123
125 typename T::RField wm_;
126
128 DArray<int> waveBunchIds_;
129
131 DArray<double> waveWeights_;
132
134 DArray<double> bunchWavenumbers_;
135
137 DArray<double> bunchValues_;
138
140 DArray<Average> bunchAccumulators_;
141
143 DArray<Average> waveAccumulators_;
144
146 double a_, b_;
147
149 IntVec<D> kMeshDimensions_;
150
152 int nWave_;
153
155 int nBunch_;
156
158 bool writeWaveData_;
159
161 bool isInitialized_;
162
163 // Alias for FFT wrapper class
164 using FFTT = typename T::FFT;
165
166 };
167
168} // namespace Rp
169} // namespace Pscf
170#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
void readParameters(std::istream &in) override
Read parameters from file.
void output() override
Output results to predefined output file.
BinaryStructureFactor(typename T::Simulator &simulator, typename T::System &system)
Constructor.
void allocate()
Allocate member arrays with dimensions that depend only on mesh.
void computeS(Array< typename T::Complex > const &wk)
Complete calculation of current structure factors.
T::RFieldDft wk_
Discrete Fourier transform (DFT) of wm_ .
void findWaveBunches(Array< double > const &kSq, Array< bool > const &implicit)
Allocate and initialize data structures involving wave bunches.
void computeW()
Compute member variables wm_ and wk_.
Array container class template.
Definition Array.h:40
Dynamically allocatable contiguous array template.
Definition DArray.h:32
Class templates for real-valued periodic fields.
PSCF package top-level namespace.
Utility classes for scientific computation.