PSCF v1.5.0
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 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <rp/fts/analyzer/Analyzer.h> // base class
12#include <pscf/math/IntVec.h> // member
13#include <pscf/field/RField.h> // member
14#include <pscf/field/RFieldDft.h> // member
15#include <pscf/backend/HostRecvArray.h> // member
16#include <util/accumulators/Average.h> // member
17#include <util/containers/DArray.h> // member
18
19#include <pscf/backend/TmplDeclare.h>
20#include <iostream>
21
22// Forward declaration
23namespace Util {
24 template <typename T> class Array;
25 template <int D, class T> class FFT;
26}
27namespace Pscf {
28 template <int D, class T> class RFieldDft;
29 template <int D, class T> class RField;
30}
31
32namespace Pscf {
33namespace Rp {
34
35 using namespace Util;
36
59 template <int D, class T>
60 class BinaryStructureFactor : public Analyzer<D,T>
61 {
62
63 public:
64
73
82 void readParameters(std::istream& in) override;
83
87 void setup() override;
88
94 void sample(long iStep) override;
95
102 void output() override;
103
104 private:
105
107 using ComplexT = typename T::Complex;
108
109 // Private member variables
110
112 RField<D,T> wm_;
113
115 RFieldDft<D,T> wk_d_;
116
119
121 DArray<int> waveBunchIds_;
122
124 DArray<double> waveWeights_;
125
127 DArray<double> bunchWavenumbers_;
128
130 DArray<double> bunchValues_;
131
133 DArray<Average> bunchAccumulators_;
134
136 DArray<Average> waveAccumulators_;
137
139 double a_, b_;
140
142 IntVec<D> kMeshDimensions_;
143
145 int nWave_;
146
148 int nBunch_;
149
151 bool writeWaveData_;
152
154 bool isInitialized_;
155
156 // Private member functions
157
161 void allocate();
162
166 void setupWaveBunches();
167
171 void computeW();
172
176 void computeS();
177
178 // Inherited member function (selected for convenience)
179 using Analyzer<D,T>::system;
180 using Analyzer<D,T>::simulator;
181
182 };
183
184 // Explicit instantiation declarations
185 PSCF_TMPL_DECLARE(BinaryStructureFactor)
186
187} // namespace Rp
188} // namespace Pscf
189#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
Analyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
Definition Analyzer.tpp:31
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
Definition Analyzer.h:233
System< D, T > & system()
Get the parent System by reference.
Definition Analyzer.h:243
Spherically averaged structure factor for a two-monomer system.
void readParameters(std::istream &in) override
Read parameters from file.
void output() override
Output results to predefined output file.
BinaryStructureFactor(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
void setup() override
Setup before the main loop.
void sample(long iStep) override
Compute structure factors and add to accumulators.
Base class for field theoretic PS-FTS simulator.
Definition Simulator.h:93
Base class template for classes that represent a complete system.
Array container class template.
Definition Array.h:41
Dynamically allocatable contiguous array template.
Definition DArray.h:32
PSCF package top-level namespace.
Utility classes for scientific computation.