1#ifndef RP_FILM_FIELD_GEN_EXT_BASE_TPP
2#define RP_FILM_FIELD_GEN_EXT_BASE_TPP
11#include "FilmFieldGenExtBase.h"
12#include <pscf/crystal/SpaceGroup.h>
13#include <pscf/sweep/ParameterType.h>
14#include <util/param/ParamComponent.h>
15#include <util/containers/GArray.h>
29 interfaceThickness_(-1.0),
30 excludedThickness_(-1.0)
52 read(in,
"normalVecId", normalVecId_);
53 read(in,
"interfaceThickness", interfaceThickness_);
54 read(in,
"excludedThickness", excludedThickness_);
64 if (normalVecId_ >= D || normalVecId_ < 0) {
65 UTIL_THROW(
"bad value for normalVecId, must be in [0,D)");
67 if (interfaceThickness_ > excludedThickness_) {
68 UTIL_THROW(
"excludedThickness must be larger than interfaceThickness");
70 if ((excludedThickness_ <= 0) || (interfaceThickness_ <= 0)) {
71 UTIL_THROW(
"excludedThickness and interfaceThickness must be >0");
76 chiBottom_.allocate(nm);
100 for (
int i = 0; i < chiBottom_.capacity(); i++) {
133 if (groupName.empty())
return;
138 readGroup(groupName, group);
141 std::string msg =
"Space group contains forbidden symmetry operations";
142 for (
int i = 0; i < group.
size(); i++) {
143 for (
int j = 0; j < D; j++) {
144 int r = group[i].R(normalVecId_,j);
145 if (j == normalVecId_) {
155 if (group[i].t(normalVecId_) != 0) {
174 for (
int i = 0; i < nm; i++) {
175 if (fabs(chiBottom_[i]-chiTop_[i]) > 1e-7) {
195 for (
int i = 0; i < nm; i++) {
196 if ((fabs(chiBottom_[i]) >= 1e-7) || (fabs(chiTop_[i]) >= 1e-7)) {
226 if (name ==
"chi_top") {
227 chiTop_[ids[0]] = value;
228 }
else if (name ==
"chi_bottom") {
229 chiBottom_[ids[0]] = value;
245 if (name ==
"chi_top") {
246 return chiTop_[ids[0]];
247 }
else if (name ==
"chi_bottom") {
248 return chiBottom_[ids[0]];
Type type_
Type of field (Mask, External, or None).
bool isDependent_
Is this object dependent on parameters of another FieldGeneratorBase?
FieldGenerator()
Constructor.
void readParameters(std::istream &in)
Read parameters and initialize.
bool isAthermal() const
Are the walls athermal?
virtual int systemNMonomer() const =0
Get the number of monomer species for this system.
virtual std::string systemSpaceGroup() const =0
Get the space group name for this system (empty if none).
RealVec< D > normalVecCurrent_
The lattice vector normal to the film used to generate these fields.
~FilmFieldGenExtBase()
Destructor.
double getParameter(std::string name, DArray< int > ids, bool &success) const
Get the value of a specialized sweep parameter.
DArray< double > chiBottomCurrent_
The chiBottom array used to generate the current external fields.
GArray< ParameterType > getParameterTypes()
Return specialized sweep parameter types to add to the Sweep object.
void checkCompatibility()
Check that the system is compatible with these fields.
bool hasSymmetricWalls() const
Are the walls chemically identical?
void setParameter(std::string name, DArray< int > ids, double value, bool &success)
Set the value of a specialized sweep parameter.
FilmFieldGenExtBase()
Constructor.
DArray< double > chiTopCurrent_
The chiTop array used to generate the current external fields.
bool needsUpdate() const
Check whether system has changed such that the fields need updating.
virtual RealVec< D > systemLatticeVector(int id) const =0
Get one of the lattice vectors for this system.
Crystallographic space group.
int size() const
Return number of elements in group (i.e., the order of the group).
Dynamically allocatable contiguous array template.
An automatically growable array, analogous to a std::vector.
void append(Data const &data)
Append an element to the end of the sequence.
static bool echo()
Get echo parameter.
static void setEcho(bool echo=true)
Enable or disable echoing for all subclasses of ParamComponent.
DArrayParam< Type > & readDArray(std::istream &in, const char *label, DArray< Type > &array, int n)
Add and read a required DArray < Type > parameter.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void resetParam()
Resets ParamComposite to its empty state.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.
ParameterType()
Constructor.