8#include <fd1d/sweep/SweepParameter.h>
9#include <fd1d/solvers/Block.h>
10#include <fd1d/solvers/Mixture.h>
11#include <fd1d/solvers/Polymer.h>
12#include <fd1d/System.h>
13#include <pscf/inter/Interaction.h>
14#include <util/containers/FSArray.h>
52 void SweepParameter::readParamType(std::istream& in)
56 std::transform(buffer.begin(), buffer.end(),
57 buffer.begin(), ::tolower);
59 if (buffer ==
"block" || buffer ==
"block_length") {
62 }
else if (buffer ==
"chi") {
65 }
else if (buffer ==
"kuhn") {
68 }
else if (buffer ==
"phi_polymer") {
71 }
else if (buffer ==
"phi_solvent") {
74 }
else if (buffer ==
"mu_polymer") {
77 }
else if (buffer ==
"mu_solvent") {
80 }
else if (buffer ==
"solvent" || buffer ==
"solvent_size") {
83 }
else if (buffer ==
"cell_param") {
87 UTIL_THROW(
"Invalid SweepParameter::ParamType value");
123 if (type_ ==
Block) {
125 }
else if (type_ == Chi) {
127 }
else if (type_ == Kuhn) {
129 }
else if (type_ == Phi_Polymer) {
130 return "phi_polymer";
131 }
else if (type_ == Phi_Solvent) {
132 return "phi_solvent";
133 }
else if (type_ == Mu_Polymer) {
135 }
else if (type_ == Mu_Solvent) {
138 return "solvent_size";
140 UTIL_THROW(
"Invalid type_ in accessor SweepParameter::type().");
144 double SweepParameter::get_()
146 if (type_ ==
Block) {
147 return systemPtr_->
mixture().
polymer(
id(0)).block(
id(1)).length();
148 }
else if (type_ == Chi) {
150 }
else if (type_ == Kuhn) {
152 }
else if (type_ == Phi_Polymer) {
154 }
else if (type_ == Phi_Solvent) {
156 }
else if (type_ == Mu_Polymer) {
158 }
else if (type_ == Mu_Solvent) {
160 }
else if (type_ == Solvent) {
163 UTIL_THROW(
"Invalid type_ in SweepParameter::get_.");
167 void SweepParameter::set_(
double newVal)
169 if (type_ == Block) {
170 systemPtr_->
mixture().
polymer(
id(0)).block(
id(1)).setLength(newVal);
171 }
else if (type_ == Chi) {
173 }
else if (type_ == Kuhn) {
175 }
else if (type_ == Phi_Polymer) {
177 }
else if (type_ == Phi_Solvent) {
179 }
else if (type_ == Mu_Polymer) {
181 }
else if (type_ == Mu_Solvent) {
183 }
else if (type_ == Solvent) {
186 UTIL_THROW(
"Invalid type_ in SweepParameter::set_.");
202 param.readParamType(in);
204 for (
int i = 0; i < param.nID_; ++i) {
224 for (
int i = 0; i < param.nID_; ++i) {
228 out << param.change_;
Block within a branched polymer.
void setKuhn(int monomerId, double kuhn)
Reset statistical segment length for one monomer type.
Solver and descriptor for a solvent species.
Class for storing data about an individual sweep parameter.
void getInitial()
Store the pre-sweep value of the corresponding parameter.
std::string type() const
Return a string representation of the parameter type.
int id(int i) const
Get a id for a sub-object or element to which this is applied.
void writeParamType(std::ostream &out) const
Write the parameter type to an output stream.
SweepParameter()
Default constructor.
void update(double newVal)
Update the corresponding parameter value in the system.
Main class in SCFT simulation of one system.
Mixture & mixture()
Get Mixture by reference.
Interaction & interaction()
Get interaction (i.e., excess free energy) by reference.
double chi(int i, int j) const
Return one element of the chi matrix.
void setChi(int i, int j, double chi)
Change one element of the chi matrix.
Polymer & polymer(int id)
Get a polymer object.
Monomer const & monomer(int id) const
Get a Monomer type descriptor (const reference).
Solvent & solvent(int id)
Set a solvent solver object.
double kuhn() const
Statistical segment length (random walk step size).
void allocate(int capacity)
Allocate the underlying C array.
void deallocate()
Dellocate the underlying C array.
bool isAllocated() const
Return true if this DArray has been allocated, false otherwise.
File containing preprocessor macros for error handling.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.