8#include "HomogeneousComparison.h"
10#include <pscf/inter/Interaction.h>
11#include <pscf/floryHuggins/Clump.h>
13#include <util/format/Str.h>
14#include <util/format/Int.h>
15#include <util/format/Dbl.h>
58 if (!p_.isAllocated()) {
65 for (
int i = 0; i < np; ++i) {
73 if (mode == 1 || mode == 2) {
75 if (!m_.isAllocated()) {
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)
double phi(int id) const
Return molecular volume fraction for one species.
void setComposition(DArray< double > const &phi)
Set system composition.
double fHelmholtz() const
Return Helmholtz free energy per monomer / kT.
void computeMu(Interaction const &interaction, double xi=0.0)
Compute chemical potential from preset composition.
int nMolecule() const
Get number of molecule species (polymer + solvent).
void computeFreeEnergy(Interaction const &interaction)
Compute Helmholtz free energy and pressure.
void computePhi(Interaction const &interaction, DArray< double > const &mu, DArray< double > const &phi, double &xi)
Compute composition from chemical potentials.
double pressure() const
Return pressure in units of kT / monomer volume.
int nPolymer() const
Get number of polymer species.
int nSolvent() const
Get number of solvent (point particle) species.
double vMonomer() const
Get monomer reference volume (set to 1.0 by default).
PolymerT & polymer(int id)
Get a polymer solver object by non-const reference.
int nx() const
Get number of spatial grid points, including both endpoints.
double volume() const
Get generalized volume of domain.
HomogeneousComparison()
Default constructor.
void output(int mode, std::ostream &out)
Output comparison to a homogeneous reference system.
void compute(int mode)
Compute properties of a homogeneous reference system.
~HomogeneousComparison()
Destructor.
FloryHuggins::Mixture const & homogeneous() const
Get homogeneous mixture by const reference.
SystemAccess()
Default constructor.
const Domain & domain() const
Get spatial domain (including grid info) by reference.
const Interaction & interaction() const
Get interaction (i.e., excess free energy model) by reference.
const System & system() const
Get parent System by reference.
const Mixture & mixture() const
Get Mixture by reference.
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.
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.
SCFT with real 1D fields.
PSCF package top-level namespace.