1#ifndef PRDC_SYSTEM_TMPL_H
2#define PRDC_SYSTEM_TMPL_H
12#include <util/param/ParamComposite.h>
14#include <prdc/crystal/UnitCell.h>
15#include <pscf/chem/PolymerModel.h>
16#include <util/misc/FileMaster.h>
20 template <
typename E,
int N>
class FSArray;
99 template <
int D,
class T>
106 using MixtureT =
typename T::Mixture;
107 using InteractionT =
typename T::Interaction;
108 using DomainT =
typename T::Domain;
109 using WFieldsT =
typename T::WFields;
110 using CFieldsT =
typename T::CFields;
111 using MaskT =
typename T::Mask;
112 using RFieldT =
typename T::RField;
167 virtual void readParam(std::istream& in);
226 void compute(
bool needStress =
false);
262 int iterate(
bool isContinuation =
false);
357 typename T::CFields
const &
c()
const;
362 typename T::WFields&
w();
367 typename T::WFields
const &
w()
const;
372 typename T::WFields&
h();
377 typename T::WFields
const &
h()
const;
387 typename T::Mask
const &
mask()
const;
411 typename T::Interaction
const &
interaction()
const;
416 typename T::Domain
const &
domain()
const;
431 typename T::Environment
const &
environment()
const;
436 typename T::ScftThermo&
scft();
441 typename T::ScftThermo
const &
scft()
const;
456 typename T::Iterator
const &
iterator()
const;
476 typename T::Simulator
const &
simulator()
const;
553 typename T::Mixture mixture_;
558 typename T::Domain domain_;
568 typename T::WFields w_;
573 typename T::CFields c_;
578 typename T::WFields h_;
583 typename T::Mask mask_;
590 typename T::MixtureModifier* mixtureModifierPtr_;
595 typename T::Interaction* interactionPtr_;
600 typename T::Environment* environmentPtr_;
605 typename T::EnvironmentFactory* environmentFactoryPtr_;
610 typename T::ScftThermo* scftPtr_;
615 typename T::Iterator* iteratorPtr_;
620 typename T::IteratorFactory* iteratorFactoryPtr_;
625 typename T::Sweep* sweepPtr_;
630 typename T::SweepFactory* sweepFactoryPtr_;
635 typename T::Simulator* simulatorPtr_;
640 typename T::SimulatorFactory* simulatorFactoryPtr_;
645 typename T::System* systemPtr_;
657 bool isAllocatedGrid_;
662 bool isAllocatedBasis_;
678 void allocateFieldsGrid();
683 void allocateFieldsBasis();
693 void readEcho(std::istream& in, std::string&
string)
const;
703 void readEcho(std::istream& in,
double& value)
const;
710 template <
int D,
class T>
inline
715 template <
int D,
class T>
inline
719 return *mixtureModifierPtr_;
723 template <
int D,
class T>
inline
727 return *interactionPtr_;
731 template <
int D,
class T>
inline
735 return *interactionPtr_;
739 template <
int D,
class T>
inline
744 template <
int D,
class T>
inline
746 {
return (environmentPtr_); }
749 template <
int D,
class T>
inline
753 return *environmentPtr_;
757 template <
int D,
class T>
inline
761 return *environmentPtr_;
765 template <
int D,
class T>
inline
773 template <
int D,
class T>
inline
781 template <
int D,
class T>
inline
783 {
return (iteratorPtr_); }
786 template <
int D,
class T>
inline
790 return *iteratorPtr_;
794 template <
int D,
class T>
inline
798 return *iteratorPtr_;
802 template <
int D,
class T>
inline
804 {
return (sweepPtr_); }
807 template <
int D,
class T>
inline
809 {
return (simulatorPtr_); }
812 template <
int D,
class T>
inline
816 return *simulatorPtr_;
820 template <
int D,
class T>
inline
824 return *simulatorPtr_;
828 template <
int D,
class T>
inline
830 {
return fileMaster_; }
833 template <
int D,
class T>
inline
835 {
return fileMaster_; }
838 template <
int D,
class T>
inline
843 template <
int D,
class T>
inline
848 template <
int D,
class T>
inline
853 template <
int D,
class T>
inline
858 template <
int D,
class T>
inline
863 template <
int D,
class T>
inline
868 template <
int D,
class T>
inline
T::Domain const & domain() const
Get the Domain (const).
T::Mask & mask()
Get the mask (non-const).
void compute(bool needStress=false)
Solve the modified diffusion equation once, without iteration.
void computeStress()
Compute SCFT stress.
bool hasIterator() const
Does this system have an Iterator?
T::Simulator & simulator()
Get the Simulator (non-const).
T::Interaction & interaction()
Get the Interaction (non-const).
int iterate(bool isContinuation=false)
Iteratively solve a SCFT problem.
virtual void readParameters(std::istream &in)
Read body of parameter block (without opening and closing lines).
T::Environment & environment()
Get the Environment (non-const).
T::ScftThermo & scft()
Get the ScftThermo object (non-const).
void clearCFields()
Mark c-fields and free energy as outdated or invalid.
void readParam()
Read input parameters from default param file.
void setUnitCell(UnitCell< D > const &unitCell)
Set parameters of the associated unit cell.
T::WFields & w()
Get the chemical potential (w) fields (non-const).
void setOptions(int argc, char **argv)
Process command line options.
void simulate(int nStep)
Perform a field theoretic simulation (PS-FTS).
T::MixtureModifier & mixtureModifier()
Get the MixtureModifier (non-const).
bool hasSimulator() const
Does this system have a Simulator?
bool hasSweep() const
Does this system have a Sweep?
T::Mixture const & mixture() const
Get the Mixture (const).
void sweep()
Sweep in parameter space, solving an SCF problem at each point.
T::Iterator & iterator()
Get the Iterator (non-const).
void writeTimers(std::ostream &out) const
Write timer information to an output stream.
void clearTimers()
Clear timers.
void readCommands()
Read and process commands from the default command file.
virtual void setThreadCount(int nThread)
Set the number of threads given as a command line argument.
T::CFields const & c() const
Get the monomer concentration (c) fields (const).
void writeParamNoSweep(std::ostream &out) const
Write partial parameter file to an ostream.
bool hasEnvironment() const
Does this system have an Environment?
void clearUnitCellData()
Notify System members that unit cell parameters have been modified.
SystemTmpl(typename T::System &system)
Constructor.
FileMaster & fileMaster()
Get the FileMaster (non-const).
T::WFields & h()
Get the external potential (h) fields (non-const).
Base template for UnitCell<D> classes, D=1, 2 or 3.
A fixed capacity (static) contiguous array with a variable logical size.
A FileMaster manages input and output files for a simulation.
ParamComposite()
Constructor.
#define UTIL_ASSERT(condition)
Assertion macro suitable for debugging serial or parallel code.
Type
Scoped enumeration of polymer model types.
Periodic fields and crystallography.
PSCF package top-level namespace.
Utility classes for scientific computation.