JDFTx  1.2.0
IdealGas.h
1 /*-------------------------------------------------------------------
2 Copyright 2011 Ravishankar Sundararaman
3 
4 This file is part of JDFTx.
5 
6 JDFTx is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 JDFTx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
18 -------------------------------------------------------------------*/
19 
20 #ifndef JDFTX_FLUID_IDEALGAS_H
21 #define JDFTX_FLUID_IDEALGAS_H
22 
23 #include <fluid/Molecule.h>
24 #include <core/ScalarFieldArray.h>
25 class FluidMixture;
26 struct FluidComponent;
27 
29 class IdealGas
30 {
31 public:
32  const int nIndep;
33  const Molecule& molecule;
34  const GridInfo& gInfo;
35  const double T;
36 
38 
40  IdealGas(int nIndep, const FluidMixture*, const FluidComponent*);
41  virtual ~IdealGas() {}
42 
47  virtual void initState(const ScalarField* Vex, ScalarField* indep, double scale, double Elo=-DBL_MAX, double Ehi=+DBL_MAX) const=0;
48 
50  virtual void getDensities(const ScalarField* indep, ScalarField* N, vector3<>& P0) const=0;
51 
57  virtual double compute(const ScalarField* indep, const ScalarField* N, ScalarField* Phi_N, const double Nscale, double& Phi_Nscale) const=0;
58 
62  virtual void convertGradients(const ScalarField* indep, const ScalarField* N, const ScalarField* Phi_N, const vector3<>& Phi_P0, ScalarField* Phi_indep, const double Nscale) const=0;
63 
64  double get_Nbulk();
65 
67  void overrideBulk(double Nbulk, double mu);
68 
69 protected:
70  double Nbulk;
71  double mu;
72  double corrPrefac;
73  friend class FluidMixture;
74 };
75 
76 #endif // JDFTX_FLUID_IDEALGAS_H
Abstract base class for an IdealGas evaluator.
Definition: IdealGas.h:29
std::vector< ScalarField > ScalarFieldArray
dynamic size collection of real space scalar fields
Definition: ScalarFieldArray.h:32
Simulation grid descriptor.
Definition: GridInfo.h:45
const GridInfo & gInfo
grid specifications
Definition: IdealGas.h:34
Mixture of fluids that provides the total free energy functional for minimization Constructing Fex an...
Definition: FluidMixture.h:32
const double T
temperature
Definition: IdealGas.h:35
virtual double compute(const ScalarField *indep, const ScalarField *N, ScalarField *Phi_N, const double Nscale, double &Phi_Nscale) const =0
Multi-site molecule model.
Definition: Molecule.h:31
double corrPrefac
prefactor for dipolar rotational correlations
Definition: IdealGas.h:72
ScalarFieldArray V
external site potentials
Definition: IdealGas.h:37
double mu
chemical potential for this molecule
Definition: IdealGas.h:71
IdealGas(int nIndep, const FluidMixture *, const FluidComponent *)
Initialize and register to be used with excess functional fex in its fluidMixture.
virtual void initState(const ScalarField *Vex, ScalarField *indep, double scale, double Elo=-DBL_MAX, double Ehi=+DBL_MAX) const =0
const int nIndep
Number of scalar fields used as independent variables.
Definition: IdealGas.h:32
Named fluid components for which bulk properties / geometries / excess functionals are available...
Definition: FluidComponent.h:27
classes ScalarFieldArray, ScalarFieldTildeArray and just enough operators to enable CG w...
double Nbulk
equilibirum density of this molecule in the bulk mixture
Definition: IdealGas.h:70
const Molecule & molecule
Associated molecule geometry.
Definition: IdealGas.h:33
void overrideBulk(double Nbulk, double mu)
Override the values for bulk density and chemical potential set by fluidMixture::initialize() ...
std::shared_ptr< ScalarFieldData > ScalarField
A smart reference-counting pointer to ScalarFieldData.
Definition: ScalarField.h:41
virtual void convertGradients(const ScalarField *indep, const ScalarField *N, const ScalarField *Phi_N, const vector3<> &Phi_P0, ScalarField *Phi_indep, const double Nscale) const =0
virtual void getDensities(const ScalarField *indep, ScalarField *N, vector3<> &P0) const =0
Given the independent variables indep, compute the site densities N and G=0 component of polarization...