1#ifndef PSPG_SWEEP_PARAMETER_TPP
2#define PSPG_SWEEP_PARAMETER_TPP
11#include <pspg/System.h>
12#include <pspg/solvers/Mixture.h>
13#include <pspg/solvers/Polymer.h>
14#include <pspg/solvers/Block.h>
16#include <pscf/crystal/UnitCell.h>
17#include <pscf/inter/Interaction.h>
18#include <util/containers/FSArray.h>
63 std::transform(buffer.begin(), buffer.end(),
64 buffer.begin(), ::tolower);
66 if (buffer ==
"block" || buffer ==
"block_length") {
69 }
else if (buffer ==
"chi") {
72 }
else if (buffer ==
"kuhn") {
75 }
else if (buffer ==
"phi_polymer") {
78 }
else if (buffer ==
"phi_solvent") {
81 }
else if (buffer ==
"mu_polymer") {
84 }
else if (buffer ==
"mu_solvent") {
87 }
else if (buffer ==
"solvent" || buffer ==
"solvent_size") {
90 }
else if (buffer ==
"cell_param") {
94 std::string msg =
"Invalid SweepParameter::ParamType value: ";
100 if (id_.isAllocated()) id_.deallocate();
138 if (type_ ==
Block) {
140 }
else if (type_ == Chi) {
142 }
else if (type_ == Kuhn) {
144 }
else if (type_ == Phi_Polymer) {
145 return "phi_polymer";
146 }
else if (type_ == Phi_Solvent) {
147 return "phi_solvent";
148 }
else if (type_ == Mu_Polymer) {
150 }
else if (type_ == Mu_Solvent) {
153 return "solvent_size";
154 }
else if (type_ == Cell_Param) {
164 if (type_ ==
Block) {
165 return systemPtr_->mixture().polymer(
id(0)).block(
id(1)).length();
166 }
else if (type_ == Chi) {
167 return systemPtr_->interaction().chi(
id(0),
id(1));
168 }
else if (type_ == Kuhn) {
169 return systemPtr_->mixture().monomer(
id(0)).kuhn();
170 }
else if (type_ == Phi_Polymer) {
171 return systemPtr_->mixture().polymer(
id(0)).phi();
172 }
else if (type_ == Phi_Solvent) {
173 return systemPtr_->mixture().solvent(
id(0)).phi();
174 }
else if (type_ == Mu_Polymer) {
175 return systemPtr_->mixture().polymer(
id(0)).mu();
176 }
else if (type_ == Mu_Solvent) {
177 return systemPtr_->mixture().solvent(
id(0)).mu();
178 }
else if (type_ == Solvent) {
179 return systemPtr_->mixture().solvent(
id(0)).size();
180 }
else if (type_ == Cell_Param) {
181 return systemPtr_->unitCell().parameter(
id(0));
188 void SweepParameter<D>::set_(
double newVal)
190 if (type_ == Block) {
191 systemPtr_->mixture().polymer(
id(0)).block(
id(1)).setLength(newVal);
192 }
else if (type_ == Chi) {
193 systemPtr_->interaction().setChi(
id(0),
id(1), newVal);
194 }
else if (type_ == Kuhn) {
195 systemPtr_->mixture().setKuhn(
id(0), newVal);
196 }
else if (type_ == Phi_Polymer) {
197 systemPtr_->mixture().polymer(
id(0)).setPhi(newVal);
198 }
else if (type_ == Phi_Solvent) {
199 systemPtr_->mixture().solvent(
id(0)).setPhi(newVal);
200 }
else if (type_ == Mu_Polymer) {
201 systemPtr_->mixture().polymer(
id(0)).setMu(newVal);
202 }
else if (type_ == Mu_Solvent) {
203 systemPtr_->mixture().solvent(
id(0)).setMu(newVal);
204 }
else if (type_ == Solvent) {
205 systemPtr_->mixture().solvent(
id(0)).setSize(newVal);
206 }
else if (type_ == Cell_Param) {
208 params[id(0)] = newVal;
209 systemPtr_->setUnitCell(params);
216 template <
class Archive>
221 for (
int i = 0; i < nID_; ++i) {
241 param.readParamType(in);
243 for (
int i = 0; i < param.nID_; ++i) {
264 for (
int i = 0; i < param.nID_; ++i) {
268 out << param.change_;
Block within a branched polymer.
Solver and descriptor for a solvent species.
Class for storing data about an individual sweep parameter.
std::string type() const
Return a string representation of the parameter type.
void serialize(Archive ar, const unsigned int version)
Serialize to or from an archive.
SweepParameter()
Default constructor.
int id(int i) const
Get a id for a sub-object or element to which this is applied.
void getInitial()
Store the pre-sweep value of the corresponding parameter.
void update(double newVal)
Update the corresponding parameter value in the system.
void writeParamType(std::ostream &out) const
Write the parameter type to an output stream.
Main class in SCFT simulation of one system.
A fixed capacity (static) contiguous array with a variable logical size.
File containing preprocessor macros for error handling.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
void serializeEnum(Archive &ar, T &data, const unsigned int version=0)
Serialize an enumeration value.
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.