13#include <pscf/mesh/Mesh.h>
14#include <util/containers/Array.h>
15#include <util/random/Random.h>
25 template <
int D,
class T>
35 template <
int D,
class T>
40 McMoveT::readProbability(in);
47 IntVec<D> const & dim = system().domain().mesh().dimensions();
48 for (
int i = 0; i < D; i++) {
56 template <
int D,
class T>
64 const int nMonomer = system().mixture().nMonomer();
65 IntVec<D> const & dim = system().domain().mesh().dimensions();
66 w_.allocate(nMonomer);
67 for (
int i = 0; i < nMonomer; ++i) {
77 template <
int D,
class T>
82 for (
int i = 0; i < D; i++){
83 shift[i] = McMoveT::random().uniformInt(-maxShift_, maxShift_ + 1);
90 system().w().setRGrid(
w_);
96 template <
int D,
class T>
104 int meshSize = mesh.
size();
108 for (
int i = 0; i < meshSize; ++i) {
110 for (
int d = 0; d < D; ++d){
111 outPosition[d] = inPosition[d] + shift[d];
112 if (outPosition[d] < 0){
113 outPosition[d] += dimensions[d];
116 outPosition[d] = outPosition[d] % dimensions[d];
118 out[mesh.
rank(outPosition)] = in[mesh.
rank(inPosition)];
An IntVec<D, T> is a D-component vector of elements of integer type T.
Description of a regular grid of points in a periodic domain.
int size() const
Get total number of grid points.
int rank(IntVec< D > const &position) const
Get the rank of a grid point with specified position.
IntVec< D > position(int rank) const
Get the position IntVec<D> of a grid point with a specified rank.
void attemptMove() override
Attempt move that translates all w fields.
DArray< typename T::RField > w_
Shifted field configurations.
void readParameters(std::istream &in) override
Read body of parameter file block.
ShiftMove(typename T::McSimulator &simulator)
Constructor.
virtual void shiftFields(IntVec< D > const &shift)=0
Compute and store shifted w fields.
void shiftField(Array< double > &out, Array< double > const &in, IntVec< D > shift, IntVec< D > dimensions) const
Compute a shifted version of a field.
void setup() override
Setup before the beginning of each simulation run.
Array container class template.
int capacity() const
Return allocated size.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Class templates for real-valued periodic fields.
PSCF package top-level namespace.