8#include "HomogeneousComparison.h"
10#include <pscf/inter/Interaction.h>
11#include <pscf/homogeneous/Clump.h>
13#include <util/format/Str.h>
14#include <util/format/Int.h>
15#include <util/format/Dbl.h>
65 for (
int i = 0; i < np; ++i) {
73 if (mode == 1 || mode == 2) {
79 for (
int i = 0; i < np; ++i) {
92 for (
int i = 0; i < np; ++i) {
95 for (
int j = 0; j < nb; ++j) {
104 UTIL_THROW(
"Unknown mode in computeHomogeneous");
125 out <<
"f (homo) = " <<
Dbl(fHomo, 18, 11)
126 <<
" [per monomer volume]" << std::endl;
127 out <<
"delta f = " <<
Dbl(df, 18, 11)
128 <<
" [per monomer volume]" << std::endl;
132 out <<
"Species:" << std::endl;
146 if (mode == 1 || mode == 2) {
154 double PhiExTot = -1.0*pEx*V;
155 double fExTot = fEx*V;
157 out <<
"f (homo) = " <<
Dbl(fHomo, 18, 11)
158 <<
" [per monomer volume]" << std::endl;
159 out <<
"p (homo) = " <<
Dbl(pHomo, 18, 11)
160 <<
" [per monomer volume]" << std::endl;
161 out <<
"delta f = " <<
Dbl(fEx, 18, 11)
162 <<
" [per monomer volume]" << std::endl;
163 out <<
"delta p = " <<
Dbl(pEx, 18, 11)
164 <<
" [per monomer volume]" << std::endl;
165 out <<
"Phi (ex) = " <<
Dbl(PhiExTot, 18, 11)
166 <<
" [total]" << std::endl;
167 out <<
"F (ex) = " <<
Dbl(fExTot, 18, 11)
168 <<
" [total]" << std::endl;
169 out <<
"V(tot)/v = " <<
Dbl(V, 18, 11) << std::endl;
174 out <<
"Species:" << std::endl;
186 <<
" " <<
Dbl(dV, 18, 11)
int nx() const
Get number of spatial grid points, including both endpoints.
double volume() const
Get generalized volume of domain.
void compute(int mode)
Compute properties of a homogeneous reference system.
HomogeneousComparison()
Default constructor.
void output(int mode, std::ostream &out)
Output comparison to a homogeneous reference system.
~HomogeneousComparison()
Destructor.
Concise accesss to an associated System.
const Interaction & interaction() const
Get interaction (i.e., excess free energy model) by reference.
const Domain & domain() const
Get spatial domain (including grid info) by reference.
const System & system() const
Get parent System by reference.
const Mixture & mixture() const
Get Mixture by reference.
const Homogeneous::Mixture & homogeneous() const
Get homogeneous mixture (for reference calculations).
Main class in SCFT simulation of one system.
double fHelmholtz() const
Get precomputed Helmholtz free energy per monomer / kT.
double pressure() const
Get precomputed pressure x monomer volume kT.
double pressure() const
Return pressure in units of kT / monomer volume.
double phi(int id) const
Return molecular volume fraction for one species.
void setComposition(DArray< double > const &phi)
Set system composition.
void computePhi(Interaction const &interaction, DArray< double > const &mu, DArray< double > const &phi, double &xi)
Compute composition from chemical potentials.
void computeFreeEnergy(Interaction const &interaction)
Compute Helmholtz free energy and pressure.
int nMolecule() const
Get number of molecule species (polymer + solvent).
void computeMu(Interaction const &interaction, double xi=0.0)
Compute chemical potential from preset composition.
double fHelmholtz() const
Return Helmholtz free energy per monomer / kT.
Polymer & polymer(int id)
Get a polymer object.
int nSolvent() const
Get number of solvent (point particle) species.
double vMonomer() const
Get monomer reference volume (set to 1.0 by default).
int nPolymer() const
Get number of polymer species.
int capacity() const
Return allocated size.
void allocate(int capacity)
Allocate the underlying C array.
bool isAllocated() const
Return true if this DArray has been allocated, false otherwise.
Wrapper for a double precision number, for formatted ostream output.
Wrapper for an int, for formatted ostream output.
#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).
Utility classes for scientific computation.