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>
9#include <prdc/cuda/RField.h>
10#include <prdc/cuda/resources.h>
12#include <pscf/mesh/MeshIterator.h>
13#include <pscf/math/IntVec.h>
15#include <util/param/ParamComposite.h>
16#include <util/misc/FileMaster.h>
17#include <util/misc/ioUtil.h>
18#include <util/format/Int.h>
19#include <util/format/Dbl.h>
62 const int nMonomer = system().mixture().nMonomer();
67 if (!simulator().hasWc()){
68 simulator().computeWc();
72 IntVec<D> const & dimensions = system().mesh().dimensions();
74 wc0_.allocate(dimensions);
75 wK_.allocate(dimensions);
79 for (
int i = 0; i < D; ++i) {
81 kMeshDimensions_[i] = dimensions[i];
82 kSize_ *= dimensions[i];
84 kMeshDimensions_[i] = dimensions[i]/2 + 1;
85 kSize_ *= (dimensions[i]/2 + 1);
89 isInitialized_ =
true;
91 if (!isInitialized_) {
92 UTIL_THROW(
"Error: object is not initialized");
101 const int meshSize = system().domain().mesh().size();
107 system().fft().forwardTransform(wc0_, wK_);
115 return maxOrderParameter_;
121 if (simulator().hasRamp() && nSamplePerOutput() == 1) {
122 double chi= system().interaction().chi(0,1);
125 outputFile_ <<
Int(step);
126 outputFile_ <<
Dbl(chi);
127 outputFile_ <<
Dbl(value);
An IntVec<D, T> is a D-component vector of elements of integer type T.
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.
Analyze averages and block averages of several real variables.
virtual void setup()
Setup before loop.
virtual void outputValue(int step, double value)
Output a sampled or block average value.
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 for calculations that represent one system.
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.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
cudaReal maxAbs(DeviceArray< cudaReal > const &in)
Get maximum absolute magnitude of array elements (GPU kernel wrapper).
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.
PSCF package top-level namespace.
Utility classes for scientific computation.