12#include <util/param/ParamComposite.h>
13#include <rpg/solvers/Mixture.h>
14#include <rpg/field/Domain.h>
15#include <rpg/field/FieldIo.h>
16#include <rpg/field/WFieldContainer.h>
17#include <rpg/field/CFieldContainer.h>
18#include <rpg/field/Mask.h>
19#include <prdc/cuda/RField.h>
20#include <prdc/cuda/RFieldDft.h>
21#include <pscf/homogeneous/Mixture.h>
22#include <util/misc/FileMaster.h>
23#include <util/containers/DArray.h>
28 template <
typename T,
int N>
class FSArray;
146 virtual void readParam(std::istream& in);
204 void readWBasis(
const std::string & filename);
226 void readWRGrid(
const std::string & filename);
366 void compute(
bool needStress =
false);
391 int iterate(
bool isContinuation =
false);
519 void writeWRGrid(
const std::string & filename)
const;
533 void writeCRGrid(
const std::string & filename)
const;
561 int polymerId,
int blockId,
562 int directionId,
int segmentId)
const;
572 void writeQTail(std::string
const & filename,
int polymerId,
573 int blockId,
int directionId)
const;
583 void writeQ(std::string
const & filename,
int polymerId,
584 int blockId,
int directionId)
const;
604 void writeQAll(std::string
const & basename);
618 void writeStars(
const std::string & filename)
const;
628 void writeWaves(
const std::string & filename)
const;
635 void writeGroup(std::string
const & filename)
const;
652 const std::string & outFileName);
668 const std::string & outFileName);
677 const std::string& outFileName);
686 const std::string & outFileName);
702 const std::string& outFileName);
711 const std::string & outFileName);
745 double epsilon = 1.0E-8);
755 const std::string & outFileName,
766 const std::string & outFileName,
767 double factor)
const;
789 const std::string & outFileName,
806 const std::string & outFileName,
1117 bool isAllocatedGrid_;
1122 bool isAllocatedBasis_;
1137 bool hasFreeEnergy_;
1156 void allocateFieldsGrid();
1163 void allocateFieldsBasis();
1170 void readFieldHeader(std::string filename);
1180 void readEcho(std::istream& in, std::string&
string)
const;
1190 void readEcho(std::istream& in,
double& value)
const;
1195 void initHomogeneous();
1204 {
return mixture_; }
1209 {
return mixture_; }
1216 return *interactionPtr_;
1224 return *interactionPtr_;
1239 {
return domain_.unitCell(); }
1244 {
return domain_.mesh(); }
1249 {
return domain_.basis(); }
1254 {
return domain_.fft(); }
1259 {
return domain_.fieldIo(); }
1266 return *iteratorPtr_;
1274 return *iteratorPtr_;
1282 return *simulatorPtr_;
1288 {
return fileMaster_; }
1294 {
return homogeneous_; }
1347 {
return hasFreeEnergy_; }
1352 {
return hasCFields_; }
1357 {
return (iteratorPtr_); }
1362 {
return (sweepPtr_); }
1367 {
return (simulatorPtr_); }
1372 {
return h_.hasData(); }
1377 {
return mask_.hasData(); }
1379 #ifndef RPG_SYSTEM_TPP
Dynamic array on the GPU device with aligned data.
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.
Description of a regular grid of points in a periodic domain.
Symmetry-adapted Fourier basis for pseudo-spectral scft.
Fourier transform wrapper.
Field of real double precision values on an FFT mesh.
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.
File input/output operations and format conversions for fields.
Factory for subclasses of Iterator.
Base class for iterative solvers for SCF equations.
A field to which the total monomer concentration 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 problems along a line in parameter space.
Main class for calculations that represent 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.
bool hasExternalFields() const
Does this system have external potential fields?
void kGridToBasis(const std::string &inFileName, const std::string &outFileName)
Convert fields from Fourier (k-grid) to symmetrized basis format.
void writeCBasis(const std::string &filename)
Write concentrations in symmetry-adapted basis format.
void estimateWfromC(const std::string &filename)
Construct trial w-fields from c-fields.
void writeQTail(std::string const &filename, int polymerId, int blockId, int directionId) const
Write the final slice of a propagator in r-grid format.
Simulator< D > & simulator()
Get Simulator for field theoretic simulation.
bool hasMask() const
Does this system have a mask (inhomogeneous density constraint) ?
void readParam()
Read input parameters from default param file.
void computeFreeEnergy()
Compute free energy density and pressure for current fields.
void writeBlockCRGrid(const std::string &filename) const
Write c fields for all blocks and solvents in r-grid 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 writeQ(std::string const &filename, int polymerId, int blockId, int directionId) const
Write one propagator for one block, in r-grid format.
void writeTimers(std::ostream &out)
Write timer file to an ostream.
Mixture< D > & mixture()
Get Mixture by reference.
void rGridToKGrid(const std::string &inFileName, const std::string &outFileName)
Convert fields from real-space (r-grid) to Fourier (k-grid) format.
void rGridToBasis(const std::string &inFileName, const std::string &outFileName)
Convert a field from real-space grid to symmetrized basis format.
void setWBasis(DArray< DArray< double > > const &fields)
Set chemical potential fields, in symmetry-adapted basis format.
void kGridToRGrid(const std::string &inFileName, const std::string &outFileName)
Convert fields from Fourier (k-grid) to real-space (r-grid) format.
FieldIo< D > const & fieldIo() const
Get the FieldIo by const reference.
void writeParamNoSweep(std::ostream &out) const
Write parameter file to an ostream, omitting the sweep block.
void readCommands()
Read and process commands from the default command file.
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 writeWBasis(const std::string &filename)
Write chemical potential fields in symmetry adapted basis format.
void writeGroup(std::string const &filename) const
Output all elements of the space group.
Homogeneous::Mixture & homogeneous()
Get homogeneous mixture (for reference calculations).
Mesh< D > const & mesh() const
Get spatial discretization Mesh by const reference.
void writeWRGrid(const std::string &filename) const
Write chemical potential fields in real space grid (r-grid) format.
Domain< D > & domain()
Get Domain by non const reference.
void symmetrizeWFields()
Symmetrize r-grid w-fields, compute basis components.
void readWBasis(const std::string &filename)
Read chemical potential fields in symmetry adapted basis format.
void writeStars(const std::string &filename) const
Output information about stars and symmetrized basis functions.
Iterator< D > & iterator()
Get the iterator by non-const reference.
virtual void readParameters(std::istream &in)
Read body of parameter file (without opening, closing lines).
Mask< D > & mask()
Get the mask (field to which total density is constrained).
void sweep()
Sweep in parameter space, solving an SCF problem at each point.
bool hasFreeEnergy() const
Has the free energy been computed from the current w fields?
void basisToKGrid(const std::string &inFileName, const std::string &outFileName)
Convert fields from symmetrized basis to Fourier (k-grid) format.
double fHelmholtz() const
Get precomputed Helmoltz free energy per monomer / kT.
bool hasIterator() const
Does this system have an Iterator object?
int iterate(bool isContinuation=false)
Iteratively solve a SCFT problem.
void basisToRGrid(const std::string &inFileName, const std::string &outFileName)
Convert a field from symmetry-adapted basis to r-grid format.
double pressure() const
Get precomputed pressure times monomer volume / kT.
CFieldContainer< D > const & c() const
Get container of monomer concentration fields (c fields).
void writeStress(std::ostream &out)
Write stress properties to a file.
void readWRGrid(const std::string &filename)
Read chemical potential fields in real space grid (r-grid) format.
void setOptions(int argc, char **argv)
Process command line options.
bool hasCFields() const
Have c fields been computed from the current w fields ?
bool hasSimulator() const
Does this system have an initialized Simulator?
void clearTimers()
Clear timers.
void writeWaves(const std::string &filename) const
Output information about waves.
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 writeQSlice(std::string const &filename, int polymerId, int blockId, int directionId, int segmentId) const
Write specified slice of a propagator at fixed s in r-grid format.
UnitCell< D > const & unitCell() const
Get crystal UnitCell by const reference.
void writeCRGrid(const std::string &filename) const
Write concentration fields in real space grid (r-grid) format.
FFT< D > const & fft() const
Get the FFT object by const reference.
void writeQAll(std::string const &basename)
Write all propagators of all blocks, each to a separate file.
void compare(const DArray< DArray< double > > field1, const DArray< DArray< double > > field2)
Compare arrays of fields in basis format, output a report.
Interaction & interaction()
Get interaction (i.e., excess free energy) by reference.
bool hasSweep() const
Does this system have an associated Sweep object?
bool checkRGridFieldSymmetry(const std::string &inFileName, double epsilon=1.0E-8)
Check if r-grid fields have the declared space group symmetry.
void setUnitCell(UnitCell< D > const &unitCell)
Set parameters of the associated unit cell.
FileMaster & fileMaster()
Get FileMaster by reference.
void writeThermo(std::ostream &out)
Write thermodynamic properties to a file.
WFieldContainer< D > & h()
Get container of external potential fields (non-const reference).
void simulate(int nStep)
Perform a field theoretic simulation.
Basis< D > const & basis() const
Get the Basis by reference.
WFieldContainer< D > const & w() const
Get container of chemical potential fields (w fields).
void scaleFieldsBasis(const std::string &inFileName, const std::string &outFileName, double factor)
Multiply all components of an array of basis fields by a scalar.
A list 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.
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Periodic fields and crystallography.
PSCF package top-level namespace.
Utility classes for scientific computation.