PSCF v1.3
rpc/fts/analyzer/BinaryStructureFactorGrid.h
1#ifndef RPC_BINARY_STRUCTURE_FACTOR_GRID_H
2#define RPC_BINARY_STRUCTURE_FACTOR_GRID_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 "Analyzer.h" // base class
12
13#include <util/containers/DArray.h> // member
14#include <util/accumulators/Average.h> // member
15#include <prdc/cpu/RField.h> // member
16#include <prdc/cpu/RFieldDft.h> // member
17#include <map> // member
18
19#include <string>
20#include <iostream>
21#include <vector>
22
23namespace Pscf {
24namespace Rpc {
25
26 template <int D> class System;
27 template <int D> class Simulator;
28
29 using namespace Util;
30 using namespace Pscf::Prdc::Cpu;
31
50 template <int D>
52 {
53
54 public:
55
60
65
76 void readParameters(std::istream& in);
77
81 void setup();
82
88 void sample(long iStep);
89
93 void output();
94
99
104
105 protected:
106
110 std::ofstream outputFile_;
111
115 std::string filename_;
116
124 const Average& accumulator(int i) const;
125
130
133
138
143
147 System<D>& system();
148
153
157 using Analyzer<D>::interval;
158 using Analyzer<D>::isAtInterval;
160 using Analyzer<D>::setClassName;
161 using Analyzer<D>::readInterval;
163
164 private:
165
167 bool isInitialized_;
168
170 int nSamplePerBlock_;
171
173 IntVec<D> kMeshDimensions_;
174
176 int kSize_;
177
179 DArray<Average> accumulators_;
180
182 DArray< RFieldDft<D> > wKGrid_;
183
185 RField<D> wm_;
186
188 RFieldDft<D> wk_;
189
191 std::vector<double> qList_;
192
194 std::map<double, double> averageSMap_;
195
196 };
197
198 // Get the parent system.
199 template <int D>
202
203 //Get parent Simulator object.
204 template <int D>
207
208 #ifndef RPC_BINARY_STRUCTURE_FACTOR_GRID_TPP
209 // Suppress implicit instantiation
210 extern template class BinaryStructureFactorGrid<1>;
211 extern template class BinaryStructureFactorGrid<2>;
212 extern template class BinaryStructureFactorGrid<3>;
213 #endif
214
215}
216}
217#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition IntVec.h:27
Fourier transform of a real field on an FFT mesh.
Field of real double precision values on an FFT mesh.
Definition cpu/RField.h:29
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
void readInterval(std::istream &in)
Optionally read interval from file, with error checking.
const std::string & outputFileName() const
Return outputFileName string.
int interval() const
Get interval value.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
Analyzer()
Default constructor.
BinaryStructureFactorGrid evaluates AB copolymer structure factors.
void setClassName(const char *className)
Set class name string.
System< D > & system()
Return reference to parent system.
void readParameters(std::istream &in)
Read parameters from file.
BinaryStructureFactorGrid(Simulator< D > &simulator, System< D > &system)
Constructor.
Simulator< D > & simulator()
Return reference to parent Simulator.
System< D > * systemPtr_
Pointer to the parent system.
const Average & accumulator(int i) const
Get Average accumulator for a specific value.
void sample(long iStep)
Add particles to BinaryStructureFactor accumulators.
void averageStructureFactor()
Compute average S(k) over k of equal magnitude.
Simulator< D > * simulatorPtr_
Pointer to parent Simulator.
void output()
Output results to predefined output file.
Field theoretic simulator (base class).
Main class, representing one complete system.
Calculates the average and variance of a sampled property.
Definition Average.h:44
Dynamically allocatable contiguous array template.
Definition DArray.h:32
DArrayParam< Type > & readDArray(std::istream &in, const char *label, DArray< Type > &array, int n)
Add and read a required DArray < Type > parameter.
void setClassName(const char *className)
Set class name string.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
Fields and FFTs for periodic boundary conditions (CPU)
Definition CField.cpp:12
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.
Definition param_pc.dox:1