11#include <util/param/ParamComposite.h>
13#include <rpg/fts/simulator/SimState.h>
14#include <prdc/cuda/RField.h>
15#include <util/random/Random.h>
16#include <pscf/cuda/CudaRandom.h>
17#include <util/containers/DArray.h>
18#include <util/containers/DMatrix.h>
23 template <
int D>
class System;
28 template <
int D>
class Ramp;
130 virtual void analyze(
int min,
int max,
131 std::string classname,
132 std::string filename);
237 double chiEvecs(
int a,
int i)
const;
263 double sc(
int a)
const;
612 void readRamp(std::istream& in,
bool& isEnd);
828 {
return (
bool)compressorPtr_; }
835 return *compressorPtr_;
843 return *compressorPtr_;
851 return *compressorFactoryPtr_;
857 {
return (
bool)perturbationPtr_; }
864 return *perturbationPtr_;
872 return *perturbationPtr_;
880 return *perturbationFactoryPtr_;
886 {
return (
bool)rampPtr_; }
909 return *rampFactoryPtr_;
915 {
return chiEvals_[a]; }
920 {
return chiEvals_; }
925 {
return chiEvecs_; }
930 {
return chiEvecs_(a, i); }
1044 #ifndef RPG_SIMULATOR_TPP
Random number generator on GPU.
Field of real double precision values on an FFT mesh.
Factory for subclasses of Compressor.
Base class for iterators that impose incompressibility.
Factory for subclasses of Perturbation.
Base class for additive perturbations of standard FTS Hamiltonian.
Factory for subclasses of Ramp.
Class that varies parameters during a simulation (abstract).
Field theoretic simulator (base class).
void readRandomSeed(std::istream &in)
Read random seed and initialize random number generators.
long iStep()
Return the current converged simulation step index.
PerturbationFactory< D > & perturbationFactory()
Get the perturbation factory by reference.
bool hasPerturbation() const
Does this Simulator have a Perturbation?
long iTotalStep()
Return the current simulation step index.
Random random_
Random number generator.
System< D > & system()
Get parent system by reference.
void computeWc()
Compute eigenvector components of the current w fields.
CudaRandom & cudaRandom()
Get cuda random number generator by reference.
void readRamp(std::istream &in, bool &isEnd)
Optionally read an associated ramp.
void computeCc()
Compute eigenvector components of the current c fields.
void clearData()
Clear field eigen-components and hamiltonian components.
DArray< RField< D > > dc_
Components of d fields on a real space grid.
DMatrix< double > const & chiEvecs() const
Get the matrix of all eigenvectors of the projected chi matrix.
bool hasHamiltonian_
Has the Hamiltonian been computed for the current w and c fields?
bool hasWc_
Have eigen-components of the current w fields been computed ?
bool hasCc() const
Are eigen-components of current c fields valid ?
void setPerturbation(Perturbation< D > *ptr)
Set the associated perturbation.
void computeDc()
Compute functional derivatives of the Hamiltonian.
SimState< D > state_
State saved during fts simulation.
bool hasHamiltonian() const
Has the MC Hamiltonian been computed for current w and c fields?
double perturbationHamiltonian_
Perturbation to the standard Hamiltonian (if any).
long iTotalStep_
Simulation step counter.
virtual void analyze(int min, int max, std::string classname, std::string filename)
Read and analyze a trajectory file.
Random & random()
Get random number generator by reference.
bool hasDc_
Have functional derivatives of H[W] been computed ?
void allocate()
Allocate required memory.
DArray< RField< D > > cc_
Eigenvector components of c fields on a real space grid.
void saveState()
Save a copy of the fts move state.
void restoreState()
Restore the saved copy of the fts move state.
void readPerturbation(std::istream &in, bool &isEnd)
Optionally read an associated perturbation.
CompressorFactory< D > & compressorFactory()
Get the compressor factory by reference.
void readCompressor(std::istream &in, bool &isEnd)
Read the compressor block of the parameter file.
virtual void simulate(int nStep)
Perform a field theoretic Monte-Carlo simulation.
DArray< double > const & sc() const
Get all components of the vector S.
Ramp< D > const & ramp() const
Get the associated Ramp by const reference.
DArray< RField< D > > const & wc() const
Get all eigenvector components of the current w fields.
virtual void outputMdeCounter(std::ostream &out) const
Output MDE counter.
double hamiltonian() const
Get the Hamiltonian used in field theoretic simulations.
bool hasCc_
Have eigen-components of the current c fields been computed ?
CudaRandom cudaRandom_
Random number generator.
bool hasRamp() const
Does this Simulator have a Ramp?
virtual void readParameters(std::istream &in)
Read parameters for a simulation.
Simulator(System< D > &system)
Constructor.
double fieldHamiltonian_
Field contribution (H_W) to Hamiltonian.
void analyzeChi()
Perform eigenvalue analysis of projected chi matrix.
DArray< double > const & chiEvals() const
Get an array of the eigenvalues of the projected chi matrix.
Compressor< D > & compressor()
Get the compressor by non-const reference.
bool hasCompressor() const
Does this Simulator have a Compressor object?
bool hasWc() const
Are eigen-components of current w fields valid ?
double chiEval(int a) const
Get a single eigenvalue of the projected chi matrix.
Perturbation< D > const & perturbation() const
Get the associated Perturbation by const reference.
bool hasDc() const
Are the current d fields valid ?
double idealHamiltonian_
Ideal gas contribution (lnQ) to Hamiltonian H[W].
void setRamp(Ramp< D > *ptr)
Set the associated ramp.
double fieldHamiltonian() const
Get the quadratic field contribution (HW) to MC Hamiltonian.
void clearState()
Clear the saved copy of the fts state.
long seed_
Random number generator seed.
long iStep_
Simulation step counter.
virtual void clearTimers()
Clear timers.
DArray< RField< D > > const & dc() const
Get all of the current d fields.
double hamiltonian_
Field theoretic Hamiltonian H[W] (extensive value).
RampFactory< D > & rampFactory()
Get the ramp factory by reference.
DArray< RField< D > > const & cc() const
Get all eigenvector components of the current c fields.
double idealHamiltonian() const
Get ideal gas contribution (-lnQ) to MC Hamiltonian.
DArray< RField< D > > wc_
Eigenvector components of w fields on a real space grid.
virtual void outputTimers(std::ostream &out) const
Output timing results.
double perturbationHamiltonian() const
Get the perturbation to the standard Hamiltonian (if any).
void computeHamiltonian()
Compute the Hamiltonian used in field theoretic simulations.
Main class, representing one complete system.
Dynamically allocatable contiguous array template.
Dynamically allocated Matrix.
void setClassName(const char *className)
Set class name string.
ParamComposite()
Constructor.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
SimState stores the state used by an fts simulation.