1#ifndef RP_FOURTH_ORDER_PARAMETER_TPP
2#define RP_FOURTH_ORDER_PARAMETER_TPP
4#include "FourthOrderParameter.h"
6#include <rp/system/System.h>
7#include <rp/fts/simulator/Simulator.h>
8#include <rp/solvers/Mixture.h>
9#include <rp/field/Domain.h>
10#include <rp/field/WFields.h>
11#include <rp/field/CFields.h>
13#include <pscf/field/FFT.h>
14#include <pscf/field/WaveList.h>
15#include <pscf/crystal/shiftToMinimum.h>
17#include <pscf/backend/HostSendArray.h>
18#include <pscf/backend/Reduce.h>
19#include <pscf/backend/VecOp.h>
20#include <pscf/interaction/Interaction.h>
21#include <pscf/mesh/MeshIterator.h>
23#include <util/containers/Array.h>
24#include <util/containers/DArray.h>
25#include <util/misc/ioUtil.h>
26#include <util/format/Int.h>
27#include <util/format/Dbl.h>
41 template <
int D,
class T>
53 template <
int D,
class T>
67 wK_.allocate(dimensions);
68 prefactor_.allocate(kMeshDimensions_);
69 psi_.allocate(kMeshDimensions_);
74 isInitialized_ =
true;
80 template <
int D,
class T>
101 double orderParameter =
Reduce::sum(psi_, 1, kSize_);
102 orderParameter = std::pow(orderParameter, 0.25);
104 return orderParameter;
110 template <
int D,
class T>
111 void FourthOrderParameter<D,T>::computePrefactor()
119 prefactor_h.associate(prefactor_);
123 DArray<bool> const & implicit = system().waveList().implicitInverse();
125 for (
int i = 0; i < kSize_; ++i) {
127 prefactor_h[i] = 1.0;
129 prefactor_h[i] = 0.5;
134 prefactor_ = prefactor_h;
136 prefactor_h.dissociate();
An IntVec<D, T> is a D-component vector of elements of integer type T.
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
System< D, T > & system()
Get the parent System by reference.
AverageAnalyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
virtual void setup()
Setup before loop.
double compute() override
Compute and return the order parameter.
void setup() override
Setup before the main loop.
FourthOrderParameter(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
Base class for field theoretic PS-FTS simulator.
Base class template for classes that represent a complete system.
int size() const
Return logical size of array.
Dynamically allocatable contiguous array template.
void setClassName(const char *className)
Set class name string.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
double sum(Array< double > const &in)
Compute sum of array elements (real).
void mulEqV(Array< double > &a, Array< double > const &b)
Vector-vector in-place multiplication, a[i] *= b[i] (real).
void sqSqAbsV(Array< double > &a, Array< fftw_complex > const &b)
Fourth power of absolute magnitude, a[i] = |b[i]|^4 (complex).
void eqS(Array< double > &a, double b)
Vector assignment, a[i] = b (real).
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.