1#ifndef PSPC_FILM_ITERATOR_TPP
2#define PSPC_FILM_ITERATOR_TPP
11#include "FilmIterator.h"
12#include "pscf/crystal/UnitCell.h"
13#include "pscf/math/RealVec.h"
14#include "pspc/System.h"
26 template <
typename IteratorType>
40 template <
typename IteratorType>
47 if (iterator().flexibleParams()[0]) {
49 <<
"Warning - The lattice parameter is not allowed "
50 <<
"to be flexible for a 1D thin film system."
55 setFlexibleParams(params);
58 iterator().setFlexibleParams(params);
66 template <
typename IteratorType>
76 template <
typename IteratorType>
90 template <
typename IteratorType>
97 if (iterator().nFlexibleParams() == 0) {
98 setFlexibleParams(current);
103 for (
int i = 0; i < current.
size(); i++) {
112 for (
int i = 0; i < params.
size(); i++) {
113 if ((i != normalVecId()) && (i < 2)) {
120 setFlexibleParams(params);
124 if (nFlexibleParams() < iterator().nFlexibleParams()) {
126 <<
"***Notice - Some lattice parameters will be held constant\n"
127 <<
"to comply with the thin film constraint.***"
132 iterator().setFlexibleParams(params);
139 template <
typename IteratorType>
143 a = system().domain().unitCell().rBasis(0);
144 b = system().domain().unitCell().rBasis(1);
146 double gamma =
dot(a,b);
148 UTIL_THROW(
"ERROR: Lattice basis vectors must be orthogonal when wall is present");
158 template <
typename IteratorType>
172 template <
typename IteratorType>
180 system().domain().unitCell().lattice();
183 for (
int i = 0; i < current.
size(); i++) {
187 if (iterator().nFlexibleParams() == 0) {
188 setFlexibleParams(params);
199 Log::file() <<
"Rhombohedral lattice systems are not compatible "
200 <<
"with a thin film constraint.\n"
201 <<
"See thin film documentation for more details.\n";
202 UTIL_THROW(
"Cannot use rhombohedral lattice in a thin film system.");
215 if (current[0] && normalVecId() == 2) {
217 }
else if (current[1] && normalVecId() < 2) {
223 for (
int i = 0; i < 3; i++) {
225 if (i != normalVecId() && current[i]) {
239 params[normalVecId()+3] =
true;
245 setFlexibleParams(params);
249 if (nFlexibleParams() < iterator().nFlexibleParams()) {
251 <<
"***Notice - Some lattice parameters will be held constant\n"
252 <<
"to comply with the thin film constraint.***"
257 iterator().setFlexibleParams(params);
266 template <
typename IteratorType>
270 a = system().domain().unitCell().rBasis(0);
271 b = system().domain().unitCell().rBasis(1);
272 c = system().domain().unitCell().rBasis(2);
273 double alpha, beta, gamma;
278 if (normalVecId() == 0) {
279 if (beta > 1e-8 || gamma > 1e-8) {
280 UTIL_THROW(
"ERROR: If normalVecId = 0, beta and gamma must be 90 degrees");
282 }
else if (normalVecId() == 1) {
283 if (alpha > 1e-8 || gamma > 1e-8) {
284 UTIL_THROW(
"ERROR: If normalVecId = 1, alpha and gamma must be 90 degrees");
287 if (alpha > 1e-8 || beta > 1e-8) {
288 UTIL_THROW(
"ERROR: If normalVecId = 2, alpha and beta must be 90 degrees");
Descriptor for a FilmIterator object.
IteratorType const & iterator() const
Return const reference to the real iterator within this FilmIterator.
virtual void setFlexibleParams()=0
Modifies flexibleParams_ to be compatible with thin film constraint.
virtual void checkLatticeVectors() const =0
Check that lattice vectors are compatible with thin film constraint.
Iterator for a thin film (empty base template).
Main class for SCFT simulation of one system.
A RealVec<D, T> is D-component vector with elements of floating type T.
Base template for UnitCell<D> classes, D=1, 2 or 3.
A fixed capacity (static) contiguous array with a variable logical size.
int size() const
Return logical size of this array (i.e., number of elements).
void append(Data const &data)
Append data to the end of the array.
static std::ostream & file()
Get log ostream by reference.
void setClassName(const char *className)
Set class name string.
std::string className() const
Get class name string.
#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.
C++ namespace for polymer self-consistent field theory (PSCF).
T dot(Vec< D, T > const &v1, Vec< D, T > const &v2)
Return dot product of two vectors.
Utility classes for scientific computation.