PSCF v1.3
rpg/fts/analyzer/BinaryStructureFactorGrid.h
1#ifndef RPG_BINARY_STRUCTURE_FACTOR_GRID_H
2#define RPG_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"
12
13#include <prdc/cuda/RFieldDft.h>
14#include <prdc/cuda/RField.h>
15#include <pscf/math/IntVec.h>
16#include <util/accumulators/Average.h>
17#include <util/containers/DArray.h>
18
19#include <string>
20#include <iostream>
21#include <map>
22#include <vector>
23
24namespace Pscf {
25namespace Rpg {
26
27 template <int D> class System;
28 template <int D> class Simulator;
29
30 using namespace Util;
31 using namespace Pscf::Prdc;
32 using namespace Pscf::Prdc::Cuda;
33
49 template <int D>
51 {
52
53 public:
54
59
64
75 void readParameters(std::istream& in);
76
77 #if 0
84
91 #endif
92
96 void setup();
97
103 void sample(long iStep);
104
108 void output();
109
114
119
120 protected:
121
125 std::ofstream outputFile_;
126
130 std::string filename_;
131
139 const Average& accumulator(int i) const;
140
145
148
153
158
162 System<D>& system();
163
168
172 using Analyzer<D>::interval;
173 using Analyzer<D>::isAtInterval;
175 using Analyzer<D>::setClassName;
176 using Analyzer<D>::readInterval;
178
179 private:
180
182 bool isInitialized_;
183
185 int nSamplePerBlock_;
186
188 IntVec<D> kMeshDimensions_;
189
191 int kSize_;
192
194 DArray<Average> accumulators_;
195
197 RField<D> wm_;
198
200 RFieldDft<D> wk_;
201
203 std::vector<double> qList_;
204
206 std::map<double, double> averageSMap_;
207 };
208
209 // Get the parent system.
210 template <int D>
213
214 //Get parent Simulator object.
215 template <int D>
218
219
220}
221}
222#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
const std::string & outputFileName() const
Return outputFileName string.
Analyzer()
Default constructor.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
int interval() const
Get interval value.
void readInterval(std::istream &in)
Read interval from file, with error checking.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
void sample(long iStep)
Add particles to BinaryStructureFactor accumulators.
void setClassName(const char *className)
Set class name string.
void averageStructureFactor()
Compute average S(k) over k of equal magnitude.
System< D > * systemPtr_
Pointer to the parent system.
const Average & accumulator(int i) const
Get Average accumulator for a specific value.
void output()
Output results to predefined output file.
Simulator< D > & simulator()
Return reference to parent Simulator.
void readParameters(std::istream &in)
Read parameters from file.
System< D > & system()
Return reference to parent system.
Simulator< D > * simulatorPtr_
Pointer to parent Simulator.
BinaryStructureFactorGrid(Simulator< D > &simulator, System< D > &system)
Constructor.
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.
virtual void save(Serializable::OArchive &ar)
Saves all parameters to an archive.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from archive, without adding Begin and End lines.
BinaryFileIArchive IArchive
Type of input archive used by load method.
BinaryFileOArchive OArchive
Type of output archive used by save method.
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