11#include <util/param/ParamComposite.h>
13#include <rpc/fts/simulator/SimState.h>
14#include <prdc/cpu/RField.h>
15#include <util/random/Random.h>
16#include <util/containers/DArray.h>
17#include <util/containers/DMatrix.h>
23 template <
int D>
class System;
28 template <
int D>
class Ramp;
33 using namespace Prdc::Cpu;
143 virtual void analyze(
int min,
int max,
144 std::string classname,
145 std::string filename);
254 double chiEvecs(
int a,
int i)
const;
280 double sc(
int a)
const;
616 void readRamp(std::istream& in,
bool& isEnd);
842 return *compressorFactoryPtr_;
848 {
return (
bool)compressorPtr_; }
855 return *compressorPtr_;
861 {
return (
bool)perturbationPtr_; }
868 return *perturbationPtr_;
876 return *perturbationPtr_;
884 return *perturbationFactoryPtr_;
890 {
return (
bool)rampPtr_; }
913 return *rampFactoryPtr_;
921 {
return chiEvals_; }
926 {
return chiEvals_[a]; }
931 {
return chiEvecs_; }
936 {
return chiEvecs_(a, i); }
963 return idealHamiltonian_;
971 return fieldHamiltonian_;
979 return perturbationHamiltonian_;
985 {
return hasHamiltonian_; }
1042 {
return iTotalStep_; }
1044 #ifndef RPC_SIMULATOR_TPP
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).
bool hasCc_
Have eigen-components of the current c fields been computed ?
Ramp< D > const & ramp() const
Get the associated Ramp by const reference.
void readPerturbation(std::istream &in, bool &isEnd)
Optionally read an associated perturbation.
System< D > & system()
Get parent system by reference.
bool hasWc_
Have eigen-components of the current w fields been computed ?
void computeDc()
Compute functional derivatives of the Hamiltonian.
SimState< D > state_
Previous state saved during at the beginning of a step.
bool hasHamiltonian_
Has the Hamiltonian been computed for the current w and c fields?
virtual void analyze(int min, int max, std::string classname, std::string filename)
Read and analyze a trajectory file.
long iTotalStep()
Return the current simulation step index.
double perturbationHamiltonian() const
Get the perturbation to the standard Hamiltonian (if any).
void clearState()
Clear the saved copy of the fts state.
bool hasRamp() const
Does this Simulator have a Ramp?
PerturbationFactory< D > & perturbationFactory()
Get the perturbation factory by reference.
void computeWc()
Compute eigenvector components of the current w fields.
DArray< RField< D > > const & cc() const
Get all eigenvector components of the current c fields.
void setPerturbation(Perturbation< D > *ptr)
Set the associated perturbation.
double chiEval(int a) const
Get a single eigenvalue of the projected chi matrix.
void clearData()
Clear field eigen-components and hamiltonian components.
Compressor< D > & compressor()
Get the compressor by reference.
bool hasDc() const
Are the current d fields valid ?
void analyzeChi()
Perform eigenvalue analysis of projected chi matrix.
double fieldHamiltonian_
Field contribution (H_W) to Hamiltonian.
DArray< double > const & sc() const
Get all components of the vector S.
virtual void outputTimers(std::ostream &out)
Output timing results.
long iStep()
Return the current converged simulation step index.
virtual void outputMdeCounter(std::ostream &out)
Output MDE counter.
long seed_
Random number generator seed.
virtual void readParameters(std::istream &in)
Read parameters for a simulation.
void allocate()
Allocate required memory.
DMatrix< double > const & chiEvecs() const
Get the matrix of all eigenvectors of the projected chi matrix.
double idealHamiltonian_
Ideal gas contribution (-lnQ) to Hamiltonian H[W].
virtual void simulate(int nStep)
Perform a field theoretic Monte-Carlo simulation.
void setRamp(Ramp< D > *ptr)
Set the associated ramp.
DArray< RField< D > > wc_
Eigenvector components of w fields on a real space grid.
DArray< RField< D > > dc_
Components of d fields on a real space grid.
bool hasCc() const
Are eigen-components of current c fields valid ?
RampFactory< D > & rampFactory()
Get the ramp factory by reference.
double hamiltonian_
Total field theoretic Hamiltonian H[W] (extensive value).
double perturbationHamiltonian_
Perturbation to the standard Hamiltonian (if any).
virtual void clearTimers()
Clear timers.
bool hasWc() const
Are eigen-components of current w fields valid ?
CompressorFactory< D > & compressorFactory()
Get the compressor factory by reference.
bool hasDc_
Have functional derivatives of H[W] been computed ?
void restoreState()
Restore the saved copy of the fts move state.
void saveState()
Save a copy of the fts move state.
long iTotalStep_
Step counter - total number of attempted BD or MC steps.
double hamiltonian() const
Get the Hamiltonian used in PS-FTS.
bool hasCompressor() const
Does this Simulator have a Compressor?
void readRandomSeed(std::istream &in)
Optionally read a random number generator seed.
bool hasPerturbation() const
Does this Simulator have a Perturbation?
DArray< RField< D > > cc_
Eigenvector components of c fields on a real space grid.
void readCompressor(std::istream &in, bool &isEnd)
Read the compressor block of the parameter file.
double fieldHamiltonian() const
Get the quadratic field contribution to the Hamiltonian.
long iStep_
Step counter - attempted steps for which compressor converges.
void readRamp(std::istream &in, bool &isEnd)
Optionally read an associated ramp.
DArray< double > const & chiEvals() const
Get an array of the eigenvalues of the projected chi matrix.
bool hasHamiltonian() const
Has the Hamiltonian been computed for current w and c fields?
DArray< RField< D > > const & dc() const
Get all of the current d fields.
Random random_
Random number generator.
Perturbation< D > const & perturbation() const
Get the associated Perturbation by const reference.
DArray< RField< D > > const & wc() const
Get all eigenvector components of the current w fields.
void computeHamiltonian()
Compute the Hamiltonian used in PS-FTS.
double idealHamiltonian() const
Get ideal gas contribution to the Hamiltonian.
Random & random()
Get random number generator by reference.
void computeCc()
Compute eigenvector components of the current c fields.
Main class for SCFT or PS-FTS simulation of one system.
Dynamically allocatable contiguous array template.
Dynamically allocated Matrix.
An object that can read multiple parameters from file.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
PSCF package top-level namespace.
Utility classes for scientific computation.
SimState stores the state used by an FTS simulation.