12#include <util/param/ParamComposite.h>
13#include <rpc/solvers/Mixture.h>
14#include <rpc/field/Domain.h>
15#include <rpc/field/WFieldContainer.h>
16#include <rpc/field/CFieldContainer.h>
17#include <rpc/field/Mask.h>
18#include <prdc/cpu/RField.h>
19#include <prdc/cpu/RFieldDft.h>
20#include <pscf/homogeneous/Mixture.h>
21#include <util/misc/FileMaster.h>
22#include <util/containers/DArray.h>
26 template <
typename T,
int N>
class FSArray;
31 template <
int D>
class UnitCell;
49 using namespace Prdc::Cpu;
139 virtual void readParam(std::istream& in);
197 void readWBasis(
const std::string & filename);
219 void readWRGrid(
const std::string & filename);
346 void compute(
bool needStress =
false);
368 int iterate(
bool isContinuation =
false);
492 void writeWBasis(
const std::string & filename)
const;
499 void writeWRGrid(
const std::string & filename)
const;
506 void writeCBasis(
const std::string & filename)
const;
513 void writeCRGrid(
const std::string & filename)
const;
542 int polymerId,
int blockId,
543 int directionId,
int segmentId)
const;
553 void writeQTail(std::string
const & filename,
int polymerId,
554 int blockId,
int directionId)
const;
564 void writeQ(std::string
const & filename,
int polymerId,
565 int blockId,
int directionId)
const;
585 void writeQAll(std::string
const & basename);
599 void writeWaves(std::string
const & filename)
const;
609 void writeStars(std::string
const & filename)
const;
616 void writeGroup(std::string
const & filename)
const;
637 const std::string & outFileName);
654 const std::string & outFileName);
663 const std::string& outFileName);
672 const std::string & outFileName);
689 const std::string& outFileName);
698 const std::string & outFileName);
732 double epsilon = 1.0E-8);
742 const std::string & outFileName,
753 const std::string & outFileName,
754 double factor)
const;
776 const std::string & outFileName,
793 const std::string & outFileName,
1096 bool isAllocatedGrid_;
1101 bool isAllocatedBasis_;
1125 bool hasFreeEnergy_;
1132 void allocateFieldsGrid();
1137 void allocateFieldsBasis();
1147 void readFieldHeader(std::string filename);
1157 void readEcho(std::istream& in, std::string&
string)
const;
1167 void readEcho(std::istream& in,
double& value)
const;
1172 void initHomogeneous();
1181 {
return mixture_; }
1186 {
return mixture_; }
1196 {
return *simulatorPtr_; }
1201 {
return fileMaster_; }
1206 {
return fileMaster_; }
1211 {
return homogeneous_; }
1216 {
return homogeneous_; }
1223 return *interactionPtr_;
1231 return *interactionPtr_;
1239 return *iteratorPtr_;
1247 return *iteratorPtr_;
1285 {
return (iteratorPtr_); }
1290 {
return (sweepPtr_); }
1300 {
return mask_.hasData(); }
1305 {
return (simulatorPtr_); }
1310 {
return hasCFields_; }
1331 {
return hasFreeEnergy_; }
1333 #ifndef RPC_SYSTEM_TPP
A spatially homogeneous mixture.
An IntVec<D, T> is a D-component vector of elements of integer type T.
Flory-Huggins excess free energy model.
Field of real double precision values on an FFT mesh.
bool hasData() const
Has field data been set in either format?
Base template for UnitCell<D> classes, D=1, 2 or 3.
A list of c fields stored in both basis and r-grid format.
Spatial domain and spatial discretization for a periodic structure.
Factory for subclasses of Iterator.
Base class for iterative solvers for SCF equations.
A field to which the total density is constrained.
Solver for a mixture of polymers and solvents.
Factory for subclasses of Simulator.
Field theoretic simulator (base class).
Default Factory for subclasses of Sweep.
Solve a sequence of SCFT problems along a line in parameter space.
Main class for SCFT or PS-FTS simulation of one system.
void expandRGridDimension(const std::string &inFileName, const std::string &outFileName, int d, DArray< int > newGridDimensions)
Expand the number of spatial dimensions of an r-grid field.
Mask< D > & mask()
Get the mask (field to which total density is constrained).
WFieldContainer< D > const & w() const
Get container of chemical potential fields (w fields).
int iterate(bool isContinuation=false)
Iteratively solve a SCFT problem.
void writeGroup(std::string const &filename) const
Output all elements of the space group.
void scaleFieldsBasis(const std::string &inFileName, const std::string &outFileName, double factor)
Multiply all components of an array of basis fields by a scalar.
void writeQTail(std::string const &filename, int polymerId, int blockId, int directionId) const
Write the final slice of a propagator in r-grid format.
void readWBasis(const std::string &filename)
Read chemical potential fields in symmetry adapted basis format.
void writeWBasis(const std::string &filename) const
Write chemical potential fields in symmetrized basis format.
void compute(bool needStress=false)
Solve the modified diffusion equation once, without iteration.
void setWRGrid(DArray< RField< D > > const &fields)
Set new w fields, in real-space (r-grid) format.
void writeWRGrid(const std::string &filename) const
Write chemical potential fields in real space grid (r-grid) format.
Mixture< D > & mixture()
Get the Mixture by non-const reference.
void setOptions(int argc, char **argv)
Process command line options.
Simulator< D > & simulator()
Get the Simulator for field theoretic simulation.
void readCommands()
Read and process commands from the default command file.
bool hasMask() const
Does this system have a mask (inhomogeneous density constraint)?
void simulate(int nStep)
Perform a field theoretic simulation (PS-FTS).
void writeQAll(std::string const &basename)
Write all propagators of all blocks, each to a separate file.
bool checkRGridFieldSymmetry(const std::string &inFileName, double epsilon=1.0E-8)
Check if r-grid fields have the declared space group symmetry.
void replicateUnitCell(const std::string &inFileName, const std::string &outFileName, IntVec< D > const &replicas)
Replicate the crystal unit cell to create a larger cell.
void writeTimers(std::ostream &out)
Write timer information to an output stream.
void compare(const DArray< DArray< double > > field1, const DArray< DArray< double > > field2)
Compare arrays of fields in basis format, output a report.
bool hasFreeEnergy() const
Has the free energy been computed from the current w fields?
Iterator< D > & iterator()
Get the Iterator by non-const reference.
void writeCBasis(const std::string &filename) const
Write concentration fields in symmetrized basis format.
void writeThermo(std::ostream &out)
Write thermodynamic properties to a file.
FileMaster & fileMaster()
Get the FileMaster.
bool hasIterator() const
Does this system have an Iterator object?
void setUnitCell(UnitCell< D > const &unitCell)
Set parameters of the associated unit cell.
void rGridToKGrid(const std::string &inFileName, const std::string &outFileName)
Convert fields from real-space (r-grid) to Fourier (k-grid) format.
CFieldContainer< D > const & c() const
Get container of monomer concentration fields (c fields).
void basisToKGrid(const std::string &inFileName, const std::string &outFileName)
Convert fields from symmetrized basis to Fourier (k-grid) format.
void computeFreeEnergy()
Compute free energy density and pressure for current fields.
void setWBasis(DArray< DArray< double > > const &fields)
Set chemical potential fields, in symmetry-adapted basis format.
void clearTimers()
Clear timers.
void scaleFieldsRGrid(const std::string &inFileName, const std::string &outFileName, double factor) const
Multiply all elements of an array of r-grid fields by a scalar.
void writeQ(std::string const &filename, int polymerId, int blockId, int directionId) const
Write one propagator for one block, in r-grid format.
bool hasSimulator() const
Does this system have an initialized Simulator?
void writeBlockCRGrid(const std::string &filename) const
Write c-fields for all blocks and solvents in r-grid format.
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
void writeParamNoSweep(std::ostream &out) const
Write parameter file to an ostream, omitting any sweep block.
void sweep()
Sweep in parameter space, solving an SCF problem at each point.
void kGridToBasis(const std::string &inFileName, const std::string &outFileName)
Convert fields from Fourier (k-grid) to symmetrized basis format.
void readWRGrid(const std::string &filename)
Read chemical potential fields in real space grid (r-grid) format.
bool hasCFields() const
Have c fields been computed from the current w fields?
double fHelmholtz() const
Get precomputed Helmoltz free energy per monomer / kT.
void kGridToRGrid(const std::string &inFileName, const std::string &outFileName)
Convert fields from Fourier (k-grid) to real-space (r-grid) format.
bool hasSweep() const
Does this system have a Sweep object?
void estimateWfromC(const std::string &filename)
Construct trial w-fields from c-fields in symmetry-adapted form.
void writeCRGrid(const std::string &filename) const
Write concentration fields in real space grid (r-grid) format.
bool hasExternalFields() const
Does this system have external potential fields?
Domain< D > const & domain() const
Get Domain by const reference.
void writeQSlice(std::string const &filename, int polymerId, int blockId, int directionId, int segmentId) const
Write slice of a propagator at fixed s in r-grid format.
double pressure() const
Get precomputed pressure x monomer volume / kT.
void basisToRGrid(const std::string &inFileName, const std::string &outFileName)
Convert a field from symmetrized basis format to r-grid format.
Homogeneous::Mixture & homogeneous()
Get homogeneous mixture (for reference calculations).
void writeStars(std::string const &filename) const
Output information about stars and symmetrized basis functions.
void readParam()
Read input parameters from default param file.
void writeStress(std::ostream &out)
Write stress properties to a file.
WFieldContainer< D > & h()
Get container of external potential fields (reference).
Interaction & interaction()
Get Interaction (excess free energy model) by reference.
void rGridToBasis(const std::string &inFileName, const std::string &outFileName)
Convert a field from real-space grid to symmetrized basis format.
void writeWaves(std::string const &filename) const
Output information about waves.
A container of fields stored in both basis and r-grid format.
Dynamically allocatable contiguous array template.
A fixed capacity (static) contiguous array with a variable logical size.
A FileMaster manages input and output files for a simulation.
An object that can read multiple parameters from file.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
PSCF package top-level namespace.
Utility classes for scientific computation.