8#include "FilmFieldGenExt_c.h"
9#include <rp/solvers/Mixture.h>
10#include <rp/field/Domain.h>
11#include <rp/field/FieldIo.h>
12#include <rp/field/CFields.h>
13#include <rp/field/WFields.h>
14#include <rp/field/Mask.h>
15#include <rp/scft/iterator/Iterator.h>
17#include <pscf/field/cpp/RField.h>
18#include <pscf/crystal/Basis.h>
19#include <pscf/crystal/paramIdConversions.h>
20#include <pscf/math/IntVec.h>
73 system().domain().lattice());
74 if (nvParamId != paramId)
return 0.0;
83 int nMonomer =
system().mixture().nMonomer();
84 int nx =
system().domain().mesh().size();
87 maskDeriv.allocate(
system().domain().mesh().dimensions());
88 hDeriv.allocate(
system().domain().mesh().dimensions());
98 for (
int ind = 0; ind < 3; ind++) {
100 dim[ind] =
system().domain().mesh().dimensions()[ind];
107 for (x = 0; x < dim[0]; x++) {
109 for (y = 0; y < dim[1]; y++) {
111 for (z = 0; z < dim[2]; z++) {
113 maskVal = maskRGrid[counter];
120 maskDeriv[counter] = maskVal * (maskVal - 1) * 8.0
121 * (std::abs(d - 0.5) - 0.5)
128 for (
int i = 0; i < nMonomer; i++) {
131 for (x = 0; x < dim[0]; x++) {
133 for (y = 0; y < dim[1]; y++) {
135 for (z = 0; z < dim[2]; z++) {
139 hDeriv[counter] = -1.0 * maskDeriv[counter] *
chiBottom(i);
141 hDeriv[counter] = -1.0 * maskDeriv[counter] *
chiTop(i);
150 for (
int i = 0; i < nx; i++) {
151 term += c[i] * hDeriv[i];
154 term /= (
system().mask().phiTot() * nx);
186 for (
int ind = 0; ind < 3; ind++) {
188 dim[ind] =
system().domain().mesh().dimension(ind);
200 for (
int i = 0; i < nm; i++) {
209 for (i = 0; i < nm; i++) {
210 for (x = 0; x < dim[0]; x++) {
212 for (y = 0; y < dim[1]; y++) {
214 for (z = 0; z < dim[2]; z++) {
219 rhoW = maskPtr[counter];
222 hRGrid[i][counter++] = (1.0-rhoW) *
chiBottom(i);
224 hRGrid[i][counter++] = (1.0-rhoW) *
chiTop(i);
233 bool isSymmetric =
system().domain().hasGroup();
239 system().h().setRGrid(hRGrid, isSymmetric);
248 {
return system().domain().groupName(); }
256 {
return system().domain().unitCell().rBasis(
id); }
263 {
return system().mixture().nMonomer(); }
271 template class FilmFieldGenExt<1,CPT>;
272 template class FilmFieldGenExt<2,CPT>;
273 template class FilmFieldGenExt<3,CPT>;
An IntVec<D, T> is a D-component vector of elements of integer type T.
A RealVec<D, T> is D-component vector with elements of floating type T.
int normalVecId() const
Get value of normalVecId.
bool isAthermal() const
Are the walls athermal?
RealVec< D > normalVecCurrent_
The lattice vector normal to the film used to generate these fields.
DArray< double > chiBottomCurrent_
The chiBottom array used to generate the current external fields.
double interfaceThickness() const
Get value of interfaceThickness.
DArray< double > const & chiBottom() const
Get const chiBottom matrix by reference.
FilmFieldGenExtBase()
Constructor.
DArray< double > chiTopCurrent_
The chiTop array used to generate the current external fields.
DArray< double > const & chiTop() const
Get const chiTop array by reference.
int systemNMonomer() const
Get the number of monomer species for this system.
RealVec< D > systemLatticeVector(int id) const
Get one of the lattice vectors for this system.
System< D, CPT > & system()
Get the parent System by non-const reference.
FilmFieldGenExt()
Default constructor.
Base class template for classes that represent a complete system.
Dynamically allocatable contiguous array template.
void allocate(int capacity)
Allocate the underlying C array.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
int convertFullParamIdToReduced(const int fullId, const typename UnitCell< D >::LatticeSystem lattice)
Convert full lattice parameter index to a reduced index.
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.