1#ifndef RPG_MAX_ORDER_PARAMETER_TPP
2#define RPG_MAX_ORDER_PARAMETER_TPP
4#include "MaxOrderParameter.h"
6#include <rpg/fts/simulator/Simulator.h>
7#include <rpg/system/System.h>
9#include <prdc/cuda/FFT.h>
10#include <prdc/cuda/RField.h>
11#include <prdc/cuda/resources.h>
12#include <prdc/crystal/shiftToMinimum.h>
14#include <pscf/inter/Interaction.h>
15#include <pscf/mesh/MeshIterator.h>
16#include <pscf/math/IntVec.h>
18#include <util/format/Int.h>
19#include <util/format/Dbl.h>
53 const int nMonomer =
system().mixture().nMonomer();
70 wc0_.allocate(dimensions);
71 wK_.allocate(dimensions);
74 isInitialized_ =
true;
86 const int meshSize =
system().domain().mesh().size();
92 system().domain().fft().forwardTransform(wc0_, wK_);
102 maxOrderParameter_ = psiHost[1];
104 for (
int i = 2; i < kSize_; ++i){
105 if (psiHost[i] > maxOrderParameter_){
106 maxOrderParameter_ = psiHost[i];
122 Gmin = shiftToMinimum(G, dimensions, unitCell);
123 GminList[itr.
rank()] = Gmin;
126 GminStar_ = GminList[maxIndex];
128 return maxOrderParameter_;
135 double chi=
system().interaction().chi(0,1);
138 outputFile_ <<
Int(step);
139 outputFile_ <<
Dbl(chi);
140 outputFile_ <<
" ( ";
141 for (
int i = 0; i < D; i++){
142 outputFile_ <<
Int(GminStar_[i],3) <<
" ";
144 outputFile_ <<
" ) ";
145 outputFile_ <<
Dbl(value);
149 outputFile_ <<
Int(step);
150 outputFile_ <<
" ( ";
151 for (
int i = 0; i < D; i++){
152 outputFile_ <<
Int(GminStar_[i],3) <<
" ";
154 outputFile_ <<
" ) ";
155 outputFile_ <<
Dbl(value);
Template for dynamic array stored in host CPU memory.
An IntVec<D, T> is a D-component vector of elements of integer type T.
Iterator over points in a Mesh<D>.
int rank() const
Get the rank of current element.
void begin()
Set iterator to the first point in the mesh.
bool atEnd() const
Is this the end (i.e., one past the last point)?
void setDimensions(const IntVec< D > &dimensions)
Set the grid dimensions in all directions.
IntVec< D > position() const
Get current position in the grid, as integer vector.
static void computeKMesh(IntVec< D > const &rMeshDimensions, IntVec< D > &kMeshDimensions, int &kSize)
Compute dimensions and size of k-space mesh for DFT of real data.
Field of real double precision values on an FFT mesh.
void allocate(IntVec< D > const &meshDimensions)
Allocate the underlying C array for an FFT grid.
Base template for UnitCell<D> classes, D=1, 2 or 3.
AverageAnalyzer(Simulator< D > &simulator, System< D > &system)
Constructor.
virtual void setup()
Setup before loop.
int nSamplePerOutput() const
Get value of nSamplePerOutput.
Simulator< D > & simulator()
Return reference to parent simulator.
System< D > & system()
Return reference to parent system.
virtual void outputValue(int step, double value)
Output a sampled or block average value.
void setClassName(const char *className)
Set class name string.
virtual double compute()
Compute and return the max order parameter.
virtual ~MaxOrderParameter()
Destructor.
void setup()
Setup before simulation loop.
MaxOrderParameter(Simulator< D > &simulator, System< D > &system)
Constructor.
Field theoretic simulator (base class).
Main class, representing one complete system.
Dynamically allocatable contiguous array template.
void allocate(int capacity)
Allocate the underlying C array.
Wrapper for a double precision number, for formatted ostream output.
Wrapper for an int, for formatted ostream output.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
void eqV(DeviceArray< cudaReal > &a, DeviceArray< cudaReal > const &b, const int beginIdA, const int beginIdB, const int n)
Vector assignment, a[i] = b[i], kernel wrapper (cudaReal).
void sqNormV(DeviceArray< cudaReal > &a, DeviceArray< cudaComplex > const &b)
Squared norm of complex number, a[i] = norm(b[i])^2, kernel wrapper.
Periodic fields and crystallography.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.