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>
8#include <rpg/solvers/Mixture.h>
9#include <rpg/field/Domain.h>
11#include <prdc/cuda/FFT.h>
12#include <prdc/cuda/RField.h>
13#include <prdc/cuda/resources.h>
14#include <prdc/crystal/shiftToMinimum.h>
16#include <pscf/inter/Interaction.h>
17#include <pscf/mesh/MeshIterator.h>
18#include <pscf/math/IntVec.h>
20#include <util/format/Int.h>
21#include <util/format/Dbl.h>
55 const int nMonomer =
system().mixture().nMonomer();
72 wc0_.allocate(dimensions);
73 wK_.allocate(dimensions);
76 isInitialized_ =
true;
88 const int meshSize =
system().domain().mesh().size();
94 system().domain().fft().forwardTransform(wc0_, wK_);
104 maxOrderParameter_ = psiHost[1];
106 for (
int i = 2; i < kSize_; ++i){
107 if (psiHost[i] > maxOrderParameter_){
108 maxOrderParameter_ = psiHost[i];
124 Gmin = shiftToMinimum(G, dimensions, unitCell);
125 GminList[itr.
rank()] = Gmin;
128 GminStar_ = GminList[maxIndex];
130 return maxOrderParameter_;
137 double chi=
system().interaction().chi(0,1);
140 outputFile_ <<
Int(step);
141 outputFile_ <<
Dbl(chi);
142 outputFile_ <<
" ( ";
143 for (
int i = 0; i < D; i++){
144 outputFile_ <<
Int(GminStar_[i],3) <<
" ";
146 outputFile_ <<
" ) ";
147 outputFile_ <<
Dbl(value);
151 outputFile_ <<
Int(step);
152 outputFile_ <<
" ( ";
153 for (
int i = 0; i < D; i++){
154 outputFile_ <<
Int(GminStar_[i],3) <<
" ";
156 outputFile_ <<
" ) ";
157 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 a complete physical 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(Array< double > &a, Array< double > const &b)
Vector assignment, a[i] = b[i].
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.