20 #ifndef JDFTX_FLUID_FLUIDMIXTURE_H 21 #define JDFTX_FLUID_FLUIDMIXTURE_H 23 #include <fluid/FluidComponent.h> 24 #include <fluid/Fmix.h> 48 void initialize(
double P=1.01325*
Bar,
double epsBulkOverride=0.,
double epsInfOverride=0.);
52 double getBoilingPressure(
double NliqGuess,
double NvapGuess, std::vector<double>* Nvap=0)
const;
54 unsigned get_nIndep()
const {
return nIndepIdgas + (polarizable ? 3 : 0); }
57 const std::vector<const FluidComponent*>&
getComponents()
const;
71 void initState(
double scale = 0.0,
double Elo=-DBL_MAX,
double Ehi=+DBL_MAX);
77 void saveState(
const char* filename)
const;
112 double sync(
double x)
const;
115 unsigned nIndepIdgas;
121 std::vector<const FluidComponent*> component;
122 std::vector<const Fmix*> fmixArr;
124 std::vector<double> Kindep;
130 void addFmix(
const Fmix* fmix);
134 double computeUniformEx(
const std::vector< double >& Nmol, std::vector< double >& Phi_Nmol)
const;
137 double compute_p(
double Ntot)
const;
139 friend struct BoilingPressureSolver;
143 #endif // JDFTX_FLUID_FLUIDMIXTURE_H std::vector< ScalarField > ScalarFieldArray
dynamic size collection of real space scalar fields
Definition: ScalarFieldArray.h:32
Simulation grid descriptor.
Definition: GridInfo.h:45
double operator()(const ScalarFieldArray &indep, ScalarFieldArray &Phi_indep, Outputs outputs=Outputs()) const
Free energy and gradient evaluation.
ScalarFieldTilde * Phi_rhoExternal
derivative of free energy w.r.t rhoExternal
Definition: FluidMixture.h:84
double compute(ScalarFieldArray *grad, ScalarFieldArray *Kgrad)
Return energy at current state, and optionally the gradient (interface for minimize()) ...
Mixture of fluids that provides the total free energy functional for minimization Constructing Fex an...
Definition: FluidMixture.h:32
unsigned get_nDensities() const
get the total number of site densities
Definition: FluidMixture.h:55
double sync(double x) const
All processes minimize together; make sure scalars are in sync to round-off error.
void initState(double scale=0.0, double Elo=-DBL_MAX, double Ehi=+DBL_MAX)
std::shared_ptr< ScalarFieldTildeData > ScalarFieldTilde
A smart reference-counting pointer to ScalarFieldTildeData.
Definition: ScalarField.h:45
vector3 Eexternal
External uniform electric field.
Definition: FluidMixture.h:38
void initialize(double P=1.01325 *Bar, double epsBulkOverride=0., double epsInfOverride=0.)
ScalarFieldTilde Linv(const ScalarFieldTilde &)
Inverse Laplacian.
void loadState(const char *filename)
Load the state from a single binary file.
ScalarFieldTilde rhoExternal
Definition: FluidMixture.h:63
Abstract base class for mixing functionals: interactions between fluids (beyond hard sphere and scale...
Definition: Fmix.h:29
void step(const ScalarFieldArray &dir, double alpha)
Advance step along direction dir by scale alpha (interface for minimize())
const double Kelvin
Definition: Units.h:33
EnergyComponents * Phi
retrieve fluid energy components
Definition: FluidMixture.h:86
ScalarFieldTilde O(const ScalarFieldTilde &)
Inner product operator (diagonal in PW basis)
const double T
Temperature.
Definition: FluidMixture.h:36
const std::vector< const FluidComponent * > & getComponents() const
access component list
Commonly used measurement units in terms of atomic units.
Named fluid components for which bulk properties / geometries / excess functionals are available...
Definition: FluidComponent.h:27
double getFreeEnergy(Outputs outputs=Outputs()) const
Get the free energy, densities and moments for the current state.
ScalarFieldArray * N
site densities
Definition: FluidMixture.h:82
Nonlinear minimization templates.
bool verboseLog
print energy components etc. if enabled (off by default)
Definition: FluidMixture.h:37
Definition: EnergyComponents.h:36
double Qtol
If true, use the mean field kernel for external coulomb interactions as well.
Definition: FluidMixture.h:65
Outputs(ScalarFieldArray *N=0, vector3<> *electricP=0, ScalarFieldTilde *Phi_rhoExternal=0, ScalarFieldArray *psiEff=0, EnergyComponents *Phi=0)
initialize all the above to null
double getBoilingPressure(double NliqGuess, double NvapGuess, std::vector< double > *Nvap=0) const
const double Bar
Definition: Units.h:52
void saveState(const char *filename) const
Save the state to a single binary file.
vector3 * electricP
total electric dipole moment in cell (useful only with multipole-based IdealGas's) ...
Definition: FluidMixture.h:83
Optional outputs for operator() and getFreeEnergy(), retrieve results for all non-null pointers...
Definition: FluidMixture.h:80
Definition: Minimize.h:46
Represent components of the (free) energy.
ScalarFieldArray * psiEff
Estimate ideal gas effective potentials (useful only when no electric field or potential on non-indep...
Definition: FluidMixture.h:85
unsigned get_nIndep() const
get the number of scalar fields used as independent variables
Definition: FluidMixture.h:54